Share the RoomService transport and add DeleteRoom

Merged
DG
21h ago
+345-77

Peer room cleanup has to talk to LiveKit without loading an agent config. This PR moves the Twirp POST and the room-admin request helper into src/livekit/room_service.rs, taking a URL, API key and API secret instead of AgentConfig. The agent's duplicate-participant handling stays in rooms.rs and calls the moved transport.

DeleteRoom is gated on roomCreate, so a new livekit_room_create_token grants only that. delete_room treats a Twirp not_found as success, because LiveKit already drops empty rooms and cleanup runs after the fact.

P4.

Closes #320
Refs #306


Summary by cubic

Shares the LiveKit RoomService transport between the agent and the web server so peer cleanup can delete rooms without loading an agent config, and adds delete_room under a new roomCreate-only token.

Refactors

  • Moved the Twirp POST and room-admin request helper into src/livekit/room_service.rs, taking a URL, API key, and API secret instead of AgentConfig.
  • delete_room treats a Twirp not_found (status and body code both) as success, since LiveKit drops empty rooms on its own and cleanup runs after the fact; a 2xx that is not JSON is still an error, for the case where a proxy answers 200 with HTML.

Closes #320, refs #306.