mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
feat(tui): archive todos at turn end with incomplete hint
This commit is contained in:
parent
319c1c1691
commit
c78b528125
12 changed files with 948 additions and 70 deletions
|
|
@ -59,7 +59,7 @@ describe('createGatewayEventHandler', () => {
|
|||
patchUiState({ showReasoning: true })
|
||||
})
|
||||
|
||||
it('keeps todo list visible after final assistant text completes', () => {
|
||||
it('archives incomplete todos into transcript flow at end of turn so they scroll up', () => {
|
||||
const appended: Msg[] = []
|
||||
|
||||
const todos = [
|
||||
|
|
@ -76,8 +76,12 @@ describe('createGatewayEventHandler', () => {
|
|||
|
||||
onEvent({ payload: { text: 'Started a todo list.' }, type: 'message.complete' } as any)
|
||||
|
||||
expect(appended[appended.length - 1]).toMatchObject({ role: 'assistant', text: 'Started a todo list.' })
|
||||
expect(getTurnState().todos).toEqual(todos)
|
||||
const trail = appended.find(msg => msg.kind === 'trail' && msg.todos?.length)
|
||||
const finalText = appended.find(msg => msg.role === 'assistant' && msg.text === 'Started a todo list.')
|
||||
|
||||
expect(finalText).toBeDefined()
|
||||
expect(trail).toMatchObject({ kind: 'trail', role: 'system', todos, todoIncomplete: true })
|
||||
expect(getTurnState().todos).toEqual([])
|
||||
})
|
||||
|
||||
it('archives completed todos into transcript flow at end of turn', () => {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { beforeEach, describe, expect, it } from 'vitest'
|
|||
import {
|
||||
appendTurnSegment,
|
||||
archiveDoneTodos,
|
||||
archiveTodosAtTurnEnd,
|
||||
getTurnState,
|
||||
patchTurnState,
|
||||
resetTurnState,
|
||||
|
|
@ -20,7 +21,7 @@ describe('turnStore live progress helpers', () => {
|
|||
]
|
||||
})
|
||||
|
||||
expect(archiveDoneTodos()).toEqual([
|
||||
expect(archiveTodosAtTurnEnd()).toEqual([
|
||||
{
|
||||
kind: 'trail',
|
||||
role: 'system',
|
||||
|
|
@ -34,11 +35,25 @@ describe('turnStore live progress helpers', () => {
|
|||
expect(getTurnState().todos).toEqual([])
|
||||
})
|
||||
|
||||
it('does not archive active todos', () => {
|
||||
patchTurnState({ todos: [{ content: 'cook', id: 'cook', status: 'in_progress' }] })
|
||||
it('archives incomplete todos with an incomplete flag so the hint renders', () => {
|
||||
patchTurnState({
|
||||
todos: [
|
||||
{ content: 'cook', id: 'cook', status: 'completed' },
|
||||
{ content: 'serve', id: 'serve', status: 'in_progress' },
|
||||
{ content: 'eat', id: 'eat', status: 'pending' }
|
||||
]
|
||||
})
|
||||
|
||||
const archived = archiveTodosAtTurnEnd()
|
||||
expect(archived).toHaveLength(1)
|
||||
expect(archived[0]!.todoIncomplete).toBe(true)
|
||||
expect(archived[0]!.todos?.map(t => t.id)).toEqual(['cook', 'serve', 'eat'])
|
||||
expect(getTurnState().todos).toEqual([])
|
||||
})
|
||||
|
||||
it('returns nothing when there are no todos at turn end', () => {
|
||||
expect(archiveTodosAtTurnEnd()).toEqual([])
|
||||
expect(archiveDoneTodos()).toEqual([])
|
||||
expect(getTurnState().todos).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('tracks collapsed state independently of todo content', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue