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')
})

View file

@ -4,12 +4,27 @@ const MODES = ['hidden', 'collapsed', 'expanded'] as const
export const SECTION_NAMES = ['thinking', 'tools', 'subagents', 'activity'] as const
// Activity panel = ambient meta (gateway hints, terminal-parity nudges,
// background-process notifications). Hidden out of the box because tool
// failures already render inline on the failing tool row — the panel itself
// is noise for typical use. Opt back in via `display.sections.activity` or
// `/details activity collapsed`.
const SECTION_DEFAULTS: SectionVisibility = { activity: 'hidden' }
// Out-of-the-box per-section defaults — applied when the user hasn't pinned
// an explicit override and layered ABOVE the global details_mode:
//
// - thinking / tools: expanded — stream open so the turn reads like a
// live transcript (reasoning + tool calls side by side) instead of a
// wall of chevrons the user has to click every turn.
// - activity: hidden — ambient meta (gateway hints, terminal-parity
// nudges, background notifications) is noise for typical use. Tool
// failures still render inline on the failing tool row, and ambient
// errors/warnings surface via the floating-alert backstop when every
// panel resolves to hidden.
// - subagents: not set — falls through to the global details_mode so
// Spawn trees stay under a chevron until a delegation actually happens.
//
// Opt out of any of these with `display.sections.<name>` in config.yaml
// or at runtime via `/details <name> collapsed|hidden`.
const SECTION_DEFAULTS: SectionVisibility = {
thinking: 'expanded',
tools: 'expanded',
activity: 'hidden'
}
const THINKING_FALLBACK: Record<string, DetailsMode> = {
collapsed: 'collapsed',

View file

@ -132,24 +132,29 @@ Runtime toggles:
**Default visibility**
- `thinking`, `tools`, `subagents` — fall through to the global `details_mode`
(collapsed under chevron by default, click to expand).
- `activity`**hidden by default**. The activity panel surfaces ambient
meta (gateway hints, terminal-parity nudges, background notifications) and
is noise for most day-to-day use. Tool failures still render inline on the
failing tool row, so this default suppresses the noise feed without losing
the signal.
The TUI ships with opinionated per-section defaults that stream the turn as
a live transcript instead of a wall of chevrons:
- `thinking`**expanded**. Reasoning streams inline as the model emits it.
- `tools`**expanded**. Tool calls and their results render open.
- `subagents` — falls through to the global `details_mode` (collapsed under
chevron by default — stays quiet until a delegation actually happens).
- `activity`**hidden**. Ambient meta (gateway hints, terminal-parity
nudges, background notifications) is noise for most day-to-day use. Tool
failures still render inline on the failing tool row; ambient
errors/warnings surface via a floating-alert backstop when every panel
is hidden.
Per-section overrides take precedence over both the section default and the
global `details_mode`. To opt the activity panel back in:
global `details_mode`. To reshape the layout:
- `display.sections.activity: collapsed` — under a chevron
- `display.sections.activity: expanded` — always open
- `/details activity collapsed` at runtime
- `display.sections.thinking: collapsed` — put thinking back under a chevron
- `display.sections.tools: collapsed` — put tool calls back under a chevron
- `display.sections.activity: collapsed` — opt the activity panel back in
- `/details <section> <mode>` at runtime
With `activity: hidden` (the default), errors/warnings are suppressed entirely
— the floating-alert fallback that surfaces under `details_mode: hidden` is
silenced as well.
Anything set explicitly in `display.sections` wins over the defaults, so
existing configs keep working unchanged.
## Sessions