Reverse engineered prompt

Build me an unofficial Node and TypeScript library that lets me listen to TikTok LIVE events in real time just by giving it a creator username or live URL. I want it to connect without requiring my own login for the normal case, then expose a simple event based API so I can react to things like chat messages, gifts, likes, follows, shares, people joining, subscriptions, questions, viewer updates, and battle events.

Please make the basic setup really easy, with a small example that connects to a live streamer and logs comments and gifts. It should also have sensible options for things like fetching room info when connecting, including recent initial messages, and optionally using an authenticated session for cases that need it. If possible, let it return useful connection state like the room id and handle offline users cleanly.

Add decent docs and a few tests so it feels ready to use. You can check current TikTok LIVE connector docs online if needed.

Want more depth? Deep Reverse