diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index e05c020..cfe8834 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -1242,6 +1242,13 @@ extension DashboardSnapshot { } extension WireSessionSummary { + /// Recency key for ordering session lists: the last *user* message, falling back to `updatedAt` + /// for sessions with no user message yet (or summaries from a host that predates the field). + /// Ordering on this keeps a chat's position steady until the user speaks again, rather than + /// reshuffling the list on every bit of agent activity (which bumps `updatedAt` every few + /// seconds). Mirrors the Mac sidebar's last-turn ordering. + var lastTurnAt: Date { lastUserMessageAt ?? updatedAt } + /// A copy with selected fields overridden — the demo simulator's only way to "mutate" a /// summary, whose stored properties are all `let`. Nullable fields use a double optional so a /// caller can distinguish "keep" (omit) from "set to nil" (`.some(nil)`). `updatedAt` bumps