Session Order Adjustment

Nucleic-Session: 19C20841-87D4-45F9-A5AD-EBB92B735F82
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-05 04:13:33 -07:00
co-authored by Nucleic
parent 2f18f5968b
commit 359f4ab452
@@ -281,6 +281,14 @@ enum StatusStyle {
case .finished, .interrupted, .error: return 5 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 { extension SessionStatus {