Fetch Historical Transcript Data

Nucleic-Session: 11465D90-A8F3-43AA-A1DC-37EA1EC1B909
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-05 19:27:45 -07:00
co-authored by Nucleic
parent 10e4e27a1a
commit 2cc7eeb2b1
@@ -630,6 +630,21 @@ final class HostConnection {
Task { await client.send(msg) } Task { await client.send(msg) }
} }
/// Pull the open session's *full* transcript via mesh full-transcript sync and merge it into the
/// transcript on screen. The cold `subscribe` only returns the host's 200-event tail, so without
/// this the phone shows nothing from before it connected. `afterSeq: 0` asks for the whole history
/// (overlap with the tail is deduped on arrival). Idempotent per open — guarded by
/// `didStartFullFetch` — and a no-op when the host predates `canSyncTranscripts` (the tail still
/// shows) or the connection isn't live yet (the reconnect handler retries once it is).
func fetchFullTranscript(_ sessionID: SessionID) {
guard sessionID == openSessionID, !didStartFullFetch,
capabilities.canSyncTranscripts, client != nil else { return }
didStartFullFetch = true
let requestID = UUID().uuidString
transcriptFetchRequestID = requestID
send(.fetchTranscript(TranscriptFetch(requestID: requestID, sessionID: sessionID, afterSeq: 0)))
}
/// The device's network path changed (Wi-Fi ⇄ cellular, joined/left a network). React now rather /// The device's network path changed (Wi-Fi ⇄ cellular, joined/left a network). React now rather
/// than waiting for a zombie LAN socket to time out or the reconnect backoff to elapse — this is /// than waiting for a zombie LAN socket to time out or the reconnect backoff to elapse — this is
/// what makes the transport switch feel immediate. Only reconnect-managed hosts (a pinned host) /// what makes the transport switch feel immediate. Only reconnect-managed hosts (a pinned host)