screenStateStream

fun <T> screenStateStream(storeData: Flow<StoreData<T>>, connectivity: Flow<Connectivity>, ttl: Duration, now: () -> Instant = { Clock.System.now() }, classify: (Throwable) -> ErrorKind = { ErrorKind.Other }): Flow<ScreenState<T>>

The reactive read path: turns a data Flow + a connectivity Flow into a Flow<ScreenState<T>> by running DecisionEngine.decide on each emission. This is the live form of the pure decision core — a ViewModel collects this and exposes it as UI state.

Deliberately Store-library-agnostic: the caller supplies both flows (their repository's cache+network merge, and a connectivity source such as :network's ConnectivityChecker). FetchPolicy shapes what the caller feeds into storeData upstream (cache-only, network-only, periodic) — this combinator maps whatever arrives, so it stays policy-agnostic and pure of side effects.

Parameters

now

injectable clock (defaults to the system clock) so freshness/decisions are testable.