/** * useConnection (API §3) — transport status + memory journal position + retry. * Reads the provider-owned connection store for the subtree's Shell via * `useSyncExternalStore` (rule 3). Throws outside a ``. */ import { useSyncExternalStore } from 'react' import type { ConnectionValue } from './connection.store.js' import { useShell } from '../shell.hook.js' import { connectionStore } from './connection.store.js' export function useConnection(): ConnectionValue { const store = connectionStore(useShell()) return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot) }