From 292fd8e7a8475efcdd81c18372d3f61162b0f70a Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sun, 5 Jul 2026 22:30:54 -0700 Subject: [PATCH] Session Cache Implementation Nucleic-Session: B2346642-3353-4BD5-9DE2-A8B77BD66C98 Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/Models/RemoteStore.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index 8a276b7..d141863 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -44,6 +44,13 @@ final class RemoteStore: ObservableObject { /// from `hostName(forSession:)` instead. @Published private(set) var hostName: String = "" @Published private(set) var sessions: [WireSessionSummary] = [] + /// The last session list seen from a live host, persisted to disk (`SessionCache`) and reloaded + /// at launch. It backs `sessions` whenever nothing is connected, so the list shows a read-only + /// history while offline instead of an empty "waiting to connect" screen. + private var cachedSummaries: [WireSessionSummary] = SessionCache.loadSummaries() + /// Debounced disk-write tasks for the offline cache (coalesce a burst of updates into one write). + private var summaryPersistTask: Task? + private var transcriptPersistTask: Task? @Published private(set) var capabilities = WireCapabilities(canModifyToolInput: false, allowAlwaysScopes: []) @Published private(set) var grantedScope: DeviceScope = .approve /// The host's model/effort catalog (SYNC ยง5.2), driving the composer + session-header pickers.