From 2c911b19117f152af2ab21e6db1dfbcb9994fb8c Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Mon, 6 Jul 2026 13:03:11 -0700 Subject: [PATCH] iOS Live Activity Updates Nucleic-Session: 665980BA-E8A5-4E84-9DF4-1757CF792353 Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/LiveActivityManager.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NucleicRemote/NucleicRemote/LiveActivityManager.swift b/NucleicRemote/NucleicRemote/LiveActivityManager.swift index c0564b6..5d245ab 100644 --- a/NucleicRemote/NucleicRemote/LiveActivityManager.swift +++ b/NucleicRemote/NucleicRemote/LiveActivityManager.swift @@ -29,6 +29,15 @@ final class LiveActivityManager { /// connectivity, pong, diff ticks…), most of which leave the aggregate identical. Burning the /// budget on those is exactly what makes a *real* change land late and the glance read stale. private var lastState: NucleicSessionAttributes.ContentState? + /// When the last update was applied — the clock for the mid-turn churn refresh. A status change + /// (attention-signature shift) updates immediately regardless; a churn-only change (diff totals + /// ticking as the agent edits) only re-applies once `churnRefreshInterval` has elapsed, so a busy + /// turn refreshes the numbers slowly instead of on every transcript delta. A passive timestamp + /// check on the normal path — no timer sits in front of a status update. + private var lastPushAt: Date? + /// How slowly the mid-turn diff totals refresh while nothing else about a session changes — + /// mirrors the host's `SyncHost.churnRefreshInterval` so the local and pushed glances agree. + private static let churnRefreshInterval: TimeInterval = 45 /// The newest state waiting to be applied, and the single task draining it. Coalescing to the /// latest through one serial task means the newest data always wins — firing an unstructured /// `Task` per `sync` let a later update lose a race to an earlier one and freeze the glance.