Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions desktop/src/__tests__/pages.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -322,11 +320,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -369,11 +365,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -435,11 +429,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
sendMessage,
Expand Down Expand Up @@ -504,11 +496,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
sendMessage,
Expand Down Expand Up @@ -559,11 +549,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
sendMessage,
Expand Down Expand Up @@ -614,7 +602,6 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [
{ name: 'cost', description: 'Show token usage and costs' },
Expand All @@ -624,7 +611,6 @@ describe('Content-only pages render without errors', () => {
})),
],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
sendMessage,
Expand Down Expand Up @@ -677,11 +663,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
sendMessage,
Expand Down Expand Up @@ -761,11 +745,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 50_000, output_tokens: 1_000 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -816,11 +798,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -879,11 +859,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -958,11 +936,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -1040,11 +1016,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 72_000, output_tokens: 2_000 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -1105,11 +1079,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -1201,11 +1173,9 @@ describe('Content-only pages render without errors', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 26_000, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down
2 changes: 0 additions & 2 deletions desktop/src/components/chat/AskUserQuestion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ describe('AskUserQuestion', () => {
},
},
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down
16 changes: 0 additions & 16 deletions desktop/src/components/chat/ChatInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -235,11 +233,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
[historySessionId]: {
messages: [{ id: 'history-message', type: 'assistant_text', content: 'ready', timestamp: 1 }],
Expand All @@ -252,11 +248,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -342,11 +336,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -396,11 +388,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -440,11 +430,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down Expand Up @@ -484,11 +472,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
permissionMode: 'plan',
},
},
Expand Down Expand Up @@ -551,11 +537,9 @@ describe('ChatInput file mentions', () => {
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
},
},
})
Expand Down
27 changes: 27 additions & 0 deletions desktop/src/components/chat/ElapsedTime.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useEffect, useState } from 'react'

function formatElapsed(seconds: number): string {
if (seconds < 60) return `${seconds}s`
const m = Math.floor(seconds / 60)
const s = seconds % 60
return `${m}m ${s}s`
}

export function ElapsedTime({ startedAt }: { startedAt: number }) {
const [now, setNow] = useState(() => Date.now())

useEffect(() => {
setNow(Date.now())
const timer = window.setInterval(() => setNow(Date.now()), 1000)
return () => window.clearInterval(timer)
}, [startedAt])

const elapsedSeconds = Math.max(0, Math.floor((now - startedAt) / 1000))
if (elapsedSeconds === 0) return null

return (
<span className="text-[10px] text-[var(--color-text-tertiary)]">
{formatElapsed(elapsedSeconds)}
</span>
)
}
2 changes: 0 additions & 2 deletions desktop/src/components/chat/MessageList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ function makeSessionState(overrides: Partial<PerSessionState> = {}): PerSessionS
activeThinkingId: null,
pendingPermission: null,
tokenUsage: { input_tokens: 0, output_tokens: 0 },
elapsedSeconds: 0,
statusVerb: '',
apiRetry: null,
slashCommands: [],
agentTaskNotifications: {},
elapsedTimer: null,
composerPrefill: null,
...overrides,
}
Expand Down
Loading
Loading