import Foundation import HostRegistry /// T-iOS-15 · Cold-start selection logic, kept pure for unit tests /// (ColdStartPolicyTests): which root screen boots, and whether the session /// list highlights "继续上次" for the active host. enum ColdStartPolicy { enum RootRoute: Equatable { /// Host store not read yet. case loading /// No paired host → pairing is the only next step (plan §7 step 1). case pairing /// At least one paired host → the merged chooser/dashboard list. case sessions } static func initialRoute(pairedHostCount: Int) -> RootRoute { pairedHostCount == 0 ? .pairing : .sessions } /// The "继续上次" target for the list's highlight banner: the last /// server-adopted session persisted for the ACTIVE host (nil = no banner). /// Persistence side: `SessionActivityBridge` (adopted → set, exited → /// cleared), so a returned id was live when last seen. static func continueLastSessionId( activeHost: HostRegistry.Host?, store: any LastSessionStore ) -> UUID? { guard let activeHost else { return nil } return store.lastSessionId(host: activeHost.id) } }