diff --git a/NucleicRemote/NucleicRemote/Views/Theme.swift b/NucleicRemote/NucleicRemote/Views/Theme.swift index 9da8d5b..1417988 100644 --- a/NucleicRemote/NucleicRemote/Views/Theme.swift +++ b/NucleicRemote/NucleicRemote/Views/Theme.swift @@ -281,6 +281,14 @@ enum StatusStyle { case .finished, .interrupted, .error: return 5 } } + + /// The shared session-list sort: attention-first by `sortRank`, then, within a rank, by + /// last-turn recency (`lastTurnAt`) rather than raw activity — so rows hold their place + /// instead of reshuffling every few seconds as the agent works. Mirrors the Mac sidebar. + static func attentionThenRecency(_ lhs: WireSessionSummary, _ rhs: WireSessionSummary) -> Bool { + let l = sortRank(lhs), r = sortRank(rhs) + return l == r ? lhs.lastTurnAt > rhs.lastTurnAt : l < r + } } extension SessionStatus {