fix(tui): format thinking paragraphs

This commit is contained in:
Brooklyn Nicholson 2026-04-26 15:38:18 -05:00
parent 64de685d3f
commit 6a3873942f
2 changed files with 26 additions and 7 deletions

View file

@ -12,7 +12,8 @@ import {
parseToolTrailResultLine,
pasteTokenLabel,
sameToolTrailGroup,
splitToolDuration
splitToolDuration,
thinkingPreview
} from '../lib/text.js'
describe('isToolTrailResultLine', () => {
@ -82,6 +83,17 @@ describe('estimateTokensRough', () => {
})
})
describe('thinkingPreview', () => {
it('adds paragraph breaks before markdown thinking headings', () => {
const raw =
'**Considering user instructions**\nI need to answer.**Planning tool execution**\nI can run tools.**Determining weather search parameters**\nUse SF.'
expect(thinkingPreview(raw, 'full')).toBe(
'**Considering user instructions**\nI need to answer.\n\n**Planning tool execution**\nI can run tools.\n\n**Determining weather search parameters**\nUse SF.'
)
})
})
describe('boundedLiveRenderText', () => {
it('preserves short live text verbatim', () => {
expect(boundedLiveRenderText('one\ntwo', { maxChars: 100, maxLines: 10 })).toBe('one\ntwo')