iOS Live Activity Updates

Nucleic-Session: 665980BA-E8A5-4E84-9DF4-1757CF792353
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-06 13:03:11 -07:00
co-authored by Nucleic
parent 0d1dbdfa32
commit 2c911b1911
@@ -29,6 +29,15 @@ final class LiveActivityManager {
/// connectivity, pong, diff ticks…), most of which leave the aggregate identical. Burning the /// 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. /// budget on those is exactly what makes a *real* change land late and the glance read stale.
private var lastState: NucleicSessionAttributes.ContentState? 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 /// 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 /// 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. /// `Task` per `sync` let a later update lose a race to an earlier one and freeze the glance.