mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-26 01:01:40 +00:00
feat(tui): read display.streaming / show_reasoning / show_cost / inline_diffs from config
Extends ConfigDisplayConfig and UiState so the four new display flags
flow from `config.get {key:"full"}` into the nanostore. applyDisplay is
exported to keep the fan-out testable without an Ink harness.
Defaults mirror v1 parity: streaming + inline_diffs default true
(opt-out via `=== false`), show_cost + show_reasoning default false
(opt-in via plain truthy check).
This commit is contained in:
parent
586b2f2089
commit
200c17433c
5 changed files with 85 additions and 2 deletions
67
ui-tui/src/__tests__/useConfigSync.test.ts
Normal file
67
ui-tui/src/__tests__/useConfigSync.test.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import { $uiState, resetUiState } from '../app/uiStore.js'
|
||||
import { applyDisplay } from '../app/useConfigSync.js'
|
||||
|
||||
describe('applyDisplay', () => {
|
||||
beforeEach(() => {
|
||||
resetUiState()
|
||||
})
|
||||
|
||||
it('fans every display flag out to $uiState and the bell callback', () => {
|
||||
const setBell = vi.fn()
|
||||
|
||||
applyDisplay(
|
||||
{
|
||||
config: {
|
||||
display: {
|
||||
bell_on_complete: true,
|
||||
details_mode: 'expanded',
|
||||
inline_diffs: false,
|
||||
show_cost: true,
|
||||
show_reasoning: true,
|
||||
streaming: false,
|
||||
tui_compact: true,
|
||||
tui_statusbar: false
|
||||
}
|
||||
}
|
||||
},
|
||||
setBell
|
||||
)
|
||||
|
||||
const s = $uiState.get()
|
||||
expect(setBell).toHaveBeenCalledWith(true)
|
||||
expect(s.compact).toBe(true)
|
||||
expect(s.detailsMode).toBe('expanded')
|
||||
expect(s.inlineDiffs).toBe(false)
|
||||
expect(s.showCost).toBe(true)
|
||||
expect(s.showReasoning).toBe(true)
|
||||
expect(s.statusBar).toBe(false)
|
||||
expect(s.streaming).toBe(false)
|
||||
})
|
||||
|
||||
it('applies v1 parity defaults when display fields are missing', () => {
|
||||
const setBell = vi.fn()
|
||||
|
||||
applyDisplay({ config: { display: {} } }, setBell)
|
||||
|
||||
const s = $uiState.get()
|
||||
expect(setBell).toHaveBeenCalledWith(false)
|
||||
expect(s.inlineDiffs).toBe(true)
|
||||
expect(s.showCost).toBe(false)
|
||||
expect(s.showReasoning).toBe(false)
|
||||
expect(s.statusBar).toBe(true)
|
||||
expect(s.streaming).toBe(true)
|
||||
})
|
||||
|
||||
it('treats a null config like an empty display block', () => {
|
||||
const setBell = vi.fn()
|
||||
|
||||
applyDisplay(null, setBell)
|
||||
|
||||
const s = $uiState.get()
|
||||
expect(setBell).toHaveBeenCalledWith(false)
|
||||
expect(s.inlineDiffs).toBe(true)
|
||||
expect(s.streaming).toBe(true)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue