/** Mobile routing is explicit and cannot start a first-run installer. */ export function createMobileBackendResolver({ isRemote, runtimeNeedsInstall, ensureBackend }: { isRemote: (profile: string) => boolean runtimeNeedsInstall: (profile: string) => boolean ensureBackend: (profile: string) => Promise }) { return async (profile: string) => { if (isRemote(profile)) throw new Error('aiturk-mobile:remote_mode') if (runtimeNeedsInstall(profile)) throw new Error('aiturk-mobile:runtime_not_ready') const connection = await ensureBackend(profile) if (connection.mode !== 'local' || isRemote(profile)) throw new Error('aiturk-mobile:remote_mode') return { baseUrl: connection.baseUrl, token: connection.token } } }