From ffe4027eb39787b982fbeda3f52dec4854036705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Fri, 16 Oct 2026 15:55:23 -0700 Subject: [PATCH 1/3] livekit-protocol: the thread schema (THREAD_SCHEMA_V1, THREAD_SCHEMA_VERSION, Status::from_task_state) --- .changeset/protocol_thread_schema.md | 7 +++++ livekit-protocol/src/lib.rs | 46 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .changeset/protocol_thread_schema.md diff --git a/.changeset/protocol_thread_schema.md b/.changeset/protocol_thread_schema.md new file mode 100644 index 000000000..2e5883d61 --- /dev/null +++ b/.changeset/protocol_thread_schema.md @@ -0,0 +1,7 @@ +--- +livekit-protocol: patch +--- + +`livekit-protocol` exposes the conversation schema of a thread's database, as protocol's Go package +does: `agent::THREAD_SCHEMA_VERSION`, `agent::THREAD_SCHEMA_V1` (the SQL) and +`agent_task::Status::from_task_state`. diff --git a/livekit-protocol/src/lib.rs b/livekit-protocol/src/lib.rs index 1927a8f5e..b7eb11cde 100644 --- a/livekit-protocol/src/lib.rs +++ b/livekit-protocol/src/lib.rs @@ -22,6 +22,52 @@ 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"); + + impl agent_task::Status { + /// The status of a `tasks.status` value, an A2A task state: a task not yet finished is + /// running, a rejected one failed. `None` for a value that is not a task state. + pub fn from_task_state(state: &str) -> Option { + Some(match state { + "submitted" | "working" | "input-required" => Self::Running, + "completed" => Self::Completed, + "failed" | "rejected" => Self::Failed, + "canceled" => Self::Canceled, + _ => return None, + }) + } + } + + #[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")); + for state in ["submitted", "working", "input-required"] { + assert_eq!( + agent_task::Status::from_task_state(state), + Some(agent_task::Status::Running) + ); + } + assert_eq!( + agent_task::Status::from_task_state("rejected"), + Some(agent_task::Status::Failed) + ); + assert_eq!(agent_task::Status::from_task_state("cancelled"), None); + } + } } /// The `logger` protobuf package: the `Sensitivity` field annotation enum. From 0db89560422c8c49d80826e8603244a89b4ec1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Fri, 16 Oct 2026 22:25:52 -0700 Subject: [PATCH 2/3] livekit-protocol: drop Status::from_task_state --- .changeset/protocol_thread_schema.md | 3 +-- livekit-protocol/src/lib.rs | 25 ------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/.changeset/protocol_thread_schema.md b/.changeset/protocol_thread_schema.md index 2e5883d61..403ec0e47 100644 --- a/.changeset/protocol_thread_schema.md +++ b/.changeset/protocol_thread_schema.md @@ -3,5 +3,4 @@ livekit-protocol: patch --- `livekit-protocol` exposes the conversation schema of a thread's database, as protocol's Go package -does: `agent::THREAD_SCHEMA_VERSION`, `agent::THREAD_SCHEMA_V1` (the SQL) and -`agent_task::Status::from_task_state`. +does: `agent::THREAD_SCHEMA_VERSION` and `agent::THREAD_SCHEMA_V1` (the SQL). diff --git a/livekit-protocol/src/lib.rs b/livekit-protocol/src/lib.rs index b7eb11cde..0f6566c46 100644 --- a/livekit-protocol/src/lib.rs +++ b/livekit-protocol/src/lib.rs @@ -32,20 +32,6 @@ pub mod agent { pub const THREAD_SCHEMA_V1: &str = include_str!("../protocol/livekit/agent/thread_schema_v1.sql"); - impl agent_task::Status { - /// The status of a `tasks.status` value, an A2A task state: a task not yet finished is - /// running, a rejected one failed. `None` for a value that is not a task state. - pub fn from_task_state(state: &str) -> Option { - Some(match state { - "submitted" | "working" | "input-required" => Self::Running, - "completed" => Self::Completed, - "failed" | "rejected" => Self::Failed, - "canceled" => Self::Canceled, - _ => return None, - }) - } - } - #[cfg(test)] mod tests { use super::*; @@ -55,17 +41,6 @@ pub mod agent { 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")); - for state in ["submitted", "working", "input-required"] { - assert_eq!( - agent_task::Status::from_task_state(state), - Some(agent_task::Status::Running) - ); - } - assert_eq!( - agent_task::Status::from_task_state("rejected"), - Some(agent_task::Status::Failed) - ); - assert_eq!(agent_task::Status::from_task_state("cancelled"), None); } } } From a308fac56058ee84a076207f9eaf9b39444f956d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Sat, 17 Oct 2026 19:19:57 -0700 Subject: [PATCH 3/3] changeset: bump the crates that depend on livekit-protocol --- .changeset/protocol_thread_schema.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.changeset/protocol_thread_schema.md b/.changeset/protocol_thread_schema.md index 403ec0e47..6724a26b4 100644 --- a/.changeset/protocol_thread_schema.md +++ b/.changeset/protocol_thread_schema.md @@ -1,6 +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). +does: `agent::THREAD_SCHEMA_VERSION` and `agent::THREAD_SCHEMA_V1` (the SQL); the crates that +depend on it follow its bump.