Session Cache Implementation

Nucleic-Session: B2346642-3353-4BD5-9DE2-A8B77BD66C98
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-05 22:31:34 -07:00
co-authored by Nucleic
parent 3d86f11c67
commit e2058a2f3c
@@ -521,16 +521,19 @@ final class RemoteStore: ObservableObject {
// instead of truncating it to the host's 200-event tail.
self.openEvents = Self.mergedEvents(self.openEvents, snap.recentEvents)
self.openApprovals = snap.pendingApprovals
self.persistOpenTranscript()
}
cb.openEvents = { [weak self] batch in
guard let self, hostID == self.openSessionHostID, batch.sessionID == self.openSessionID else { return }
self.openEvents.append(contentsOf: batch.events)
self.persistOpenTranscript()
}
cb.openBackfill = { [weak self] batch in
guard let self, hostID == self.openSessionHostID, batch.sessionID == self.openSessionID else { return }
// Full-history backfill precedes what's on screen — merge by seq so it slots in above the
// tail rather than appending out of order.
self.openEvents = Self.mergedEvents(self.openEvents, batch.events)
self.persistOpenTranscript()
}
cb.openDiff = { [weak self] diff in
guard let self, hostID == self.openSessionHostID, diff.sessionID == self.openSessionID else { return }