fix(tui): keep inline diffs below tool rows and strip ANSI

Follow-up on #13729 from blitz screenshot feedback.\n\n- When tool.complete carried inline_diff but no buffered assistant text existed, pending tool rows were still in streamPendingTools, so diff rendered above the tool row section. appendSegmentMessage now emits pending tool rows as a trail segment before appending the diff artifact.\n- Strip ANSI color escapes from inline_diff payloads so we don't render loud red/green terminal palettes in the transcript.
This commit is contained in:
Brooklyn Nicholson 2026-04-21 18:50:42 -05:00
parent dff1c8fcf1
commit bddf0cd61e
3 changed files with 28 additions and 7 deletions

View file

@ -190,6 +190,16 @@ class TurnController {
*/
appendSegmentMessage(msg: Msg) {
this.flushStreamingSegment()
if (this.pendingSegmentTools.length) {
this.segmentMessages = [
...this.segmentMessages,
{ kind: 'trail', role: 'system', text: '', tools: this.pendingSegmentTools }
]
this.pendingSegmentTools = []
patchTurnState({ streamPendingTools: [] })
}
this.segmentMessages = [...this.segmentMessages, msg]
patchTurnState({ streamSegments: this.segmentMessages })
}