feat: add agent todo tool and inline todo snapshot cards in chat

This commit is contained in:
Xiaohan-Tian
2026-06-02 21:52:44 -07:00
parent c1d9f4c9fb
commit 5aacf01457
24 changed files with 995 additions and 28 deletions
+24 -2
View File
@@ -15,7 +15,11 @@ const {
setLLMProvider: vi.fn(),
getLLMProvider: vi.fn(() => ({ getPreferredSystemPromptPath: vi.fn() })),
abortCurrentRequest: vi.fn(),
getAgentState: vi.fn(() => ({ getMessages: vi.fn(() => []) })),
getAgentState: vi.fn(() => ({
getMessages: vi.fn(() => []),
getTodos: vi.fn(() => []),
subscribeTodoChanges: vi.fn(() => () => undefined),
})),
compactConversation: vi.fn(async () => ({ changed: true, compactedConversation: 'summary' })),
shouldCompactBeforeNextTurn: vi.fn(async () => false),
},
@@ -25,7 +29,17 @@ const {
vi.mock('./chat', () => ({
UserMessage: ({ content }: { content: string }) => <div>{content}</div>,
AssistantMessage: ({ content }: { content: string }) => <div>{content}</div>,
AssistantMessage: ({
content,
todoSnapshot,
}: {
content: string;
todoSnapshot?: Array<{ text: string }>;
}) => (
<div>
{todoSnapshot ? `TODO SNAPSHOT: ${todoSnapshot.map(todo => todo.text).join(', ')}` : content}
</div>
),
}));
vi.mock('../agent/core/AgentCore', () => ({
@@ -205,4 +219,12 @@ describe('ChatBox', () => {
expect(screen.getByText('Conversation Compacted')).toBeTruthy();
});
});
it('does not render a pinned todo checklist from agent state', async () => {
renderWithLocale('en_us');
await waitFor(() => {
expect(screen.queryByText('Task Checklist')).toBeNull();
});
});
});