Rename livekit_server to livekit_api (#24984)

The name `livekit_server` was a bit misleading as it is not a server and
gets built into both the client and server - the server code is in
`collab`.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-02-16 13:24:12 -07:00 committed by GitHub
parent 2400fb4d9e
commit c7df2d787b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 61 additions and 62 deletions

36
Cargo.lock generated
View file

@ -2792,9 +2792,9 @@ dependencies = [
"jsonwebtoken",
"language",
"language_model",
"livekit_api",
"livekit_client",
"livekit_client_macos",
"livekit_server",
"log",
"lsp",
"menu",
@ -7404,6 +7404,21 @@ dependencies = [
"futures 0.3.31",
]
[[package]]
name = "livekit_api"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"jsonwebtoken",
"log",
"prost 0.9.0",
"prost-build 0.9.0",
"prost-types 0.9.0",
"reqwest 0.12.8",
"serde",
]
[[package]]
name = "livekit_client"
version = "0.1.0"
@ -7420,7 +7435,7 @@ dependencies = [
"http_client",
"image",
"livekit",
"livekit_server",
"livekit_api",
"log",
"media",
"nanoid",
@ -7445,7 +7460,7 @@ dependencies = [
"core-foundation 0.9.4",
"futures 0.3.31",
"gpui",
"livekit_server",
"livekit_api",
"log",
"media",
"nanoid",
@ -7457,21 +7472,6 @@ dependencies = [
"simplelog",
]
[[package]]
name = "livekit_server"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"jsonwebtoken",
"log",
"prost 0.9.0",
"prost-build 0.9.0",
"prost-types 0.9.0",
"reqwest 0.12.8",
"serde",
]
[[package]]
name = "lmdb-master-sys"
version = "0.2.4"

View file

@ -74,9 +74,9 @@ members = [
"crates/language_selector",
"crates/language_tools",
"crates/languages",
"crates/livekit_api",
"crates/livekit_client",
"crates/livekit_client_macos",
"crates/livekit_server",
"crates/lmstudio",
"crates/lsp",
"crates/markdown",
@ -274,9 +274,9 @@ language_models = { path = "crates/language_models" }
language_selector = { path = "crates/language_selector" }
language_tools = { path = "crates/language_tools" }
languages = { path = "crates/languages" }
livekit_api = { path = "crates/livekit_api" }
livekit_client = { path = "crates/livekit_client" }
livekit_client_macos = { path = "crates/livekit_client_macos" }
livekit_server = { path = "crates/livekit_server" }
lmstudio = { path = "crates/lmstudio" }
lsp = { path = "crates/lsp" }
markdown = { path = "crates/markdown" }

View file

@ -40,7 +40,7 @@ google_ai.workspace = true
hex.workspace = true
http_client.workspace = true
jsonwebtoken.workspace = true
livekit_server.workspace = true
livekit_api.workspace = true
log.workspace = true
nanoid.workspace = true
open_ai.workspace = true

View file

@ -274,7 +274,7 @@ impl ServiceMode {
pub struct AppState {
pub db: Arc<Database>,
pub llm_db: Option<Arc<LlmDatabase>>,
pub livekit_client: Option<Arc<dyn livekit_server::api::Client>>,
pub livekit_client: Option<Arc<dyn livekit_api::Client>>,
pub blob_store_client: Option<aws_sdk_s3::Client>,
pub stripe_client: Option<Arc<stripe::Client>>,
pub stripe_billing: Option<Arc<StripeBilling>>,
@ -311,11 +311,11 @@ impl AppState {
.zip(config.livekit_key.as_ref())
.zip(config.livekit_secret.as_ref())
{
Some(Arc::new(livekit_server::api::LiveKitClient::new(
Some(Arc::new(livekit_api::LiveKitClient::new(
server.clone(),
key.clone(),
secret.clone(),
)) as Arc<dyn livekit_server::api::Client>)
)) as Arc<dyn livekit_api::Client>)
} else {
None
};

View file

@ -1545,7 +1545,7 @@ async fn set_room_participant_role(
.update_participant(
livekit_room.clone(),
request.user_id.to_string(),
livekit_server::proto::ParticipantPermission {
livekit_api::proto::ParticipantPermission {
can_subscribe: true,
can_publish,
can_publish_data: can_publish,

View file

@ -1,5 +1,5 @@
[package]
name = "livekit_server"
name = "livekit_api"
version = "0.1.0"
edition.workspace = true
description = "SDK for the LiveKit server API"
@ -10,7 +10,7 @@ license = "AGPL-3.0-or-later"
workspace = true
[lib]
path = "src/livekit_server.rs"
path = "src/livekit_api.rs"
doctest = false
[dependencies]

View file

@ -1,4 +1,6 @@
use crate::{proto, token};
pub mod proto;
pub mod token;
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use prost::Message;

View file

@ -28,7 +28,7 @@ cpal = "0.15"
futures.workspace = true
gpui.workspace = true
http_2 = { package = "http", version = "0.2.1" }
livekit_server.workspace = true
livekit_api.workspace = true
log.workspace = true
media.workspace = true
nanoid = { workspace = true, optional = true }

View file

@ -33,7 +33,7 @@ use livekit_client::{
AudioStream, RemoteVideoTrackView, Room, RoomEvent,
};
use livekit_server::token::{self, VideoGrant};
use livekit_api::token::{self, VideoGrant};
use log::LevelFilter;
use simplelog::SimpleLogger;

View file

@ -14,7 +14,7 @@ use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, Has
use gpui::BackgroundExecutor;
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
use livekit::options::TrackPublishOptions;
use livekit_server::{proto, token};
use livekit_api::{proto, token};
use parking_lot::Mutex;
use postage::{mpsc, sink::Sink};
use std::sync::{
@ -107,7 +107,7 @@ impl TestServer {
async fn join_room(&self, token: String, client_room: Room) -> Result<ParticipantIdentity> {
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
let room_name = claims.video.room.unwrap();
let mut server_rooms = self.rooms.lock();
@ -174,7 +174,7 @@ impl TestServer {
async fn leave_room(&self, token: String) -> Result<()> {
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
let room_name = claims.video.room.unwrap();
let mut server_rooms = self.rooms.lock();
@ -195,7 +195,7 @@ impl TestServer {
&self,
token: String,
) -> Result<HashMap<ParticipantIdentity, RemoteParticipant>> {
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let local_identity = ParticipantIdentity(claims.sub.unwrap().to_string());
let room_name = claims.video.room.unwrap().to_string();
@ -288,7 +288,7 @@ impl TestServer {
) -> Result<TrackSid> {
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
let room_name = claims.video.room.unwrap();
@ -354,7 +354,7 @@ impl TestServer {
) -> Result<TrackSid> {
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
let room_name = claims.video.room.unwrap();
@ -419,7 +419,7 @@ impl TestServer {
}
fn set_track_muted(&self, token: &str, track_sid: &TrackSid, muted: bool) -> Result<()> {
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let room_name = claims.video.room.unwrap();
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
let mut server_rooms = self.rooms.lock();
@ -473,7 +473,7 @@ impl TestServer {
}
fn is_track_muted(&self, token: &str, track_sid: &TrackSid) -> Option<bool> {
let claims = livekit_server::token::validate(&token, &self.secret_key).ok()?;
let claims = livekit_api::token::validate(&token, &self.secret_key).ok()?;
let room_name = claims.video.room.unwrap();
let mut server_rooms = self.rooms.lock();
@ -488,7 +488,7 @@ impl TestServer {
}
fn video_tracks(&self, token: String) -> Result<Vec<RemoteVideoTrack>> {
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let room_name = claims.video.room.unwrap();
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
@ -511,7 +511,7 @@ impl TestServer {
}
fn audio_tracks(&self, token: String) -> Result<Vec<RemoteAudioTrack>> {
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let room_name = claims.video.room.unwrap();
let identity = ParticipantIdentity(claims.sub.unwrap().to_string());
@ -641,7 +641,7 @@ pub enum RoomEvent {
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
#[async_trait]
impl livekit_server::api::Client for TestApiClient {
impl livekit_api::Client for TestApiClient {
fn url(&self) -> &str {
&self.url
}
@ -670,7 +670,7 @@ impl livekit_server::api::Client for TestApiClient {
&self,
room: String,
identity: String,
permission: livekit_server::proto::ParticipantPermission,
permission: livekit_api::proto::ParticipantPermission,
) -> Result<()> {
let server = TestServer::get(&self.url)?;
server

View file

@ -22,7 +22,7 @@ test-support = [
"async-trait",
"collections/test-support",
"gpui/test-support",
"livekit_server",
"livekit_api",
"nanoid",
]
@ -33,7 +33,7 @@ async-trait = { workspace = true, optional = true }
collections = { workspace = true, optional = true }
futures.workspace = true
gpui = { workspace = true, optional = true }
livekit_server = { workspace = true, optional = true }
livekit_api = { workspace = true, optional = true }
log.workspace = true
media.workspace = true
nanoid = { workspace = true, optional = true}
@ -47,14 +47,14 @@ core-foundation.workspace = true
async-trait = { workspace = true }
collections = { workspace = true }
gpui = { workspace = true }
livekit_server.workspace = true
livekit_api.workspace = true
nanoid.workspace = true
[dev-dependencies]
async-trait.workspace = true
collections = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] }
livekit_server.workspace = true
livekit_api.workspace = true
nanoid.workspace = true
sha2.workspace = true
simplelog.workspace = true

View file

@ -2,8 +2,8 @@ use std::time::Duration;
use futures::StreamExt;
use gpui::{actions, KeyBinding, Menu, MenuItem};
use livekit_api::token::{self, VideoGrant};
use livekit_client_macos::{LocalAudioTrack, LocalVideoTrack, Room, RoomUpdate};
use livekit_server::token::{self, VideoGrant};
use log::LevelFilter;
use simplelog::SimpleLogger;

View file

@ -4,7 +4,7 @@ use async_trait::async_trait;
use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet};
use futures::Stream;
use gpui::{BackgroundExecutor, SurfaceSource};
use livekit_server::{proto, token};
use livekit_api::{proto, token};
use parking_lot::Mutex;
use postage::watch;
@ -102,7 +102,7 @@ impl TestServer {
#[cfg(any(test, feature = "test-support"))]
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = claims.sub.unwrap().to_string();
let room_name = claims.video.room.unwrap();
let mut server_rooms = self.rooms.lock();
@ -150,7 +150,7 @@ impl TestServer {
// todo(linux): Remove this once the cross-platform LiveKit implementation is merged
#[cfg(any(test, feature = "test-support"))]
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = claims.sub.unwrap().to_string();
let room_name = claims.video.room.unwrap();
let mut server_rooms = self.rooms.lock();
@ -224,7 +224,7 @@ impl TestServer {
// todo(linux): Remove this once the cross-platform LiveKit implementation is merged
#[cfg(any(test, feature = "test-support"))]
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = claims.sub.unwrap().to_string();
let room_name = claims.video.room.unwrap();
@ -280,7 +280,7 @@ impl TestServer {
#[cfg(any(test, feature = "test-support"))]
self.executor.simulate_random_delay().await;
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let identity = claims.sub.unwrap().to_string();
let room_name = claims.video.room.unwrap();
@ -332,7 +332,7 @@ impl TestServer {
}
fn set_track_muted(&self, token: &str, track_sid: &str, muted: bool) -> Result<()> {
let claims = livekit_server::token::validate(token, &self.secret_key)?;
let claims = livekit_api::token::validate(token, &self.secret_key)?;
let room_name = claims.video.room.unwrap();
let identity = claims.sub.unwrap();
let mut server_rooms = self.rooms.lock();
@ -363,7 +363,7 @@ impl TestServer {
}
fn is_track_muted(&self, token: &str, track_sid: &str) -> Option<bool> {
let claims = livekit_server::token::validate(token, &self.secret_key).ok()?;
let claims = livekit_api::token::validate(token, &self.secret_key).ok()?;
let room_name = claims.video.room.unwrap();
let mut server_rooms = self.rooms.lock();
@ -378,7 +378,7 @@ impl TestServer {
}
fn video_tracks(&self, token: String) -> Result<Vec<Arc<RemoteVideoTrack>>> {
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let room_name = claims.video.room.unwrap();
let identity = claims.sub.unwrap();
@ -401,7 +401,7 @@ impl TestServer {
}
fn audio_tracks(&self, token: String) -> Result<Vec<Arc<RemoteAudioTrack>>> {
let claims = livekit_server::token::validate(&token, &self.secret_key)?;
let claims = livekit_api::token::validate(&token, &self.secret_key)?;
let room_name = claims.video.room.unwrap();
let identity = claims.sub.unwrap();
@ -455,7 +455,7 @@ pub struct TestApiClient {
}
#[async_trait]
impl livekit_server::api::Client for TestApiClient {
impl livekit_api::Client for TestApiClient {
fn url(&self) -> &str {
&self.url
}
@ -482,7 +482,7 @@ impl livekit_server::api::Client for TestApiClient {
&self,
room: String,
identity: String,
permission: livekit_server::proto::ParticipantPermission,
permission: livekit_api::proto::ParticipantPermission,
) -> Result<()> {
let server = TestServer::get(&self.url)?;
server

View file

@ -1,3 +0,0 @@
pub mod api;
pub mod proto;
pub mod token;

View file

@ -22,7 +22,7 @@ extend-exclude = [
# Stripe IDs are flagged as typos.
"crates/collab/src/db/tests/processed_stripe_event_tests.rs",
# Not our typos.
"crates/livekit_server/",
"crates/livekit_api/",
# Vim makes heavy use of partial typing tables.
"crates/vim/",
# Editor and file finder rely on partial typing and custom in-string syntax.