10dd1185b9
The sync generator was failing with a network error because Starlette's iterate_in_threadpool doesn't properly propagate exceptions from sync generators — the connection resets with no body. Fix: convert event_stream to an async generator (Starlette handles these natively without thread wrapping), move imports to the endpoint function scope so failures raise HTTPException before the stream starts, and run CPU-intensive work (parse + write) via loop.run_in_executor so the async generator can actually yield between activities.