feat(coding): complete PI conversation UI

This commit is contained in:
2026-08-24 08:59:16 +08:00
parent 2613d6530b
commit 863f005203
21 changed files with 2040 additions and 137 deletions

View File

@@ -121,4 +121,39 @@ describe('coding workspace store', () => {
expect(store.getState().conversations).toEqual([created]);
expect(store.getState().creatingAgentIds).toEqual({});
});
it('keeps title, archive, and unread metadata scoped to the patched Conversation', async () => {
const first = conversation('conversation-a', 'agent-a');
const second = conversation('conversation-b', 'agent-a');
const patchConversation = vi.fn(async (_id: string, patch: { title?: string; archived?: boolean; unread?: boolean }) => ({
...first,
...(patch.title ? { title: patch.title } : {}),
...(patch.archived ? { archivedAt: '2026-08-24T01:00:00.000Z' } : {}),
...(patch.unread !== undefined ? { unread: patch.unread } : {}),
}));
const store = createCodingWorkspaceStore({
listProjects: vi.fn(async () => ({ projects: [project], activeProjectId: project.id })),
getConfig: vi.fn(async () => ({ project, config: config([agent('agent-a')]) })),
listConversations: vi.fn(async () => [first, second]),
createConversation: vi.fn(),
patchConversation,
});
await store.getState().load();
await store.getState().patchConversation(first.id, {
title: 'Feature UI',
archived: true,
unread: true,
});
expect(patchConversation).toHaveBeenCalledWith(first.id, {
title: 'Feature UI',
archived: true,
unread: true,
});
expect(store.getState().conversations).toEqual([
expect.objectContaining({ id: first.id, title: 'Feature UI', unread: true, archivedAt: expect.any(String) }),
second,
]);
});
});