( persistedRunning: boolean | number, liveThread: Pick<ThreadData, 'isStreaming' | 'isCompacting'> | null, )
| 1 | import type { InboxThread, ThreadData } from './desktop-contracts' |
| 2 | |
| 3 | export function getEffectiveThreadRunningState( |
| 4 | persistedRunning: boolean | number, |
| 5 | liveThread: Pick<ThreadData, 'isStreaming' | 'isCompacting'> | null, |
| 6 | ) { |
| 7 | if (liveThread) { |
| 8 | return liveThread.isStreaming || liveThread.isCompacting |
| 9 | } |
| 10 | |
| 11 | return Boolean(persistedRunning) |
| 12 | } |
| 13 | |
| 14 | export function sortInboxThreadsByPriority(threads: InboxThread[]) { |
| 15 | return [...threads].sort((left, right) => { |
no outgoing calls
no test coverage detected