From 359f4ab45260fe2fec7fe025c65c506dec66c35f Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sun, 5 Jul 2026 04:13:33 -0700 Subject: [PATCH] Session Order Adjustment Nucleic-Session: 19C20841-87D4-45F9-A5AD-EBB92B735F82 Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/Views/Theme.swift | 8 ++++++++ 1 file changed, 8 insertions(+) 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 {