-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(cli): add optional [HH:MM:SS] timestamp before each assistant turn #5001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,6 +57,7 @@ import { MemorySavedMessage } from './messages/MemorySavedMessage.js'; | |||||||||||||||
| import { DiffStatsDisplay } from './messages/DiffStatsDisplay.js'; | ||||||||||||||||
| import { GoalStatusMessage } from './messages/GoalStatusMessage.js'; | ||||||||||||||||
| import { useCompactMode } from '../contexts/CompactModeContext.js'; | ||||||||||||||||
| import { useSettings } from '../contexts/SettingsContext.js'; | ||||||||||||||||
|
|
||||||||||||||||
| interface HistoryItemDisplayProps { | ||||||||||||||||
| item: HistoryItem; | ||||||||||||||||
|
|
@@ -137,6 +138,9 @@ const HistoryItemDisplayComponent: React.FC<HistoryItemDisplayProps> = ({ | |||||||||||||||
| const marginTop = getHistoryItemMarginTop(item); | ||||||||||||||||
|
|
||||||||||||||||
| const { compactMode } = useCompactMode(); | ||||||||||||||||
| const settings = useSettings(); | ||||||||||||||||
| const showTimestamps = settings.merged.output?.showTimestamps === true; | ||||||||||||||||
|
|
||||||||||||||||
| const itemForDisplay = useMemo(() => escapeAnsiCtrlCodes(item), [item]); | ||||||||||||||||
| const contentWidth = terminalWidth - 4; | ||||||||||||||||
| const boxWidth = mainAreaWidth || contentWidth; | ||||||||||||||||
|
|
@@ -160,15 +164,26 @@ const HistoryItemDisplayComponent: React.FC<HistoryItemDisplayProps> = ({ | |||||||||||||||
| <UserShellMessage text={itemForDisplay.text} /> | ||||||||||||||||
| )} | ||||||||||||||||
| {itemForDisplay.type === 'gemini' && ( | ||||||||||||||||
| <AssistantMessage | ||||||||||||||||
| text={itemForDisplay.text} | ||||||||||||||||
| isPending={isPending} | ||||||||||||||||
| availableTerminalHeight={ | ||||||||||||||||
| availableTerminalHeightGemini ?? availableTerminalHeight | ||||||||||||||||
| } | ||||||||||||||||
| contentWidth={contentWidth} | ||||||||||||||||
| sourceCopyIndexOffsets={sourceCopyIndexOffsets} | ||||||||||||||||
| /> | ||||||||||||||||
| <> | ||||||||||||||||
| {showTimestamps && itemForDisplay.timestamp != null && ( | ||||||||||||||||
|
yiliang114 marked this conversation as resolved.
|
||||||||||||||||
| <Text dimColor> | ||||||||||||||||
| [ | ||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The codebase already has the correct pattern at
Suggested change
— qwen3.7-max via Qwen Code /review |
||||||||||||||||
| {new Date(itemForDisplay.timestamp).toLocaleTimeString('en-US', { | ||||||||||||||||
| hour12: false, | ||||||||||||||||
| })} | ||||||||||||||||
| ] | ||||||||||||||||
| </Text> | ||||||||||||||||
| )} | ||||||||||||||||
| <AssistantMessage | ||||||||||||||||
| text={itemForDisplay.text} | ||||||||||||||||
| isPending={isPending} | ||||||||||||||||
| availableTerminalHeight={ | ||||||||||||||||
| availableTerminalHeightGemini ?? availableTerminalHeight | ||||||||||||||||
| } | ||||||||||||||||
| contentWidth={contentWidth} | ||||||||||||||||
| sourceCopyIndexOffsets={sourceCopyIndexOffsets} | ||||||||||||||||
| /> | ||||||||||||||||
| </> | ||||||||||||||||
| )} | ||||||||||||||||
| {itemForDisplay.type === 'gemini_content' && ( | ||||||||||||||||
| <AssistantMessageContent | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3759,10 +3759,10 @@ describe('useGeminiStream', () => { | |
| }); | ||
|
|
||
| expect(mockAddItem).toHaveBeenCalledWith( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The only test changes for Consider adding dedicated tests that drive the stream through a gemini text event and assert — qwen3.7-max via Qwen Code /review |
||
| { | ||
| expect.objectContaining({ | ||
| type: 'gemini', | ||
| text: 'Initial', | ||
| }, | ||
| }), | ||
| expect.any(Number), | ||
| ); | ||
|
|
||
|
|
@@ -6695,10 +6695,10 @@ describe('useGeminiStream', () => { | |
| }); | ||
|
|
||
| expect(mockAddItem).toHaveBeenCalledWith( | ||
| { | ||
| expect.objectContaining({ | ||
| type: 'gemini', | ||
| text: 'First call content', | ||
| }, | ||
| }), | ||
| expect.any(Number), | ||
| ); | ||
| expect(mainAbortSignal?.aborted).toBe(true); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The test fixture hardcodes
timestamp: new Date('2026-01-15T14:30:45').getTime()but the regex\[\d{2}:\d{2}:\d{2}\]only asserts format, not value. A bug rendering the wrong time (e.g.,Date.now()instead ofitem.timestamp) would pass undetected.Pin the assertion to the expected value:
— qwen3.7-max via Qwen Code /review