feat(tui): stream thinking + tools expanded by default

Extends SECTION_DEFAULTS so the out-of-the-box TUI shows the turn as
a live transcript (reasoning + tool calls streaming inline) instead of
a wall of `▸` chevrons the user has to click every turn.

Final default matrix:

  - thinking: expanded
  - tools:    expanded
  - activity: hidden    (unchanged from the previous commit)
  - subagents: falls through to details_mode (collapsed by default)

Everything explicit in `display.sections` still wins, so anyone who
already pinned an override keeps their layout.  One-line revert is
`display.sections.<name>: collapsed`.
This commit is contained in:
Brooklyn Nicholson 2026-04-24 02:53:44 -05:00
parent 70925363b6
commit 67bfd4b828
3 changed files with 53 additions and 26 deletions

View file

@ -73,10 +73,16 @@ describe('resolveSections', () => {
describe('sectionMode', () => {
it('falls back to the global mode for sections without a built-in default', () => {
expect(sectionMode('tools', 'collapsed', {})).toBe('collapsed')
expect(sectionMode('tools', 'expanded', undefined)).toBe('expanded')
expect(sectionMode('thinking', 'collapsed', {})).toBe('collapsed')
expect(sectionMode('subagents', 'expanded', {})).toBe('expanded')
expect(sectionMode('subagents', 'collapsed', {})).toBe('collapsed')
expect(sectionMode('subagents', 'expanded', undefined)).toBe('expanded')
expect(sectionMode('subagents', 'hidden', {})).toBe('hidden')
})
it('streams thinking + tools expanded by default regardless of global mode', () => {
expect(sectionMode('thinking', 'collapsed', {})).toBe('expanded')
expect(sectionMode('thinking', 'hidden', undefined)).toBe('expanded')
expect(sectionMode('tools', 'collapsed', {})).toBe('expanded')
expect(sectionMode('tools', 'hidden', undefined)).toBe('expanded')
})
it('hides the activity panel by default regardless of global mode', () => {
@ -86,16 +92,17 @@ describe('sectionMode', () => {
})
it('honours per-section overrides over both the section default and global mode', () => {
expect(sectionMode('thinking', 'collapsed', { thinking: 'collapsed' })).toBe('collapsed')
expect(sectionMode('tools', 'collapsed', { tools: 'hidden' })).toBe('hidden')
expect(sectionMode('activity', 'collapsed', { activity: 'expanded' })).toBe('expanded')
expect(sectionMode('activity', 'expanded', { activity: 'collapsed' })).toBe('collapsed')
expect(sectionMode('tools', 'collapsed', { tools: 'expanded' })).toBe('expanded')
})
it('lets per-section overrides escape the global hidden mode', () => {
// Regression for the case where global details_mode: hidden used to
// short-circuit the entire accordion and prevent overrides from
// surfacing — `sections.tools: expanded` must still resolve to expanded.
expect(sectionMode('tools', 'hidden', { tools: 'expanded' })).toBe('expanded')
expect(sectionMode('subagents', 'hidden', { subagents: 'expanded' })).toBe('expanded')
expect(sectionMode('thinking', 'hidden', { thinking: 'collapsed' })).toBe('collapsed')
expect(sectionMode('activity', 'hidden', { activity: 'expanded' })).toBe('expanded')
})