mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-24 05:41:40 +00:00
fix(tui): merge tools into contextual shelves
This commit is contained in:
parent
4d3e3a738d
commit
4943ea2a7c
2 changed files with 25 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { appendToolShelfMessage, isTodoDone } from './liveProgress.js'
|
||||
import { appendToolShelfMessage, canHoldToolShelf, isTodoDone, mergeToolShelfInto } from './liveProgress.js'
|
||||
|
||||
describe('isTodoDone', () => {
|
||||
it('only treats non-empty all-completed/cancelled lists as done', () => {
|
||||
|
|
@ -16,6 +16,23 @@ describe('isTodoDone', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('tool shelf helpers', () => {
|
||||
it('recognizes contextual thinking shelves as holders', () => {
|
||||
expect(canHoldToolShelf({ kind: 'trail', role: 'system', text: '', thinking: 'plan' })).toBe(true)
|
||||
expect(canHoldToolShelf({ kind: 'trail', role: 'system', text: '', tools: ['one ✓'] })).toBe(true)
|
||||
expect(canHoldToolShelf({ role: 'assistant', text: 'done' })).toBe(false)
|
||||
})
|
||||
|
||||
it('merges source rows into an existing shelf', () => {
|
||||
expect(
|
||||
mergeToolShelfInto(
|
||||
{ kind: 'trail', role: 'system', text: '', thinking: 'plan', tools: ['one ✓'] },
|
||||
{ kind: 'trail', role: 'system', text: '', tools: ['two ✓'] }
|
||||
)
|
||||
).toEqual({ kind: 'trail', role: 'system', text: '', thinking: 'plan', tools: ['one ✓', 'two ✓'] })
|
||||
})
|
||||
})
|
||||
|
||||
describe('appendToolShelfMessage', () => {
|
||||
it('merges adjacent tool shelves into one contextual shelf', () => {
|
||||
const merged = appendToolShelfMessage([{ kind: 'trail', role: 'system', text: '', tools: ['one ✓'] }], {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue