diff --git a/.changeset/protocol_thread_schema.md b/.changeset/protocol_thread_schema.md new file mode 100644 index 000000000..6724a26b4 --- /dev/null +++ b/.changeset/protocol_thread_schema.md @@ -0,0 +1,18 @@ +--- +livekit-protocol: patch +livekit: patch +livekit-api: patch +livekit-capture: patch +livekit-common: patch +livekit-data-stream: patch +livekit-datatrack: patch +livekit-ffi: patch +livekit-rpc: patch +livekit-signaling: patch +livekit-token: patch +livekit-uniffi: patch +--- + +`livekit-protocol` exposes the conversation schema of a thread's database, as protocol's Go package +does: `agent::THREAD_SCHEMA_VERSION` and `agent::THREAD_SCHEMA_V1` (the SQL); the crates that +depend on it follow its bump. diff --git a/livekit-protocol/src/lib.rs b/livekit-protocol/src/lib.rs index 1927a8f5e..0f6566c46 100644 --- a/livekit-protocol/src/lib.rs +++ b/livekit-protocol/src/lib.rs @@ -22,6 +22,27 @@ include!("livekit.rs"); /// `include!` or the types exist on disk and are reachable from nowhere. pub mod agent { include!("livekit.agent.rs"); + + /// The newest conversation schema a thread's database can hold (protocol's + /// `livekit/agent/thread_schema.go`). + pub const THREAD_SCHEMA_VERSION: i64 = 1; + + /// Version 1 of the conversation schema inside a thread's database, one statement per `;` + /// (comments hold none). + pub const THREAD_SCHEMA_V1: &str = + include_str!("../protocol/livekit/agent/thread_schema_v1.sql"); + + #[cfg(test)] + mod tests { + use super::*; + + #[test] + fn the_thread_schema_matches_protocol() { + let go = include_str!("../protocol/livekit/agent/thread_schema.go"); + assert!(go.contains(&format!("const ThreadSchemaVersion = {THREAD_SCHEMA_VERSION}"))); + assert!(THREAD_SCHEMA_V1.contains("CREATE TABLE schema_version")); + } + } } /// The `logger` protobuf package: the `Sensitivity` field annotation enum.