Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Unship shared threads (#59981)
Marshall Bowers1fd93cbd3460
diff --git a/Procfile.all b/Procfile.alldeleted file mode 100644index 264b4f6afc3..00000000000--- a/Procfile.all+++ /dev/null@@ -1,6 +0,0 @@-collab: RUST_LOG=${RUST_LOG:-info} cargo run --package=collab serve all-cloud: cd ../cloud; cargo make dev-dashboard: cd ../cloud/packages/dashboard; pnpm dev-website: cd ../zed.dev; pnpm dev --port=3000-livekit: livekit-server --dev-blob_store: ./script/run-local-miniodiff --git a/crates/agent/src/db.rs b/crates/agent/src/db.rsindex 6dafddb3c94..6d104bd5bd2 100644--- a/crates/agent/src/db.rs+++ b/crates/agent/src/db.rs@@ -68,8 +68,6 @@ pub struct DbThread {#[serde(default)]pub profile: Option<AgentProfileId>,#[serde(default)]- pub imported: bool,- #[serde(default)]pub subagent_context: Option<crate::SubagentContext>,#[serde(default)]pub speed: Option<Speed>,@@ -161,7 +159,6 @@ impl SharedThread {request_token_usage: Default::default(),model: self.model,profile: None,- imported: true,subagent_context: None,speed: None,thinking_enabled: false,@@ -346,7 +343,6 @@ impl DbThread {request_token_usage,model: thread.model,profile: thread.profile,- imported: false,subagent_context: None,speed: None,thinking_enabled: false,@@ -766,23 +762,6 @@ mod tests {assert_eq!(restored.updated_at, original.updated_at);}- #[test]- fn test_imported_flag_defaults_to_false() {- // Simulate deserializing a thread without the imported field (backwards compatibility).- let json = r#"{- "title": "Old Thread",- "messages": [],- "updated_at": "2024-01-01T00:00:00Z"- }"#;-- let db_thread: DbThread = serde_json::from_str(json).expect("Failed to deserialize");-- assert!(- !db_thread.imported,- "Legacy threads without imported field should default to false"- );- }-fn session_id(value: &str) -> acp::SessionId {acp::SessionId::new(Arc::<str>::from(value))}@@ -798,7 +777,6 @@ mod tests {request_token_usage: HashMap::default(),model: None,profile: None,- imported: false,subagent_context: None,speed: None,thinking_enabled: false,diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex 41c24431cec..e70a4b2dbb7 100644--- a/crates/agent/src/thread.rs+++ b/crates/agent/src/thread.rs@@ -1237,8 +1237,6 @@ pub struct Thread {pub(crate) prompt_capabilities_rx: watch::Receiver<acp::PromptCapabilities>,pub(crate) project: Entity<Project>,pub(crate) action_log: Entity<ActionLog>,- /// True if this thread was imported from a shared thread and can be synced.- imported: bool,/// If this is a subagent thread, contains context about the parentsubagent_context: Option<SubagentContext>,/// The user's unsent prompt text, persisted so it can be restored when reloading the thread.@@ -1376,7 +1374,6 @@ impl Thread {prompt_capabilities_rx,project,action_log,- imported: false,subagent_context: None,draft_prompt: None,ui_scroll_position: None,@@ -1455,11 +1452,6 @@ impl Thread {Ok(temp_dir)}- /// Returns true if this thread was imported from a shared thread.- pub fn is_imported(&self) -> bool {- self.imported- }-pub fn replay(&mut self,cx: &mut Context<Self>,@@ -1758,7 +1750,6 @@ impl Thread {updated_at: db_thread.updated_at,prompt_capabilities_tx,prompt_capabilities_rx,- imported: db_thread.imported,subagent_context: db_thread.subagent_context,draft_prompt: db_thread.draft_prompt,ui_scroll_position: db_thread.ui_scroll_position.map(|sp| gpui::ListOffset {@@ -1902,7 +1893,6 @@ impl Thread {request_token_usage: self.request_token_usage.clone(),model: (&self.model).into(),profile: Some(self.profile_id.clone()),- imported: self.imported,subagent_context: self.subagent_context.clone(),speed: self.speed,thinking_enabled: self.thinking_enabled,diff --git a/crates/agent/src/thread_store.rs b/crates/agent/src/thread_store.rsindex 97ae2bf5aa2..c09c2df88fd 100644--- a/crates/agent/src/thread_store.rs+++ b/crates/agent/src/thread_store.rs@@ -160,7 +160,6 @@ mod tests {request_token_usage: HashMap::default(),model: None,profile: None,- imported: false,subagent_context: None,speed: None,thinking_enabled: false,diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 39507fa45aa..6296d6c70ae 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -11001,7 +11001,6 @@ mod tests {request_token_usage: HashMap::default(),model: None,profile: None,- imported: false,subagent_context: None,speed: None,thinking_enabled: false,diff --git a/crates/agent_ui/src/conversation_view.rs b/crates/agent_ui/src/conversation_view.rsindex 382ce736233..a5906ebd1a5 100644--- a/crates/agent_ui/src/conversation_view.rs+++ b/crates/agent_ui/src/conversation_view.rs@@ -6,9 +6,7 @@ use acp_thread::{};use acp_thread::{AgentConnection, Plan};use action_log::{ActionLog, ActionLogTelemetry, DiffStats};-use agent::{- NativeAgentServer, NativeAgentSessionList, NoModelConfiguredError, SharedThread, ThreadStore,-};+use agent::{NativeAgentServer, NoModelConfiguredError, ThreadStore};use agent_client_protocol::schema::v1 as acp;#[cfg(test)]use agent_servers::AgentServerDelegate;@@ -24,7 +22,6 @@ use editor::scroll::Autoscroll;use editor::{Editor, EditorEvent, EditorMode, MultiBuffer, PathKey, SelectionEffects, SizingBehavior,};-use feature_flags::{AgentSharingFeatureFlag, FeatureFlagAppExt as _};use file_icons::FileIcons;use fs::Fs;use futures::FutureExt as _;@@ -70,8 +67,7 @@ use util::{time::duration_alt_display,};use workspace::{- CollaboratorId, MultiWorkspace, NewTerminal, PathList, Toast, Workspace,- path_link::sanitize_path_text,+ CollaboratorId, MultiWorkspace, NewTerminal, PathList, Workspace, path_link::sanitize_path_text,};use zed_actions::agent::{Chat, ToggleModelSelector};@@ -3210,6 +3206,7 @@ pub(crate) mod tests {use agent_servers::FakeAcpAgentServer;use editor::MultiBufferOffset;use editor::actions::Paste;+ use feature_flags::FeatureFlagAppExt as _;use fs::FakeFs;use gpui::{ClipboardItem, EventEmitter, TestAppContext, VisualTestContext, point, size};use parking_lot::Mutex;diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rsindex 94a0e389a6f..b60446071d8 100644--- a/crates/agent_ui/src/conversation_view/thread_view.rs+++ b/crates/agent_ui/src/conversation_view/thread_view.rs@@ -39,7 +39,6 @@ use ui::{ButtonLike, CalloutBorderPosition, SpinnerLabel, SpinnerVariant, SplitButton, SplitButtonStyle,Tab,};-use workspace::notifications::NotificationId;use workspace::{OpenOptions, SERIALIZATION_THROTTLE_TIME};use super::*;@@ -1179,13 +1178,6 @@ impl ThreadView {!self.message_queue.is_empty()}- pub fn is_imported_thread(&self, cx: &App) -> bool {- let Some(thread) = self.as_native_thread(cx) else {- return false;- };- thread.read(cx).is_imported()- }-// eventspub fn handle_entry_view_event(@@ -2692,124 +2684,6 @@ impl ThreadView {// thread stuff- fn share_thread(&mut self, _window: &mut Window, cx: &mut Context<Self>) {- let Some((thread, project)) = self.as_native_thread(cx).zip(self.project.upgrade()) else {- return;- };-- let client = project.read(cx).client();- let workspace = self.workspace.clone();- let session_id = thread.read(cx).id().to_string();-- let load_task = thread.read(cx).to_db(cx);-- cx.spawn(async move |_this, cx| {- let db_thread = load_task.await;-- let shared_thread = SharedThread::from_db_thread(&db_thread);- let thread_data = shared_thread.to_bytes()?;- let title = shared_thread.title.to_string();-- client- .request(proto::ShareAgentThread {- session_id: session_id.clone(),- title,- thread_data,- })- .await?;-- let share_url = client::zed_urls::shared_agent_thread_url(&session_id);-- cx.update(|cx| {- if let Some(workspace) = workspace.upgrade() {- workspace.update(cx, |workspace, cx| {- struct ThreadSharedToast;- workspace.show_toast(- Toast::new(- NotificationId::unique::<ThreadSharedToast>(),- "Thread shared!",- )- .on_click(- "Copy URL",- move |_window, cx| {- cx.write_to_clipboard(ClipboardItem::new_string(- share_url.clone(),- ));- },- ),- cx,- );- });- }- });-- anyhow::Ok(())- })- .detach_and_log_err(cx);- }-- pub fn sync_thread(- &mut self,- project: Entity<Project>,- server_view: Entity<ConversationView>,- window: &mut Window,- cx: &mut Context<Self>,- ) {- if !self.is_imported_thread(cx) {- return;- }-- let Some(session_list) = self- .as_native_connection(cx)- .and_then(|connection| connection.session_list(cx))- .and_then(|list| list.downcast::<NativeAgentSessionList>())- else {- return;- };- let thread_store = session_list.thread_store().clone();-- let client = project.read(cx).client();- let session_id = self.thread.read(cx).session_id().clone();- cx.spawn_in(window, async move |this, cx| {- let response = client- .request(proto::GetSharedAgentThread {- session_id: session_id.to_string(),- })- .await?;-- let shared_thread = SharedThread::from_bytes(&response.thread_data)?;-- let db_thread = shared_thread.to_db_thread();-- thread_store- .update(&mut cx.clone(), |store, cx| {- store.save_thread(session_id.clone(), db_thread, Default::default(), cx)- })- .await?;-- server_view.update_in(cx, |server_view, window, cx| server_view.reset(window, cx))?;-- this.update_in(cx, |this, _window, cx| {- if let Some(workspace) = this.workspace.upgrade() {- workspace.update(cx, |workspace, cx| {- struct ThreadSyncedToast;- workspace.show_toast(- Toast::new(- NotificationId::unique::<ThreadSyncedToast>(),- "Thread synced with latest version",- )- .autohide(),- cx,- );- });- }- })?;-- anyhow::Ok(())- })- .detach_and_log_err(cx);- }-pub fn restore_checkpoint(&mut self, message_id: &UserMessageId, cx: &mut Context<Self>) {self.thread.update(cx, |thread, cx| {@@ -6652,34 +6526,6 @@ impl ThreadView {);}- if let Some(project) = self.project.upgrade()- && let Some(server_view) = self.server_view.upgrade()- && cx.has_flag::<AgentSharingFeatureFlag>()- && project.read(cx).client().status().borrow().is_connected()- {- let button = if self.is_imported_thread(cx) {- IconButton::new("sync-thread", IconName::ArrowCircle)- .shape(ui::IconButtonShape::Square)- .icon_size(IconSize::Small)- .icon_color(Color::Ignored)- .tooltip(Tooltip::text("Sync with source thread"))- .on_click(cx.listener(move |this, _, window, cx| {- this.sync_thread(project.clone(), server_view.clone(), window, cx);- }))- } else {- IconButton::new("share-thread", IconName::ArrowUpRight)- .shape(ui::IconButtonShape::Square)- .icon_size(IconSize::Small)- .icon_color(Color::Ignored)- .tooltip(Tooltip::text("Share Thread"))- .on_click(cx.listener(move |this, _, window, cx| {- this.share_thread(window, cx);- }))- };-- container = container.child(button);- }-container.child(open_as_markdown).child(scroll_to_recent_user_prompt)diff --git a/crates/agent_ui/src/thread_metadata_store.rs b/crates/agent_ui/src/thread_metadata_store.rsindex 1f0b0eb46d3..eb840eb5791 100644--- a/crates/agent_ui/src/thread_metadata_store.rs+++ b/crates/agent_ui/src/thread_metadata_store.rs@@ -1844,7 +1844,6 @@ mod tests {request_token_usage: Default::default(),model: None,profile: None,- imported: false,subagent_context: None,speed: None,thinking_enabled: false,diff --git a/crates/collab/migrations.sqlite/20221109000000_test_schema.sql b/crates/collab/migrations.sqlite/20221109000000_test_schema.sqlindex 730c3da9990..98a7053ff27 100644--- a/crates/collab/migrations.sqlite/20221109000000_test_schema.sql+++ b/crates/collab/migrations.sqlite/20221109000000_test_schema.sql@@ -432,14 +432,3 @@ CREATE TABLE IF NOT EXISTS "breakpoints" ();CREATE INDEX "index_breakpoints_on_project_id" ON "breakpoints" ("project_id");--CREATE TABLE IF NOT EXISTS "shared_threads" (- "id" TEXT PRIMARY KEY NOT NULL,- "user_id" INTEGER NOT NULL,- "title" VARCHAR(512) NOT NULL,- "data" BLOB NOT NULL,- "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,- "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP-);--CREATE INDEX "index_shared_threads_user_id" ON "shared_threads" ("user_id");diff --git a/crates/collab/migrations/20251208000000_test_schema.sql b/crates/collab/migrations/20251208000000_test_schema.sqlindex 8b136c347ae..1e3cdaf6691 100644--- a/crates/collab/migrations/20251208000000_test_schema.sql+++ b/crates/collab/migrations/20251208000000_test_schema.sql@@ -410,15 +410,6 @@ CREATE SEQUENCE public.servers_id_seqALTER SEQUENCE public.servers_id_seq OWNED BY public.servers.id;-CREATE TABLE public.shared_threads (- id uuid NOT NULL,- user_id integer NOT NULL,- title text NOT NULL,- data bytea NOT NULL,- created_at timestamp without time zone DEFAULT now() NOT NULL,- updated_at timestamp without time zone DEFAULT now() NOT NULL-);-CREATE TABLE public.users (id integer NOT NULL,admin boolean NOT NULL,@@ -598,9 +589,6 @@ ALTER TABLE ONLY public.roomsALTER TABLE ONLY public.serversADD CONSTRAINT servers_pkey PRIMARY KEY (id);-ALTER TABLE ONLY public.shared_threads- ADD CONSTRAINT shared_threads_pkey PRIMARY KEY (id);-ALTER TABLE ONLY public.usersADD CONSTRAINT users_pkey PRIMARY KEY (id);@@ -616,8 +604,6 @@ ALTER TABLE ONLY public.worktree_settings_filesALTER TABLE ONLY public.worktreesADD CONSTRAINT worktrees_pkey PRIMARY KEY (project_id, id);-CREATE INDEX idx_shared_threads_user_id ON public.shared_threads USING btree (user_id);-CREATE INDEX index_breakpoints_on_project_id ON public.breakpoints USING btree (project_id);CREATE INDEX index_buffers_on_channel_id ON public.buffers USING btree (channel_id);@@ -830,9 +816,6 @@ ALTER TABLE ONLY public.room_participantsALTER TABLE ONLY public.roomsADD CONSTRAINT rooms_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES public.channels(id) ON DELETE CASCADE;-ALTER TABLE ONLY public.shared_threads- ADD CONSTRAINT shared_threads_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;-ALTER TABLE ONLY public.worktree_diagnostic_summariesADD CONSTRAINT worktree_diagnostic_summaries_project_id_worktree_id_fkey FOREIGN KEY (project_id, worktree_id) REFERENCES public.worktrees(project_id, id) ON DELETE CASCADE;diff --git a/crates/collab/src/db/queries.rs b/crates/collab/src/db/queries.rsindex a7d41adb685..5b39661303b 100644--- a/crates/collab/src/db/queries.rs+++ b/crates/collab/src/db/queries.rs@@ -9,5 +9,4 @@ pub mod notifications;pub mod projects;pub mod rooms;pub mod servers;-pub mod shared_threads;pub mod users;diff --git a/crates/collab/src/db/queries/shared_threads.rs b/crates/collab/src/db/queries/shared_threads.rsdeleted file mode 100644index 9cb320d45d4..00000000000--- a/crates/collab/src/db/queries/shared_threads.rs+++ /dev/null@@ -1,76 +0,0 @@-use chrono::Utc;--use super::*;-use crate::db::tables::shared_thread;--impl Database {- pub async fn upsert_shared_thread(- &self,- id: SharedThreadId,- user_id: UserId,- title: &str,- data: Vec<u8>,- ) -> Result<()> {- let title = title.to_string();- self.transaction(|tx| {- let title = title.clone();- let data = data.clone();- async move {- let now = Utc::now().naive_utc();-- let existing = shared_thread::Entity::find_by_id(id).one(&*tx).await?;-- match existing {- Some(existing) => {- if existing.user_id != user_id {- Err(anyhow!("Cannot update shared thread owned by another user"))?;- }-- let mut active: shared_thread::ActiveModel = existing.into();- active.title = ActiveValue::Set(title);- active.data = ActiveValue::Set(data);- active.updated_at = ActiveValue::Set(now);- active.update(&*tx).await?;- }- None => {- shared_thread::ActiveModel {- id: ActiveValue::Set(id),- user_id: ActiveValue::Set(user_id),- title: ActiveValue::Set(title),- data: ActiveValue::Set(data),- created_at: ActiveValue::Set(now),- updated_at: ActiveValue::Set(now),- }- .insert(&*tx)- .await?;- }- }-- Ok(())- }- })- .await- }-- pub async fn get_shared_thread(- &self,- share_id: SharedThreadId,- ) -> Result<Option<(shared_thread::Model, String)>> {- self.transaction(|tx| async move {- let Some(thread) = shared_thread::Entity::find_by_id(share_id)- .one(&*tx)- .await?- else {- return Ok(None);- };-- // We can no longer read the `github_login` from Collab.- //- // Opting to just use "Unknown" here, as the feature is staff-only and infrequently used.- let username = "Unknown".to_string();-- Ok(Some((thread, username)))- })- .await- }-}diff --git a/crates/collab/src/db/tables.rs b/crates/collab/src/db/tables.rsindex 83be94dac57..6a1a2db4364 100644--- a/crates/collab/src/db/tables.rs+++ b/crates/collab/src/db/tables.rs@@ -21,7 +21,6 @@ pub mod project_repository_statuses;pub mod room;pub mod room_participant;pub mod server;-pub mod shared_thread;pub mod user;pub mod worktree;pub mod worktree_diagnostic_summary;diff --git a/crates/collab/src/db/tables/shared_thread.rs b/crates/collab/src/db/tables/shared_thread.rsdeleted file mode 100644index 6969a6e69ea..00000000000--- a/crates/collab/src/db/tables/shared_thread.rs+++ /dev/null@@ -1,32 +0,0 @@-use crate::db::{SharedThreadId, UserId};-use sea_orm::entity::prelude::*;--#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]-#[sea_orm(table_name = "shared_threads")]-pub struct Model {- #[sea_orm(primary_key, auto_increment = false)]- pub id: SharedThreadId,- pub user_id: UserId,- pub title: String,- pub data: Vec<u8>,- pub created_at: DateTime,- pub updated_at: DateTime,-}--#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]-pub enum Relation {- #[sea_orm(- belongs_to = "super::user::Entity",- from = "Column::UserId",- to = "super::user::Column::Id"- )]- User,-}--impl Related<super::user::Entity> for Entity {- fn to() -> RelationDef {- Relation::User.def()- }-}--impl ActiveModelBehavior for ActiveModel {}diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rsindex a591e1a57a2..e74aea147da 100644--- a/crates/collab/src/rpc.rs+++ b/crates/collab/src/rpc.rs@@ -7,8 +7,7 @@ use crate::{db::{self, BufferId, Capability, Channel, ChannelId, ChannelRole, ChannelsForUser, Database,InviteMemberResult, MembershipUpdated, NotificationId, ProjectId, RejoinedProject,- RemoveChannelMemberResult, RespondToChannelInvite, RoomId, ServerId, SharedThreadId,- UserId,+ RemoveChannelMemberResult, RespondToChannelInvite, RoomId, ServerId, UserId,},executor::Executor,};@@ -512,8 +511,6 @@ impl Server {.add_request_handler(forward_mutating_project_request::<proto::CheckForPushedCommits>).add_request_handler(forward_mutating_project_request::<proto::ToggleLspLogs>).add_message_handler(broadcast_project_message_from_host::<proto::LanguageServerLog>)- .add_request_handler(share_agent_thread)- .add_request_handler(get_shared_agent_thread).add_request_handler(forward_project_search_chunk);Arc::new(server)@@ -4152,54 +4149,6 @@ fn project_left(project: &db::LeftProject, session: &Session) {}}-async fn share_agent_thread(- request: proto::ShareAgentThread,- response: Response<proto::ShareAgentThread>,- session: MessageContext,-) -> Result<()> {- let user_id = session.user_id();-- let share_id = SharedThreadId::from_proto(request.session_id.clone())- .ok_or_else(|| anyhow!("Invalid session ID format"))?;-- session- .db()- .await- .upsert_shared_thread(share_id, user_id, &request.title, request.thread_data)- .await?;-- response.send(proto::Ack {})?;-- Ok(())-}--async fn get_shared_agent_thread(- request: proto::GetSharedAgentThread,- response: Response<proto::GetSharedAgentThread>,- session: MessageContext,-) -> Result<()> {- let share_id = SharedThreadId::from_proto(request.session_id)- .ok_or_else(|| anyhow!("Invalid session ID format"))?;-- let result = session.db().await.get_shared_thread(share_id).await?;-- match result {- Some((thread, username)) => {- response.send(proto::GetSharedAgentThreadResponse {- title: thread.title,- thread_data: thread.data,- sharer_username: username,- created_at: thread.created_at.and_utc().to_rfc3339(),- })?;- }- None => {- return Err(anyhow!("Shared thread not found").into());- }- }-- Ok(())-}-pub trait ResultExt {type Ok;diff --git a/crates/collab/tests/integration/agent_sharing_tests.rs b/crates/collab/tests/integration/agent_sharing_tests.rsdeleted file mode 100644index e186a7af642..00000000000--- a/crates/collab/tests/integration/agent_sharing_tests.rs+++ /dev/null@@ -1,214 +0,0 @@-use agent::SharedThread;-use gpui::{BackgroundExecutor, TestAppContext};-use rpc::proto;-use uuid::Uuid;--use crate::TestServer;--#[gpui::test]-async fn test_share_and_retrieve_thread(- executor: BackgroundExecutor,- cx_a: &mut TestAppContext,- cx_b: &mut TestAppContext,-) {- let mut server = TestServer::start(executor.clone()).await;- let client_a = server.create_client(cx_a, "user_a").await;- let client_b = server.create_client(cx_b, "user_b").await;-- executor.run_until_parked();-- let session_id = Uuid::new_v4().to_string();-- let original_thread = SharedThread {- title: "Shared Test Thread".into(),- messages: vec![],- updated_at: chrono::Utc::now(),- model: None,- version: SharedThread::VERSION.to_string(),- };-- let thread_data = original_thread- .to_bytes()- .expect("Failed to serialize thread");-- client_a- .client()- .request(proto::ShareAgentThread {- session_id: session_id.clone(),- title: original_thread.title.to_string(),- thread_data,- })- .await- .expect("Failed to share thread");-- let get_response = client_b- .client()- .request(proto::GetSharedAgentThread {- session_id: session_id.clone(),- })- .await- .expect("Failed to get shared thread");-- let imported_shared_thread =- SharedThread::from_bytes(&get_response.thread_data).expect("Failed to deserialize thread");-- assert_eq!(imported_shared_thread.title, original_thread.title);- assert_eq!(imported_shared_thread.version, SharedThread::VERSION);-- let db_thread = imported_shared_thread.to_db_thread();-- assert!(- db_thread.title.starts_with("🔗"),- "Imported thread title should have link prefix"- );- assert!(- db_thread.title.contains("Shared Test Thread"),- "Imported thread should preserve original title"- );-}--#[gpui::test]-async fn test_reshare_updates_existing_thread(- executor: BackgroundExecutor,- cx_a: &mut TestAppContext,- cx_b: &mut TestAppContext,-) {- let mut server = TestServer::start(executor.clone()).await;- let client_a = server.create_client(cx_a, "user_a").await;- let client_b = server.create_client(cx_b, "user_b").await;-- executor.run_until_parked();-- let session_id = Uuid::new_v4().to_string();-- client_a- .client()- .request(proto::ShareAgentThread {- session_id: session_id.clone(),- title: "Original Title".to_string(),- thread_data: b"original data".to_vec(),- })- .await- .expect("Failed to share thread");-- client_a- .client()- .request(proto::ShareAgentThread {- session_id: session_id.clone(),- title: "Updated Title".to_string(),- thread_data: b"updated data".to_vec(),- })- .await- .expect("Failed to re-share thread");-- let get_response = client_b- .client()- .request(proto::GetSharedAgentThread {- session_id: session_id.clone(),- })- .await- .expect("Failed to get shared thread");-- assert_eq!(get_response.title, "Updated Title");- assert_eq!(get_response.thread_data, b"updated data".to_vec());-}--#[gpui::test]-async fn test_get_nonexistent_thread(executor: BackgroundExecutor, cx: &mut TestAppContext) {- let mut server = TestServer::start(executor.clone()).await;- let client = server.create_client(cx, "user_a").await;-- executor.run_until_parked();-- let nonexistent_session_id = Uuid::new_v4().to_string();-- let result = client- .client()- .request(proto::GetSharedAgentThread {- session_id: nonexistent_session_id,- })- .await;-- assert!(result.is_err(), "Should fail for nonexistent thread");-}--#[gpui::test]-async fn test_sync_imported_thread(- executor: BackgroundExecutor,- cx_a: &mut TestAppContext,- cx_b: &mut TestAppContext,-) {- let mut server = TestServer::start(executor.clone()).await;- let client_a = server.create_client(cx_a, "user_a").await;- let client_b = server.create_client(cx_b, "user_b").await;-- executor.run_until_parked();-- let session_id = Uuid::new_v4().to_string();-- // User A shares a thread with initial content.- let initial_thread = SharedThread {- title: "Initial Title".into(),- messages: vec![],- updated_at: chrono::Utc::now(),- model: None,- version: SharedThread::VERSION.to_string(),- };-- client_a- .client()- .request(proto::ShareAgentThread {- session_id: session_id.clone(),- title: initial_thread.title.to_string(),- thread_data: initial_thread.to_bytes().expect("Failed to serialize"),- })- .await- .expect("Failed to share thread");-- // User B imports the thread.- let initial_response = client_b- .client()- .request(proto::GetSharedAgentThread {- session_id: session_id.clone(),- })- .await- .expect("Failed to get shared thread");-- let initial_imported =- SharedThread::from_bytes(&initial_response.thread_data).expect("Failed to deserialize");- assert_eq!(initial_imported.title.as_ref(), "Initial Title");-- // User A updates the shared thread.- let updated_thread = SharedThread {- title: "Updated Title".into(),- messages: vec![],- updated_at: chrono::Utc::now(),- model: None,- version: SharedThread::VERSION.to_string(),- };-- client_a- .client()- .request(proto::ShareAgentThread {- session_id: session_id.clone(),- title: updated_thread.title.to_string(),- thread_data: updated_thread.to_bytes().expect("Failed to serialize"),- })- .await- .expect("Failed to re-share thread");-- // User B syncs the imported thread (fetches the latest version).- let synced_response = client_b- .client()- .request(proto::GetSharedAgentThread {- session_id: session_id.clone(),- })- .await- .expect("Failed to sync shared thread");-- let synced_thread =- SharedThread::from_bytes(&synced_response.thread_data).expect("Failed to deserialize");-- // The synced thread should have the updated title.- assert_eq!(synced_thread.title.as_ref(), "Updated Title");-}diff --git a/crates/collab/tests/integration/collab_tests.rs b/crates/collab/tests/integration/collab_tests.rsindex 921319487bf..8f72035c433 100644--- a/crates/collab/tests/integration/collab_tests.rs+++ b/crates/collab/tests/integration/collab_tests.rs@@ -2,7 +2,6 @@ use call::Room;use client::ChannelId;use gpui::{Entity, TestAppContext};-mod agent_sharing_tests;mod auto_watch_tests;mod channel_buffer_tests;mod channel_guest_tests;diff --git a/crates/collab/tests/integration/db_tests/db_tests.rs b/crates/collab/tests/integration/db_tests/db_tests.rsindex 15a90fcfedb..c2d4c3719d7 100644--- a/crates/collab/tests/integration/db_tests/db_tests.rs+++ b/crates/collab/tests/integration/db_tests/db_tests.rs@@ -1,6 +1,5 @@use crate::test_both_dbs;-use super::*;use collab::db::RoomId;use collab::db::*;use pretty_assertions::assert_eq;@@ -228,121 +227,3 @@ async fn test_project_count(db: &Arc<Database>) {.unwrap();assert_eq!(db.project_count_excluding_admins().await.unwrap(), 0);}--test_both_dbs!(- test_upsert_shared_thread,- test_upsert_shared_thread_postgres,- test_upsert_shared_thread_sqlite-);--async fn test_upsert_shared_thread(db: &Arc<Database>) {- use collab::db::SharedThreadId;- use uuid::Uuid;-- let user_id = new_test_user(db).await;-- let thread_id = SharedThreadId(Uuid::new_v4());- let title = "My Test Thread";- let data = b"test thread data".to_vec();-- db.upsert_shared_thread(thread_id, user_id, title, data.clone())- .await- .unwrap();-- let result = db.get_shared_thread(thread_id).await.unwrap();- assert!(result.is_some(), "Should find the shared thread");-- let (thread, username) = result.unwrap();- assert_eq!(thread.title, title);- assert_eq!(thread.data, data);- assert_eq!(thread.user_id, user_id);- assert_eq!(username, "Unknown");-}--test_both_dbs!(- test_upsert_shared_thread_updates_existing,- test_upsert_shared_thread_updates_existing_postgres,- test_upsert_shared_thread_updates_existing_sqlite-);--async fn test_upsert_shared_thread_updates_existing(db: &Arc<Database>) {- use collab::db::SharedThreadId;- use uuid::Uuid;-- let user_id = new_test_user(db).await;-- let thread_id = SharedThreadId(Uuid::new_v4());-- // Create initial thread.- db.upsert_shared_thread(- thread_id,- user_id,- "Original Title",- b"original data".to_vec(),- )- .await- .unwrap();-- // Update the same thread.- db.upsert_shared_thread(- thread_id,- user_id,- "Updated Title",- b"updated data".to_vec(),- )- .await- .unwrap();-- let result = db.get_shared_thread(thread_id).await.unwrap();- let (thread, _) = result.unwrap();-- assert_eq!(thread.title, "Updated Title");- assert_eq!(thread.data, b"updated data".to_vec());-}--test_both_dbs!(- test_cannot_update_another_users_shared_thread,- test_cannot_update_another_users_shared_thread_postgres,- test_cannot_update_another_users_shared_thread_sqlite-);--async fn test_cannot_update_another_users_shared_thread(db: &Arc<Database>) {- use collab::db::SharedThreadId;- use uuid::Uuid;-- let user1_id = new_test_user(db).await;- let user2_id = new_test_user(db).await;-- let thread_id = SharedThreadId(Uuid::new_v4());-- db.upsert_shared_thread(thread_id, user1_id, "User 1 Thread", b"user1 data".to_vec())- .await- .unwrap();-- let result = db- .upsert_shared_thread(thread_id, user2_id, "User 2 Title", b"user2 data".to_vec())- .await;-- assert!(- result.is_err(),- "Should not allow updating another user's thread"- );-}--test_both_dbs!(- test_get_nonexistent_shared_thread,- test_get_nonexistent_shared_thread_postgres,- test_get_nonexistent_shared_thread_sqlite-);--async fn test_get_nonexistent_shared_thread(db: &Arc<Database>) {- use collab::db::SharedThreadId;- use uuid::Uuid;-- let result = db- .get_shared_thread(SharedThreadId(Uuid::new_v4()))- .await- .unwrap();-- assert!(result.is_none(), "Should not find non-existent thread");-}diff --git a/crates/feature_flags/src/flags.rs b/crates/feature_flags/src/flags.rsindex 0c341164089..8a5de71d822 100644--- a/crates/feature_flags/src/flags.rs+++ b/crates/feature_flags/src/flags.rs@@ -27,14 +27,6 @@ impl FeatureFlag for AcpBetaFeatureFlag {}register_feature_flag!(AcpBetaFeatureFlag);-pub struct AgentSharingFeatureFlag;--impl FeatureFlag for AgentSharingFeatureFlag {- const NAME: &'static str = "agent-sharing";- type Value = PresenceFlag;-}-register_feature_flag!(AgentSharingFeatureFlag);-pub struct DiffReviewFeatureFlag;impl FeatureFlag for DiffReviewFeatureFlag {diff --git a/crates/proto/proto/ai.proto b/crates/proto/proto/ai.protoindex 4309847c1be..20fa1933066 100644--- a/crates/proto/proto/ai.proto+++ b/crates/proto/proto/ai.proto@@ -69,20 +69,3 @@ message NewExternalAgentVersionAvailable {string name = 2;string version = 3;}--message ShareAgentThread {- string session_id = 1; // Client-generated UUID (acp::SessionId)- string title = 2;- bytes thread_data = 3;-}--message GetSharedAgentThread {- string session_id = 1; // UUID string-}--message GetSharedAgentThreadResponse {- string title = 1;- bytes thread_data = 2;- string sharer_username = 3;- string created_at = 4;-}diff --git a/crates/proto/proto/zed.proto b/crates/proto/proto/zed.protoindex 31e86e9ba6e..f87c0444c68 100644--- a/crates/proto/proto/zed.proto+++ b/crates/proto/proto/zed.proto@@ -435,10 +435,6 @@ message Envelope {TrustWorktrees trust_worktrees = 404;RestrictWorktrees restrict_worktrees = 405;- ShareAgentThread share_agent_thread = 406;- GetSharedAgentThread get_shared_agent_thread = 407;- GetSharedAgentThreadResponse get_shared_agent_thread_response = 408;-FindSearchCandidatesChunk find_search_candidates_chunk = 409;FindSearchCandidatesCancelled find_search_candidates_cancelled = 410;GetContextServerCommand get_context_server_command = 411;@@ -519,6 +515,7 @@ message Envelope {reserved 429 to 430;reserved 211 to 216, 232 to 233;reserved 397 to 398;+ reserved 406 to 408;}message Hello {diff --git a/crates/proto/src/proto.rs b/crates/proto/src/proto.rsindex feb8bc9c6cd..89867785537 100644--- a/crates/proto/src/proto.rs+++ b/crates/proto/src/proto.rs@@ -373,9 +373,6 @@ messages!((GitRenameWorktree, Background),(GitWorktreeCreatedAt, Background),(GitWorktreeCreatedAtResponse, Background),- (ShareAgentThread, Foreground),- (GetSharedAgentThread, Foreground),- (GetSharedAgentThreadResponse, Foreground),(FindSearchCandidatesChunk, Background),(FindSearchCandidatesCancelled, Background),(SpawnKernel, Background),@@ -488,8 +485,6 @@ request_messages!((SendChannelMessage, SendChannelMessageResponse),(SetChannelMemberRole, Ack),(SetChannelVisibility, Ack),- (ShareAgentThread, Ack),- (GetSharedAgentThread, GetSharedAgentThreadResponse),(ShareProject, ShareProjectResponse),(SynchronizeBuffers, SynchronizeBuffersResponse),(TaskContextForLocation, TaskContext),diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex f196153aed6..725db34126c 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -14,8 +14,6 @@ const _: () = assert!(Forks: update APP_NAME in crates/paths/src/paths.rs when renaming the binary.",);-use agent::{SharedThread, ThreadStore};-use agent_client_protocol::schema::v1 as acp;use agent_ui::AgentPanel;use anyhow::{Context as _, Result};use clap::Parser;@@ -32,8 +30,7 @@ use futures::{StreamExt, channel::oneshot, future};use git::GitHostingProviderRegistry;use git_ui::clone::clone_and_open;use gpui::{- App, AppContext, Application, AsyncApp, Focusable as _, QuitMode, Task, TaskExt,- UpdateGlobal as _, block_on,+ App, AppContext, Application, AsyncApp, QuitMode, Task, TaskExt, UpdateGlobal as _, block_on,};use gpui_platform;@@ -49,7 +46,6 @@ use assets::Assets;use node_runtime::{NodeBinaryOptions, NodeRuntime};use parking_lot::Mutex;use project::{project_settings::ProjectSettings, trusted_worktrees};-use proto;use recent_projects::{RemoteSettings, open_remote_project};use release_channel::{AppCommitSha, AppVersion, ReleaseChannel};use session::{AppSession, Session};@@ -1053,106 +1049,6 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut}).detach_and_log_err(cx);}- OpenRequestKind::SharedAgentThread { session_id } => {- cx.spawn(async move |cx| {- let multi_workspace =- workspace::get_any_active_multi_workspace(app_state.clone(), cx.clone())- .await?;-- let workspace =- multi_workspace.read_with(cx, |mw, _| mw.workspace().clone())?;-- let import_state = multi_workspace.update(cx, |_, window, cx| {- workspace.update(cx, |workspace, cx| {- if workspace.root_paths(cx).is_empty() {- workspace.focus_panel::<AgentPanel>(window, cx);-- struct OpenProjectForSharedThreadToast;- workspace.show_toast(- Toast::new(- NotificationId::unique::<OpenProjectForSharedThreadToast>(),- "Open a project to import shared threads",- )- .autohide(),- cx,- );-- return anyhow::Ok(None);- }-- let client = workspace.project().read(cx).client();- let thread_store: Option<gpui::Entity<ThreadStore>> = workspace- .panel::<AgentPanel>(cx)- .map(|panel| panel.read(cx).thread_store().clone());- anyhow::Ok(Some((client, thread_store)))- })- })??;-- let Some((client, thread_store)) = import_state else {- return Ok(());- };-- let Some(thread_store): Option<gpui::Entity<ThreadStore>> = thread_store else {- anyhow::bail!("Agent panel not available");- };-- let response = client- .request(proto::GetSharedAgentThread {- session_id: session_id.clone(),- })- .await- .context("Failed to fetch shared thread")?;-- let shared_thread = SharedThread::from_bytes(&response.thread_data)?;- let db_thread = shared_thread.to_db_thread();- let session_id = acp::SessionId::new(session_id);-- let save_session_id = session_id.clone();-- thread_store- .update(&mut cx.clone(), |store, cx| {- store.save_thread(- save_session_id.clone(),- db_thread,- Default::default(),- cx,- )- })- .await?;-- let sharer_username = response.sharer_username.clone();-- multi_workspace.update(cx, |_, window, cx| {- workspace.update(cx, |workspace, cx| {- if let Some(panel) = workspace.panel::<AgentPanel>(cx) {- panel.update(cx, |panel, cx| {- panel.open_thread(- session_id,- None,- Some(format!("🔗 {}", response.title).into()),- window,- cx,- );- });- panel.focus_handle(cx).focus(window, cx);- }-- struct ImportedThreadToast;- workspace.show_toast(- Toast::new(- NotificationId::unique::<ImportedThreadToast>(),- format!("Imported shared thread from {}", sharer_username),- )- .autohide(),- cx,- );- });- })?;-- anyhow::Ok(())- })- .detach_and_log_err(cx);- }OpenRequestKind::InstallSkill { content } => {cx.spawn(async move |cx| {let multi_workspace =diff --git a/crates/zed/src/visual_test_runner.rs b/crates/zed/src/visual_test_runner.rsindex ee9b0ec2d55..f7503760167 100644--- a/crates/zed/src/visual_test_runner.rs+++ b/crates/zed/src/visual_test_runner.rs@@ -2731,7 +2731,6 @@ fn run_multi_workspace_sidebar_visual_tests(request_token_usage: Default::default(),model: None,profile: None,- imported: false,subagent_context: None,speed: None,thinking_enabled: false,diff --git a/crates/zed/src/zed/open_listener.rs b/crates/zed/src/zed/open_listener.rsindex eb38c1cac92..80a851571b8 100644--- a/crates/zed/src/zed/open_listener.rs+++ b/crates/zed/src/zed/open_listener.rs@@ -59,9 +59,6 @@ pub enum OpenRequestKind {AgentPanel {external_source_prompt: Option<ExternalSourcePrompt>,},- SharedAgentThread {- session_id: String,- },InstallSkill {/// Full `SKILL.md` contents embedded in a `zed://skill` share link.content: String,@@ -99,10 +96,6 @@ impl std::fmt::Debug for OpenRequestKind {.debug_struct("AgentPanel").field("external_source_prompt", external_source_prompt).finish(),- Self::SharedAgentThread { session_id } => f- .debug_struct("SharedAgentThread")- .field("session_id", session_id)- .finish(),Self::InstallSkill { content } => f.debug_struct("InstallSkill").field("content_len", &content.len())@@ -178,14 +171,6 @@ impl OpenRequest {this.kind = Some(OpenRequestKind::Extension {extension_id: extension_id.to_string(),});- } else if let Some(session_id_str) = url.strip_prefix("zed://agent/shared/") {- if uuid::Uuid::parse_str(session_id_str).is_ok() {- this.kind = Some(OpenRequestKind::SharedAgentThread {- session_id: session_id_str.to_string(),- });- } else {- log::error!("Invalid session ID in URL: {}", session_id_str);- }} else if url.starts_with(agent_skills::SKILL_SHARE_LINK_PREFIX) {this.parse_skill_install_url(&url)?} else if let Some(agent_path) = url.strip_prefix("zed://agent") {@@ -1551,50 +1536,6 @@ mod tests {}}- #[gpui::test]- fn test_parse_shared_agent_thread_url(cx: &mut TestAppContext) {- let _app_state = init_test(cx);- let session_id = "123e4567-e89b-12d3-a456-426614174000";-- let request = cx.update(|cx| {- OpenRequest::parse(- RawOpenRequest {- urls: vec![format!("zed://agent/shared/{session_id}")],- ..Default::default()- },- cx,- )- .unwrap()- });-- match request.kind {- Some(OpenRequestKind::SharedAgentThread {- session_id: parsed_session_id,- }) => {- assert_eq!(parsed_session_id, session_id);- }- _ => panic!("Expected SharedAgentThread kind"),- }- }-- #[gpui::test]- fn test_parse_shared_agent_thread_url_with_invalid_uuid(cx: &mut TestAppContext) {- let _app_state = init_test(cx);-- let request = cx.update(|cx| {- OpenRequest::parse(- RawOpenRequest {- urls: vec!["zed://agent/shared/not-a-uuid".into()],- ..Default::default()- },- cx,- )- .unwrap()- });-- assert!(request.kind.is_none());- }-#[gpui::test]fn test_parse_git_commit_url(cx: &mut TestAppContext) {let _app_state = init_test(cx);