feat(sessions): use 1-line generated session summary to describe sessions (#14467)

This commit is contained in:
Jack Wotherspoon
2025-12-05 12:20:15 -05:00
committed by GitHub
parent 8341256d1e
commit 616d6f6667
10 changed files with 1639 additions and 4 deletions

View File

@@ -290,6 +290,40 @@ describe('listSessions', () => {
expect.stringContaining(', current)'),
);
});
it('should display summary as title when available instead of first user message', async () => {
// Arrange
const now = new Date('2025-01-20T12:00:00.000Z');
const mockSessions: SessionInfo[] = [
{
id: 'session-with-summary',
file: 'session-file',
fileName: 'session-file.json',
startTime: now.toISOString(),
lastUpdated: now.toISOString(),
messageCount: 10,
displayName: 'Add dark mode to the app', // Summary
firstUserMessage:
'How do I add dark mode to my React application with CSS variables?',
isCurrentSession: false,
index: 1,
summary: 'Add dark mode to the app',
},
];
mockListSessions.mockResolvedValue(mockSessions);
// Act
await listSessions(mockConfig);
// Assert: Should show the summary (displayName), not the first user message
expect(consoleLogSpy).toHaveBeenCalledWith(
expect.stringContaining('1. Add dark mode to the app'),
);
expect(consoleLogSpy).not.toHaveBeenCalledWith(
expect.stringContaining('How do I add dark mode to my React application'),
);
});
});
describe('deleteSession', () => {