Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
acp_thread: Use v2 session and tool IDs across shared agent state (#65350)
Ben Brandt1c9dd3e70f60
diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rsindex 4b32890ee6e..38db30be2e4 100644--- a/crates/acp_thread/src/acp_thread.rs+++ b/crates/acp_thread/src/acp_thread.rs@@ -291,7 +291,7 @@ pub fn sandbox_not_applied_from_meta(#[derive(Clone, Debug, Deserialize, Serialize)]pub struct SubagentSessionInfo {/// The session id of the subagent sessiont that was spawned- pub session_id: acp_v1::SessionId,+ pub session_id: acp_v2::SessionId,/// The index of the message of the start of the "turn" run by this tool callpub message_start_index: usize,/// The index of the output of the message that the subagent has returned@@ -1017,7 +1017,7 @@ impl AgentThreadEntry {#[derive(Debug)]pub struct ToolCall {- pub id: acp_v1::ToolCallId,+ pub id: acp_v2::ToolCallId,pub label: Entity<Markdown>,title: Option<SharedString>,pub name: Option<SharedString>,@@ -1056,7 +1056,7 @@ pub struct PermissionRequest {#[derive(Debug)]enum PermissionRequestData {LegacyTool {- tool_call_id: acp_v1::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,options: PermissionOptions,kind: AuthorizationKind,respond_tx: oneshot::Sender<RequestPermissionOutcome>,@@ -1068,7 +1068,7 @@ enum PermissionRequestData {}impl PermissionRequest {- pub fn legacy_tool_call_id(&self) -> Option<&acp_v1::ToolCallId> {+ pub fn legacy_tool_call_id(&self) -> Option<&acp_v2::ToolCallId> {match &self.data {PermissionRequestData::LegacyTool { tool_call_id, .. } => Some(tool_call_id),PermissionRequestData::Generic { .. } => None,@@ -1211,7 +1211,7 @@ impl ToolCall {) -> Result<Self> {let update = acp_v1::ToolCallUpdate::from(tool_call);let mut call = Self::from_patch(- update.tool_call_id,+ acp_v2::ToolCallId::new(update.tool_call_id.0),ToolCallPatch::legacy(update.fields, update.meta),language_registry,terminals,@@ -1224,7 +1224,7 @@ impl ToolCall {}fn from_patch(- id: acp_v1::ToolCallId,+ id: acp_v2::ToolCallId,patch: ToolCallPatch,language_registry: Arc<LanguageRegistry>,terminals: &HashMap<acp_v1::TerminalId, Entity<Terminal>>,@@ -3145,11 +3145,11 @@ pub enum ToolCallUpdate {}impl ToolCallUpdate {- fn id(&self) -> &acp_v1::ToolCallId {+ fn id(&self) -> acp_v2::ToolCallId {match self {- Self::UpdateFields(update) => &update.tool_call_id,- Self::UpdateDiff(diff) => &diff.id,- Self::UpdateTerminal(terminal) => &terminal.id,+ Self::UpdateFields(update) => acp_v2::ToolCallId::new(update.tool_call_id.0.clone()),+ Self::UpdateDiff(diff) => diff.id.clone(),+ Self::UpdateTerminal(terminal) => terminal.id.clone(),}}}@@ -3168,7 +3168,7 @@ impl From<ToolCallUpdateDiff> for ToolCallUpdate {#[derive(Debug, PartialEq)]pub struct ToolCallUpdateDiff {- pub id: acp_v1::ToolCallId,+ pub id: acp_v2::ToolCallId,pub diff: Entity<Diff>,}@@ -3180,7 +3180,7 @@ impl From<ToolCallUpdateTerminal> for ToolCallUpdate {#[derive(Debug, PartialEq)]pub struct ToolCallUpdateTerminal {- pub id: acp_v1::ToolCallId,+ pub id: acp_v2::ToolCallId,pub terminal: Entity<Terminal>,}@@ -3389,7 +3389,7 @@ fn stop_reason_from_v1(reason: &acp_v1::StopReason) -> Option<acp_v2::StopReasonpub struct AcpThread {session_info: AgentSessionInfo,- parent_session_id: Option<acp_v1::SessionId>,+ parent_session_id: Option<acp_v2::SessionId>,provisional_title: Option<SharedString>,entries: Vec<AgentThreadEntry>,// Notices stay with the live session, but never enter conversation history or exports.@@ -3544,7 +3544,7 @@ pub enum AcpThreadEvent {/// The request left `Pending`; this does not imply delivery to its response waiter.ElicitationResponded(ElicitationEntryId),Retry(RetryStatus),- SubagentSpawned(acp_v1::SessionId),+ SubagentSpawned(acp_v2::SessionId),Stopped {activity_generation: u64,activity_duration: Option<Duration>,@@ -3646,13 +3646,13 @@ impl Error for LoadError {}impl AcpThread {pub fn new(- parent_session_id: Option<acp_v1::SessionId>,+ parent_session_id: Option<acp_v2::SessionId>,title: Option<SharedString>,work_dirs: Option<PathList>,connection: Rc<dyn AgentConnection>,project: Entity<Project>,action_log: Entity<ActionLog>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,mut prompt_capabilities_rx: watch::Receiver<acp_v2::PromptCapabilities>,cx: &mut Context<Self>,) -> Self {@@ -3765,7 +3765,7 @@ impl AcpThread {}}- pub fn parent_session_id(&self) -> Option<&acp_v1::SessionId> {+ pub fn parent_session_id(&self) -> Option<&acp_v2::SessionId> {self.parent_session_id.as_ref()}@@ -3874,7 +3874,7 @@ impl AcpThread {}}- fn tool_call_has_accepted_user_answer(&self, tool_call_id: &acp_v1::ToolCallId) -> bool {+ fn tool_call_has_accepted_user_answer(&self, tool_call_id: &acp_v2::ToolCallId) -> bool {self.elicitations.elicitations().iter().any(|elicitation| {matches!(elicitation.status, ElicitationStatus::Accepted)// Accepting a URL elicitation only consents to opening a link,@@ -3883,7 +3883,7 @@ impl AcpThread {&& matches!(elicitation.request.scope(),acp_v2::ElicitationScope::Session(scope)- if scope.tool_call_id.as_ref().is_some_and(|id| id.0 == tool_call_id.0)+ if scope.tool_call_id.as_ref() == Some(tool_call_id))})}@@ -3917,7 +3917,7 @@ impl AcpThread {}}- pub fn session_id(&self) -> &acp_v1::SessionId {+ pub fn session_id(&self) -> &acp_v2::SessionId {&self.session_info.session_id}@@ -5224,7 +5224,7 @@ impl AcpThread {cx.emit(AcpThreadEvent::TitleUpdated);}- pub fn subagent_spawned(&mut self, session_id: acp_v1::SessionId, cx: &mut Context<Self>) {+ pub fn subagent_spawned(&mut self, session_id: acp_v2::SessionId, cx: &mut Context<Self>) {cx.emit(AcpThreadEvent::SubagentSpawned(session_id));}@@ -5248,12 +5248,13 @@ impl AcpThread {let update = update.into();let languages = self.project.read(cx).languages().clone();- let ix = match self.index_for_tool_call(update.id()) {+ let id = update.id();+ let ix = match self.index_for_tool_call(&id) {Some(ix) => ix,None => {// Tool call not found - create a failed tool call entrylet failed_tool_call = ToolCall::from_acp(- acp_v1::ToolCall::new(update.id().clone(), "Tool call not found")+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(id.0), "Tool call not found").kind(acp_v1::ToolKind::Fetch).status(acp_v1::ToolCallStatus::Failed).content(vec!["Tool call not found".into()]),@@ -5286,7 +5287,7 @@ impl AcpThread {return Err(error);}if location_updated {- self.resolve_locations(update.tool_call_id, cx);+ self.resolve_locations(id, cx);}}ToolCallUpdate::UpdateDiff(update) => {@@ -5350,7 +5351,7 @@ impl AcpThread {cx: &mut Context<Self>,) -> Result<(), acp_v1::Error> {let language_registry = self.project.read(cx).languages().clone();- let id = update.tool_call_id.clone();+ let id = acp_v2::ToolCallId::new(update.tool_call_id.0.clone());if let Some(ix) = self.index_for_tool_call(&id) {let AgentThreadEntry::ToolCall(call) = &mut self.entries[ix] else {unreachable!()@@ -5404,7 +5405,7 @@ impl AcpThread {self.ensure_tool_content_terminal(content, cx);}}- let id = acp_v1::ToolCallId::new(update.tool_call_id.0.clone());+ let id = update.tool_call_id.clone();let patch = ToolCallPatch::protocol(update);let locations_changed = !patch.locations.is_undefined();if let Some(status) = ToolCallStatus::from_reported(patch.status.value()) {@@ -5448,15 +5449,15 @@ impl AcpThread {self.ensure_tool_content_terminal(&content, cx);let content = PreparedToolCallContent::from_v2(content, &self.terminals)?;let language_registry = self.project.read(cx).languages().clone();- let id = acp_v1::ToolCallId::new(tool_call_id.0.clone());+ let id = tool_call_id;if let Some((index, call)) = self.tool_call_mut(&id) {call.append_content(content, &language_registry, cx);cx.emit(AcpThreadEvent::EntryUpdated(index));} else {let mut call = ToolCall::from_patch(- id,- ToolCallPatch::protocol(acp_v2::ToolCallUpdate::new(tool_call_id)),+ id.clone(),+ ToolCallPatch::protocol(acp_v2::ToolCallUpdate::new(id)),language_registry.clone(),&self.terminals,cx,@@ -5480,7 +5481,7 @@ impl AcpThread {}}- fn index_for_tool_call(&self, id: &acp_v1::ToolCallId) -> Option<usize> {+ fn index_for_tool_call(&self, id: &acp_v2::ToolCallId) -> Option<usize> {self.entries.iter().enumerate()@@ -5496,7 +5497,7 @@ impl AcpThread {})}- fn tool_call_mut(&mut self, id: &acp_v1::ToolCallId) -> Option<(usize, &mut ToolCall)> {+ fn tool_call_mut(&mut self, id: &acp_v2::ToolCallId) -> Option<(usize, &mut ToolCall)> {// The tool call we are looking for is typically the last one, or very close to the end.// At the moment, it doesn't seem like a hashmap would be a good fit for this use case.self.entries@@ -5514,7 +5515,7 @@ impl AcpThread {})}- pub fn tool_call(&self, id: &acp_v1::ToolCallId) -> Option<(usize, &ToolCall)> {+ pub fn tool_call(&self, id: &acp_v2::ToolCallId) -> Option<(usize, &ToolCall)> {self.entries.iter().enumerate()@@ -5530,7 +5531,7 @@ impl AcpThread {})}- pub fn tool_call_for_subagent(&self, session_id: &acp_v1::SessionId) -> Option<&ToolCall> {+ pub fn tool_call_for_subagent(&self, session_id: &acp_v2::SessionId) -> Option<&ToolCall> {self.entries.iter().find_map(|entry| match entry {AgentThreadEntry::ToolCall(tool_call) => {if let Some(subagent_session_info) = &tool_call.subagent_session_info@@ -5545,7 +5546,7 @@ impl AcpThread {})}- pub fn resolve_locations(&mut self, id: acp_v1::ToolCallId, cx: &mut Context<Self>) {+ pub fn resolve_locations(&mut self, id: acp_v2::ToolCallId, cx: &mut Context<Self>) {let project = self.project.clone();let should_update_agent_location = self.parent_session_id.is_none();let Some((_, tool_call)) = self.tool_call_mut(&id) else {@@ -5616,7 +5617,7 @@ impl AcpThread {pub fn permission_request_for_tool(&self,- tool_call_id: &acp_v1::ToolCallId,+ tool_call_id: &acp_v2::ToolCallId,) -> Option<&PermissionRequest> {let (_, call) = self.tool_call(tool_call_id)?;self.permission_request(call.authorization_id()?)@@ -5632,7 +5633,7 @@ impl AcpThread {cx: &mut Context<Self>,) -> Result<(PermissionRequestId, Task<acp_v2::RequestPermissionOutcome>)> {anyhow::ensure!(- acp_v1::SessionId::new(request.session_id.0.clone()) == self.session_info.session_id,+ request.session_id == self.session_info.session_id,"Permission request belongs to a different session");anyhow::ensure!(@@ -5728,15 +5729,15 @@ impl AcpThread {) -> Result<(PermissionRequestId, Task<RequestPermissionOutcome>)> {let (tx, rx) = oneshot::channel();+ let tool_call_id = acp_v2::ToolCallId::new(tool_call.tool_call_id.0.clone());let current_status = self- .tool_call(&tool_call.tool_call_id)+ .tool_call(&tool_call_id).and_then(|(_, tool_call)| tool_call.permission_status()).or(tool_call.fields.status).and_then(tool_status_from_v1);let current_status = ToolCallStatus::from_reported(current_status.as_ref()).unwrap_or(ToolCallStatus::Pending);- let tool_call_id = tool_call.tool_call_id.clone();self.upsert_tool_call_inner(tool_call, Some(current_status), cx)?;if let Some(id) = self.tool_call(&tool_call_id)@@ -5775,7 +5776,7 @@ impl AcpThread {pub fn cancel_tool_call_authorization(&mut self,- id: &acp_v1::ToolCallId,+ id: &acp_v2::ToolCallId,cx: &mut Context<Self>,) {let Some(request_id) = self@@ -5811,7 +5812,7 @@ impl AcpThread {pub fn authorize_tool_call(&mut self,- id: acp_v1::ToolCallId,+ id: acp_v2::ToolCallId,outcome: SelectedPermissionOutcome,cx: &mut Context<Self>,) {@@ -6162,10 +6163,7 @@ impl AcpThread {push_user_message: bool,cx: &mut Context<Self>,) -> Submission {- let request = acp_v2::PromptRequest::new(- acp_v2::SessionId::new(self.session_id().0.clone()),- message,- );+ let request = acp_v2::PromptRequest::new(self.session_id().clone(), message);if let Err(error) = self.validate_prompt_content(&request.prompt) {return self.track_submission(id, cx, async move |_, _| Err(error));}@@ -9583,7 +9581,7 @@ mod tests {let thread = new_test_thread(cx).await;let terminal_id = acp_v2::TerminalId::new("shared-terminal");let lookup_id = acp_v1::TerminalId::new("shared-terminal");- let tool_id = acp_v1::ToolCallId::new("terminal-tool");+ let tool_id = acp_v2::ToolCallId::new("terminal-tool");let reference = acp_v2::ToolCallUpdate::new("terminal-tool").title("Tool caption").kind(acp_v2::ToolKind::Execute)@@ -9659,7 +9657,7 @@ mod tests {.update(cx, |thread, cx| {thread.update_tool_call(acp_v1::ToolCallUpdate::new(- tool_id.clone(),+ acp_v1::ToolCallId::new(tool_id.0.clone()),acp_v1::ToolCallUpdateFields::new().title("Legacy caption"),),cx,@@ -9684,7 +9682,7 @@ mod tests {)?;thread.update_tool_call(acp_v1::ToolCallUpdate::new(- tool_id,+ acp_v1::ToolCallId::new(tool_id.0),acp_v1::ToolCallUpdateFields::new().title("Another legacy caption"),),cx,@@ -10963,7 +10961,7 @@ mod tests {1);- let tool_call_id = acp_v1::ToolCallId::new("unrelated-permission");+ let tool_call_id = acp_v2::ToolCallId::new("unrelated-permission");let permission = request_test_permission(&thread, tool_call_id.clone(), cx);let cancelled = Rc::new(std::cell::Cell::new(false));cx.update(|cx| {@@ -11209,7 +11207,7 @@ mod tests {};assert_eq!(user.identity, MessageIdentity::Keyed("user".into()));assert_eq!(user.content.source_blocks(), &["new question".into()]);- assert_eq!(tool.id, acp_v1::ToolCallId::new("tool"));+ assert_eq!(tool.id, acp_v2::ToolCallId::new("tool"));let [AssistantMessageChunk::Message {identity, block, ..@@ -12550,7 +12548,7 @@ mod tests {let fs = FakeFs::new(cx.executor());let project = Project::test(fs, [], cx).await;- let id = acp_v1::ToolCallId::new("test");+ let id = acp_v2::ToolCallId::new("test");let connection = Rc::new(FakeAgentConnection::new().on_user_message({let id = id.clone();@@ -12561,9 +12559,12 @@ mod tests {.update(&mut cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(id.clone(), "Label")- .kind(acp_v1::ToolKind::Fetch)- .status(acp_v1::ToolCallStatus::InProgress),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(id.0.clone()),+ "Label",+ )+ .kind(acp_v1::ToolKind::Fetch)+ .status(acp_v1::ToolCallStatus::InProgress),),cx,)@@ -12609,7 +12610,7 @@ mod tests {.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- id,+ acp_v1::ToolCallId::new(id.0),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed),)),@@ -13164,6 +13165,124 @@ mod tests {});}+ #[test]+ fn test_legacy_tool_update_id_shares_backing_arc() {+ for value in ["", "tool/ \0 雪 😀"] {+ let backing: Arc<str> = value.into();+ let wire_id = acp_v1::ToolCallId::new(backing.clone());+ let update = ToolCallUpdate::from(acp_v1::ToolCallUpdate::new(+ wire_id.clone(),+ acp_v1::ToolCallUpdateFields::new(),+ ));+ let id = update.id();+ assert_eq!(id, acp_v2::ToolCallId::new(value));+ assert!(Arc::ptr_eq(&id.0, &backing));+ assert_eq!(+ serde_json::to_value(&id).expect("canonical ID"),+ serde_json::to_value(&wire_id).expect("wire ID"),+ );+ }+ }++ #[test]+ fn test_subagent_session_info_preserves_legacy_serialization() {+ for value in ["", "session/ \0 雪 😀"] {+ for message_end_index in [None, Some(7)] {+ let wire_id = acp_v1::SessionId::new(value);+ let mut wire = json!({+ "session_id": wire_id,+ "message_start_index": 3,+ });+ if let Some(message_end_index) = message_end_index {+ wire["message_end_index"] = json!(message_end_index);+ }+ let info: SubagentSessionInfo =+ serde_json::from_value(wire.clone()).expect("legacy session metadata");+ assert_eq!(info.session_id, acp_v2::SessionId::new(value));+ assert_eq!(info.message_start_index, 3);+ assert_eq!(info.message_end_index, message_end_index);+ assert_eq!(serde_json::to_value(info).expect("session metadata"), wire);+ }+ }+ }++ #[gpui::test]+ async fn test_tool_ids_preserve_identity_across_legacy_and_v2_updates(cx: &mut TestAppContext) {+ init_test(cx);+ for value in ["", "tool/ \0 雪 😀"] {+ let thread = new_test_thread(cx).await;+ let backing: Arc<str> = value.into();+ let id = acp_v2::ToolCallId::new(backing.clone());+ let wire_id = acp_v1::ToolCallId::new(backing.clone());+ thread.update(cx, |thread, cx| {+ thread+ .upsert_tool_call(+ acp_v1::ToolCall::new(wire_id.clone(), "Legacy tool")+ .raw_input(json!({"retain": true})),+ cx,+ )+ .expect("legacy tool");+ let (_, call) = thread.tool_call(&id).expect("canonical tool");+ assert!(Arc::ptr_eq(&call.id.0, &backing));++ thread+ .upsert_tool_call_patch(+ acp_v2::ToolCallUpdate::new(acp_v2::ToolCallId::new(value))+ .title("V2 patch"),+ cx,+ )+ .expect("v2 patch targets legacy tool");+ thread+ .append_tool_call_content_chunk(+ acp_v2::ToolCallContentChunk::new(acp_v2::ToolCallId::new(value), "chunk"),+ cx,+ )+ .expect("v2 chunk targets legacy tool");+ thread+ .update_tool_call(+ acp_v1::ToolCallUpdate::new(+ wire_id.clone(),+ acp_v1::ToolCallUpdateFields::new().title("Legacy patch"),+ ),+ cx,+ )+ .expect("legacy patch targets canonical tool");++ assert_eq!(thread.entries().len(), 1);+ let (_, call) = thread.tool_call(&id).expect("same canonical tool");+ assert_eq!(call.id, id);+ assert!(Arc::ptr_eq(&call.id.0, &backing));+ assert_eq!(call.title.as_deref(), Some("Legacy patch"));+ assert_eq!(call.raw_input, Some(json!({"retain": true})));+ assert_eq!(call.content().len(), 1);+ assert_eq!(+ call.content()+ .first()+ .and_then(ToolCallContent::markdown)+ .expect("chunk markdown")+ .read(cx)+ .source(),+ "chunk",+ );+ });++ let (request_id, response) = request_test_permission_with_id(&thread, id.clone(), cx);+ thread.update(cx, |thread, cx| {+ let permission_id = thread+ .permission_request(request_id)+ .and_then(PermissionRequest::legacy_tool_call_id)+ .expect("legacy permission has canonical tool identity");+ assert_eq!(permission_id, &id);+ assert!(Arc::ptr_eq(&permission_id.0, &backing));+ thread.cancel_tool_call_authorization(&id, cx);+ });+ assert!(matches!(+ response.await,+ RequestPermissionOutcome::Cancelled+ ));+ }+ }+#[test]fn test_legacy_tool_enum_translations_preserve_known_values() {for kind in [@@ -13203,7 +13322,7 @@ mod tests {init_test(cx);let thread = new_test_thread(cx).await;thread.update(cx, |thread, cx| {- let id = acp_v1::ToolCallId::new("kept");+ let id = acp_v2::ToolCallId::new("kept");thread.upsert_tool_call_patch(acp_v2::ToolCallUpdate::new("kept")@@ -13217,7 +13336,7 @@ mod tests {thread.upsert_tool_call_inner(acp_v1::ToolCallUpdate::new(- id.clone(),+ acp_v1::ToolCallId::new(id.0.clone()),acp_v1::ToolCallUpdateFields::new().title("updated title"),),None,@@ -13236,7 +13355,7 @@ mod tests {thread.update_tool_call(acp_v1::ToolCallUpdate::new(- id,+ acp_v1::ToolCallId::new(id.0),acp_v1::ToolCallUpdateFields::new().kind(acp_v1::ToolKind::Other),),cx,@@ -13257,7 +13376,7 @@ mod tests {assert_eq!(empty.kind(), &acp_v2::ToolKind::Other);assert_eq!(empty.status(), ToolCallStatus::Pending);let (_, call) = thread- .tool_call(&acp_v1::ToolCallId::new("kept"))+ .tool_call(&acp_v2::ToolCallId::new("kept")).expect("tool");assert_eq!(call.reported_kind, Some(acp_v2::ToolKind::Other));assert_eq!(call.status(), ToolCallStatus::Completed);@@ -13271,7 +13390,7 @@ mod tests {init_test(cx);let thread = new_test_thread(cx).await;thread.update(cx, |thread, cx| {- let id = acp_v1::ToolCallId::new("patch");+ let id = acp_v2::ToolCallId::new("patch");thread.upsert_tool_call_patch(acp_v2::ToolCallUpdate::new("patch"), cx).expect("ID-only upsert");@@ -13421,8 +13540,8 @@ mod tests {})});thread.update(cx, |thread, cx| {- let first_id = acp_v1::ToolCallId::new("first");- let second_id = acp_v1::ToolCallId::new("first-extra");+ let first_id = acp_v2::ToolCallId::new("first");+ let second_id = acp_v2::ToolCallId::new("first-extra");thread.append_tool_call_content_chunk(acp_v2::ToolCallContentChunk::new("first", "original")@@ -13523,12 +13642,12 @@ mod tests {async fn test_tool_content_chunk_preserves_existing_state(cx: &mut TestAppContext) {init_test(cx);let thread = new_test_thread(cx).await;- let id = acp_v1::ToolCallId::new("native");+ let id = acp_v2::ToolCallId::new("native");let tool_meta = meta_with_tool_name("tool_name");let (request_id, mut permission) = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization_with_id(- acp_v1::ToolCall::new(id.clone(), "Original")+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(id.0.clone()), "Original").status(acp_v1::ToolCallStatus::Completed).meta(tool_meta.clone()).into(),@@ -13604,7 +13723,7 @@ mod tests {init_test(cx);let thread = new_test_thread(cx).await;thread.update(cx, |thread, cx| {- let id = acp_v1::ToolCallId::new("metadata");+ let id = acp_v2::ToolCallId::new("metadata");let meta = acp_v1::Meta::from_iter([(TOOL_NAME_META_KEY.into(), json!("legacy_name")),(@@ -13614,7 +13733,11 @@ mod tests {("opaque".into(), json!({"keep": ["all", "values"]})),]);thread- .upsert_tool_call(acp_v1::ToolCall::new(id.clone(), "").meta(meta.clone()), cx)+ .upsert_tool_call(+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(id.0.clone()), "")+ .meta(meta.clone()),+ cx,+ ).expect("legacy creation");let (_, call) = thread.tool_call(&id).expect("tool");assert_eq!(call.name, None);@@ -13625,8 +13748,11 @@ mod tests {let newer_meta = acp_v1::Meta::from_iter([("opaque".into(), json!({"new": true}))]);thread.update_tool_call(- acp_v1::ToolCallUpdate::new(id.clone(), acp_v1::ToolCallUpdateFields::new())- .meta(newer_meta.clone()),+ acp_v1::ToolCallUpdate::new(+ acp_v1::ToolCallId::new(id.0.clone()),+ acp_v1::ToolCallUpdateFields::new(),+ )+ .meta(newer_meta.clone()),cx,).expect("legacy metadata update");@@ -13677,11 +13803,12 @@ mod tests {) {init_test(cx);let thread = new_test_thread(cx).await;- let id = acp_v1::ToolCallId::new("permission");+ let id = acp_v2::ToolCallId::new("permission");let permission = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCall::new(id.clone(), "Authorize").into(),+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(id.0.clone()), "Authorize")+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new("allow","Allow",@@ -13753,7 +13880,10 @@ mod tests {let permission = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCallUpdate::new(id.clone(), acp_v1::ToolCallUpdateFields::new()),+ acp_v1::ToolCallUpdate::new(+ acp_v1::ToolCallId::new(id.0.clone()),+ acp_v1::ToolCallUpdateFields::new(),+ ),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new("allow","Allow",@@ -13839,11 +13969,12 @@ mod tests {),] {let thread = new_test_thread(cx).await;- let id = acp_v1::ToolCallId::new("continuation");+ let id = acp_v2::ToolCallId::new("continuation");thread.update(cx, |thread, cx| {thread.upsert_tool_call(- acp_v1::ToolCall::new(id.clone(), "Original").status(initial),+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(id.0.clone()), "Original")+ .status(initial),cx,).expect("initial tool");@@ -13857,7 +13988,7 @@ mod tests {.update(cx, |thread, cx| {thread.request_tool_call_authorization(acp_v1::ToolCallUpdate::new(- id.clone(),+ acp_v1::ToolCallId::new(id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(incoming),),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(@@ -13927,7 +14058,7 @@ mod tests {}).await.expect("session");- let id = acp_v1::ToolCallId::new("locations");+ let id = acp_v2::ToolCallId::new("locations");thread.update(cx, |thread, cx| {thread.upsert_tool_call_patch(serde_json::from_value(json!({@@ -14348,7 +14479,7 @@ mod tests {thread.read_with(cx, |thread, _| {let Some(tool_call) = thread.entries.iter().find_map(|entry| match entry {AgentThreadEntry::ToolCall(tool_call)- if tool_call.id == acp_v1::ToolCallId::new("tool-call") =>+ if tool_call.id == acp_v2::ToolCallId::new("tool-call") =>{Some(tool_call)}@@ -14377,7 +14508,7 @@ mod tests {thread.read_with(cx, |thread, _| {let Some(tool_call) = thread.entries.iter().find_map(|entry| match entry {AgentThreadEntry::ToolCall(tool_call)- if tool_call.id == acp_v1::ToolCallId::new("legacy-tool-call") =>+ if tool_call.id == acp_v2::ToolCallId::new("legacy-tool-call") =>{Some(tool_call)}@@ -14609,9 +14740,9 @@ mod tests {) {init_test(cx);let thread = new_test_thread(cx).await;- let id = acp_v1::ToolCallId::new("tool");+ let id = acp_v2::ToolCallId::new("tool");let terminal_id = acp_v1::TerminalId::new("terminal");- let initial = acp_v1::ToolCall::new(id.clone(), "Tool caption")+ let initial = acp_v1::ToolCall::new(acp_v1::ToolCallId::new(id.0.clone()), "Tool caption").kind(acp_v1::ToolKind::Execute).content(vec![acp_v1::ToolCallContent::Terminal(acp_v1::Terminal::new(terminal_id.clone()),@@ -14654,7 +14785,7 @@ mod tests {thread.update_tool_call(acp_v1::ToolCallUpdate::new(- id.clone(),+ acp_v1::ToolCallId::new(id.0.clone()),acp_v1::ToolCallUpdateFields::new().title("changed command").content(vec![@@ -14678,7 +14809,7 @@ mod tests {thread.update_tool_call(acp_v1::ToolCallUpdate::new(- id.clone(),+ acp_v1::ToolCallId::new(id.0.clone()),acp_v1::ToolCallUpdateFields::new().title("changed command").content(vec![acp_v1::ToolCallContent::Terminal(@@ -14708,17 +14839,20 @@ mod tests {(true, acp_v1::ToolCallStatus::Completed),] {let thread = new_test_thread(cx).await;- let id = acp_v1::ToolCallId::new("atomic-tool");+ let id = acp_v2::ToolCallId::new("atomic-tool");let (request_id, permission) = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization_with_id(- acp_v1::ToolCall::new(id.clone(), "Original title")- .name("original-tool")- .kind(acp_v1::ToolKind::Read)- .content(vec!["original output".into()])- .raw_input(json!({"original": true}))- .raw_output(json!("original raw"))- .into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(id.0.clone()),+ "Original title",+ )+ .name("original-tool")+ .kind(acp_v1::ToolKind::Read)+ .content(vec!["original output".into()])+ .raw_input(json!({"original": true}))+ .raw_output(json!("original raw"))+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new("allow","Allow",@@ -14739,7 +14873,7 @@ mod tests {_ => panic!("text content"),};let update = acp_v1::ToolCallUpdate::new(- id.clone(),+ acp_v1::ToolCallId::new(id.0.clone()),acp_v1::ToolCallUpdateFields::new().title("Changed title").name("changed-tool")@@ -14816,7 +14950,7 @@ mod tests {thread.update_tool_call(acp_v1::ToolCallUpdate::new(- id.clone(),+ acp_v1::ToolCallId::new(id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed).content(vec!["corrected output".into()]),@@ -14847,16 +14981,19 @@ mod tests {.await.unwrap();- let tool_call_id = acp_v1::ToolCallId::new("toolu_01duplicate");+ let tool_call_id = acp_v2::ToolCallId::new("toolu_01duplicate");let allow_option_id = acp_v1::PermissionOptionId::new("allow");let permission_task = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCall::new(tool_call_id.clone(), "Original title")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::Pending)- .content(vec!["original content".into()])- .into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Original title",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::Pending)+ .content(vec!["original content".into()])+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(allow_option_id.clone(),"Allow",@@ -14872,10 +15009,13 @@ mod tests {.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_call_id.clone(), "Updated title")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::Pending)- .content(vec!["updated content".into()]),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Updated title",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::Pending)+ .content(vec!["updated content".into()]),),cx,)@@ -14899,7 +15039,7 @@ mod tests {.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::InProgress).title("Updated again")@@ -14953,7 +15093,7 @@ mod tests {.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed).title("Completed")@@ -14989,14 +15129,17 @@ mod tests {.await.unwrap();- let tool_call_id = acp_v1::ToolCallId::new("toolu_01auto_resolve");+ let tool_call_id = acp_v2::ToolCallId::new("toolu_01auto_resolve");let permission_task = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCall::new(tool_call_id.clone(), "Original title")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::Pending)- .into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Original title",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::Pending)+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(acp_v1::PermissionOptionId::new("allow"),"Allow",@@ -15012,7 +15155,7 @@ mod tests {.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::InProgress),)),@@ -15078,14 +15221,17 @@ mod tests {.await.unwrap();- let tool_call_id = acp_v1::ToolCallId::new("toolu_01existing_permission");+ let tool_call_id = acp_v2::ToolCallId::new("toolu_01existing_permission");thread.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_call_id.clone(), "Running title")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::InProgress),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Running title",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::InProgress),),cx,)@@ -15095,10 +15241,13 @@ mod tests {let permission_task = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCall::new(tool_call_id.clone(), "Needs permission")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::Pending)- .into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Needs permission",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::Pending)+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(acp_v1::PermissionOptionId::new("allow"),"Allow",@@ -15161,14 +15310,17 @@ mod tests {.await.unwrap();- let tool_call_id = acp_v1::ToolCallId::new("toolu_01cancelled_permission");+ let tool_call_id = acp_v2::ToolCallId::new("toolu_01cancelled_permission");let permission_task = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCall::new(tool_call_id.clone(), "Needs permission")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::Pending)- .into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Needs permission",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::Pending)+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(acp_v1::PermissionOptionId::new("allow"),"Allow",@@ -15216,14 +15368,17 @@ mod tests {.await.unwrap();- let tool_call_id = acp_v1::ToolCallId::new("toolu_01completed_while_waiting");+ let tool_call_id = acp_v2::ToolCallId::new("toolu_01completed_while_waiting");let permission_task = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp_v1::ToolCall::new(tool_call_id.clone(), "Needs permission")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::Pending)- .into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Needs permission",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::Pending)+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(acp_v1::PermissionOptionId::new("allow"),"Allow",@@ -15239,7 +15394,7 @@ mod tests {.update(cx, |thread, cx| {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed),)),@@ -15679,7 +15834,7 @@ mod tests {}).await.unwrap();- let subagent_session_id = acp_v1::SessionId::new("subagent");+ let subagent_session_id = acp_v2::SessionId::new("subagent");let subagent = cx.update(|cx| {let action_log = cx.new(|_| ActionLog::new(project.clone()));cx.new(|cx| {@@ -16045,7 +16200,7 @@ mod tests {thread.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(session_id.0)),+ acp_v2::ElicitationSessionScope::new(session_id),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -16076,10 +16231,8 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0.clone(),- ))- .tool_call_id(tool_call_id.clone()),+ acp_v2::ElicitationSessionScope::new(session_id.clone())+ .tool_call_id(tool_call_id.clone()),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -16140,9 +16293,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),url_elicitation_id.clone(),"https://example.com/complete",),@@ -16207,9 +16358,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),url_elicitation_id.clone(),"https://example.com/complete",),@@ -16273,9 +16422,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),url_elicitation_id.clone(),"https://example.com/complete",),@@ -16382,9 +16529,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),url_elicitation_id.clone(),"https://example.com/complete",),@@ -16600,9 +16745,7 @@ mod tests {.request_elicitation_with_id(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -16640,9 +16783,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -17266,9 +17407,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -17316,9 +17455,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -17378,9 +17515,7 @@ mod tests {thread.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0.clone(),- )),+ acp_v2::ElicitationSessionScope::new(session_id.clone()),"url-1",invalid_url,),@@ -17409,7 +17544,7 @@ mod tests {acp_v2::CreateElicitationRequest::new(acp_v2::OtherElicitationMode::new("future",- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(session_id.0)),+ acp_v2::ElicitationSessionScope::new(session_id),std::collections::BTreeMap::new(),),"Use a future input mode",@@ -17482,7 +17617,7 @@ mod tests {struct FakeAgentConnection {auth_methods: Vec<acp_v2::AuthMethod>,supports_truncate: bool,- sessions: Arc<parking_lot::Mutex<HashMap<acp_v1::SessionId, WeakEntity<AcpThread>>>>,+ sessions: Arc<parking_lot::Mutex<HashMap<acp_v2::SessionId, WeakEntity<AcpThread>>>>,set_title_calls: Rc<RefCell<Vec<SharedString>>>,on_user_message: Option<Rc<@@ -17552,7 +17687,7 @@ mod tests {work_dirs: PathList,cx: &mut App,) -> Task<gpui::Result<Entity<AcpThread>>> {- let session_id = acp_v1::SessionId::new(+ let session_id = acp_v2::SessionId::new(rand::rng().sample_iter(&distr::Alphanumeric).take(7)@@ -17604,8 +17739,7 @@ mod tests {cx: &mut App,) -> Task<gpui::Result<acp_v1::PromptResponse>> {let sessions = self.sessions.lock();- let session_id = acp_v1::SessionId::new(params.session_id.0.clone());- let thread = sessions.get(&session_id).unwrap();+ let thread = sessions.get(¶ms.session_id).unwrap();if let Some(handler) = &self.on_user_message {let handler = handler.clone();let thread = thread.clone();@@ -17626,11 +17760,11 @@ mod tests {})}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn truncate(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionTruncate>> {self.supports_truncate.then(|| {@@ -17642,7 +17776,7 @@ mod tests {fn set_title(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionSetTitle>> {Some(Rc::new(FakeAgentSessionSetTitle {@@ -17667,7 +17801,7 @@ mod tests {}struct FakeAgentSessionEditor {- _session_id: acp_v1::SessionId,+ _session_id: acp_v2::SessionId,}impl AgentSessionTruncate for FakeAgentSessionEditor {@@ -17710,11 +17844,11 @@ mod tests {.unwrap();// Try to update a tool call that doesn't exist- let nonexistent_id = acp_v1::ToolCallId::new("nonexistent-tool-call");+ let nonexistent_id = acp_v2::ToolCallId::new("nonexistent-tool-call");thread.update(cx, |thread, cx| {let result = thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- nonexistent_id.clone(),+ acp_v1::ToolCallId::new(nonexistent_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed),)),cx,@@ -18278,7 +18412,7 @@ mod tests {// This calls cancel() which takes turn 1's running_turn and sets turn 2'slet second_request = thread.update(cx, |thread, cx| thread.send_raw("second", cx));thread.read_with(cx, |thread, _| {- let tool_id = acp_v1::ToolCallId::new("permission");+ let tool_id = acp_v2::ToolCallId::new("permission");assert!(thread.permission_request(permission_id).is_none());assert!(thread.permission_request_for_tool(&tool_id).is_none());assert_eq!(thread.pending_permission_requests().count(), 0);@@ -19438,7 +19572,7 @@ mod tests {connection,project,action_log,- acp_v1::SessionId::new("subagent"),+ acp_v2::SessionId::new("subagent"),watch::Receiver::constant(acp_v2::PromptCapabilities::new()),cx,)@@ -19772,8 +19906,8 @@ mod tests {cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 1);- let first_id = acp_v1::ToolCallId::new("first-permission");- let second_id = acp_v1::ToolCallId::new("second-permission");+ let first_id = acp_v2::ToolCallId::new("first-permission");+ let second_id = acp_v2::ToolCallId::new("second-permission");let first_permission = request_test_permission(&thread, first_id.clone(), cx);assert_eq!(cx.active_idle_sleep_preventions(), 0);let second_permission = request_test_permission(&thread, second_id.clone(), cx);@@ -19790,7 +19924,7 @@ mod tests {thread.update_tool_call(acp_v1::ToolCallUpdate::new(- first_id.clone(),+ acp_v1::ToolCallId::new(first_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::InProgress),),@@ -19869,7 +20003,7 @@ mod tests {let (complete, request) = start_test_turn(&thread, cx);cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 1);- let tool_call_id = acp_v1::ToolCallId::new("permission");+ let tool_call_id = acp_v2::ToolCallId::new("permission");let permission = request_test_permission(&thread, tool_call_id.clone(), cx);cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 0);@@ -19879,7 +20013,7 @@ mod tests {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_call_id,+ acp_v1::ToolCallId::new(tool_call_id.0),acp_v1::ToolCallUpdateFields::new().status(status),)),cx,@@ -19913,7 +20047,7 @@ mod tests {let (complete, request) = start_test_turn(&thread, cx);cx.run_until_parked();cx.executor().advance_clock(Duration::from_secs(1));- let tool_call_id = acp_v1::ToolCallId::new("permission");+ let tool_call_id = acp_v2::ToolCallId::new("permission");let permission = request_test_permission(&thread, tool_call_id.clone(), cx);cx.run_until_parked();cx.executor().advance_clock(Duration::from_secs(1));@@ -20061,9 +20195,7 @@ mod tests {.request_elicitation_with_id(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- thread.session_id().0.clone(),- )),+ acp_v2::ElicitationSessionScope::new(thread.session_id().clone()),url_id.clone(),"https://example.com/complete",),@@ -20125,7 +20257,7 @@ mod tests {let (complete, request) = start_test_turn(&thread, cx);cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 1);- let tool_call_id = acp_v1::ToolCallId::new("permission");+ let tool_call_id = acp_v2::ToolCallId::new("permission");let (permission_id, permission) =request_test_permission_with_id(&thread, tool_call_id.clone(), cx);let (elicitation_id, elicitation_response) = request_test_form_elicitation(&thread, cx);@@ -20410,8 +20542,8 @@ mod tests {let (complete, request) = start_test_turn(&thread, cx);cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 1);- let first_id = acp_v1::ToolCallId::new("first");- let second_id = acp_v1::ToolCallId::new("second");+ let first_id = acp_v2::ToolCallId::new("first");+ let second_id = acp_v2::ToolCallId::new("second");let first_permission = request_test_permission(&thread, first_id.clone(), cx);let second_permission = request_test_permission(&thread, second_id.clone(), cx);assert_eq!(cx.active_idle_sleep_preventions(), 0);@@ -20496,14 +20628,14 @@ mod tests {acp_v1::ToolCallStatus::Completed,] {let thread = new_test_thread(cx).await;- let tool_id = acp_v1::ToolCallId::new("replacement");+ let tool_id = acp_v2::ToolCallId::new("replacement");let (events, _subscription) = track_permission_events(&thread, cx);let (old_id, old_response) =request_test_permission_with_id(&thread, tool_id.clone(), cx);let result = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization_with_id(acp_v1::ToolCallUpdate::new(- tool_id.clone(),+ acp_v1::ToolCallId::new(tool_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(status).title("Must not replace presentation")@@ -20590,15 +20722,18 @@ mod tests {) {init_test(cx);let thread = new_test_thread(cx).await;- let tool_id = acp_v1::ToolCallId::new("idle-permission");- let unrelated_id = acp_v1::ToolCallId::new("unrelated");+ let tool_id = acp_v2::ToolCallId::new("idle-permission");+ let unrelated_id = acp_v2::ToolCallId::new("unrelated");let (events, _subscription) = track_permission_events(&thread, cx);thread.update(cx, |thread, cx| {assert!(thread.running_turn.is_none());thread.upsert_tool_call(- acp_v1::ToolCall::new(unrelated_id.clone(), "Unrelated work")- .status(acp_v1::ToolCallStatus::InProgress),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(unrelated_id.0.clone()),+ "Unrelated work",+ )+ .status(acp_v1::ToolCallStatus::InProgress),cx,).expect("unrelated tool");@@ -20643,8 +20778,8 @@ mod tests {cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 1);let (events, _subscription) = track_permission_events(&thread, cx);- let first_tool = acp_v1::ToolCallId::new("first");- let second_tool = acp_v1::ToolCallId::new("second");+ let first_tool = acp_v2::ToolCallId::new("first");+ let second_tool = acp_v2::ToolCallId::new("second");let (first_id, first_response) =request_test_permission_with_id(&thread, first_tool.clone(), cx);let (second_id, second_response) =@@ -20742,7 +20877,7 @@ mod tests {init_test(cx);let thread = new_test_thread(cx).await;let (events, _subscription) = track_permission_events(&thread, cx);- let tool_id = acp_v1::ToolCallId::new("reused");+ let tool_id = acp_v2::ToolCallId::new("reused");let (old_id, old_response) = request_test_permission_with_id(&thread, tool_id.clone(), cx);let (new_id, new_response) = request_test_permission_with_id(&thread, tool_id.clone(), cx);assert_ne!(old_id, new_id);@@ -20933,11 +21068,15 @@ mod tests {selected_outcome.option_kind = spoofed_kind;let thread = new_test_thread(cx).await;let (events, _subscription) = track_permission_events(&thread, cx);- let tool_id = acp_v1::ToolCallId::new("choice");+ let tool_id = acp_v2::ToolCallId::new("choice");let (request_id, response) = thread.update(cx, |thread, cx| {thread.request_tool_call_authorization_with_id(- acp_v1::ToolCall::new(tool_id.clone(), "Choose").into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_id.0.clone()),+ "Choose",+ )+ .into(),options,kind,cx,@@ -20998,14 +21137,14 @@ mod tests {thread.push_user_content_block(None, "retained".into(), cx);});let refusal_turn = refuse_prompt.then(|| start_test_turn(&thread, cx));- let retained_tool = acp_v1::ToolCallId::new("retained");+ let retained_tool = acp_v2::ToolCallId::new("retained");let (retained_id, retained_response) =request_test_permission_with_id(&thread, retained_tool.clone(), cx);let client_id = ClientUserMessageId::new();thread.update(cx, |thread, cx| {thread.push_user_content_block(Some(client_id.clone()), "remove me".into(), cx);});- let removed_tool = acp_v1::ToolCallId::new("reused");+ let removed_tool = acp_v2::ToolCallId::new("reused");let (removed_id, removed_response) =request_test_permission_with_id(&thread, removed_tool.clone(), cx);if let Some((complete, turn)) = refusal_turn {@@ -21260,7 +21399,7 @@ mod tests {) {init_test(cx);let thread = new_test_thread(cx).await;- let tool_id = acp_v1::ToolCallId::new("shared-tool");+ let tool_id = acp_v2::ToolCallId::new("shared-tool");let (legacy_id, legacy_response) =request_test_permission_with_id(&thread, tool_id.clone(), cx);let (events, _subscription) = track_permission_events(&thread, cx);@@ -21727,7 +21866,7 @@ mod tests {option_id: &str,) -> acp_v2::RequestPermissionRequest {acp_v2::RequestPermissionRequest::new(- acp_v2::SessionId::new(thread.session_id().to_string()),+ thread.session_id().clone(),"Approve operation",vec![acp_v2::PermissionOption::new(@@ -21799,7 +21938,7 @@ mod tests {fn request_test_permission(thread: &Entity<AcpThread>,- tool_call_id: acp_v1::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,cx: &mut TestAppContext,) -> Task<RequestPermissionOutcome> {request_test_permission_with_id(thread, tool_call_id, cx).1@@ -21807,13 +21946,17 @@ mod tests {fn request_test_permission_with_id(thread: &Entity<AcpThread>,- tool_call_id: acp_v1::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,cx: &mut TestAppContext,) -> (PermissionRequestId, Task<RequestPermissionOutcome>) {thread.update(cx, |thread, cx| {thread.request_tool_call_authorization_with_id(- acp_v1::ToolCall::new(tool_call_id, "Needs permission").into(),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0),+ "Needs permission",+ )+ .into(),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(acp_v1::PermissionOptionId::new("allow"),@@ -21842,9 +21985,7 @@ mod tests {.request_elicitation_with_id(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- thread.session_id().0.clone(),- )),+ acp_v2::ElicitationSessionScope::new(thread.session_id().clone()),acp_v2::ElicitationSchema::new().string("name", false),),"Provide a name",@@ -21979,7 +22120,7 @@ mod tests {let (complete, request) = start_test_turn(&thread, cx);cx.run_until_parked();assert_eq!(cx.active_idle_sleep_preventions(), 1);- let tool_call_id = acp_v1::ToolCallId::new("permission");+ let tool_call_id = acp_v2::ToolCallId::new("permission");let (permission_id, permission) =request_test_permission_with_id(&thread, tool_call_id.clone(), cx);cx.run_until_parked();@@ -21988,7 +22129,7 @@ mod tests {thread.update(cx, |thread, cx| {let update = acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed).content(vec![acp_v1::ToolCallContent::Terminal(diff --git a/crates/acp_thread/src/connection.rs b/crates/acp_thread/src/connection.rsindex ec20734b03b..ddd2ad02ef5 100644--- a/crates/acp_thread/src/connection.rs+++ b/crates/acp_thread/src/connection.rs@@ -112,7 +112,7 @@ pub trait AgentConnection {/// Load an existing session by ID.fn load_session(self: Rc<Self>,- _session_id: acp_v1::SessionId,+ _session_id: acp_v2::SessionId,_project: Entity<Project>,_work_dirs: PathList,_title: Option<SharedString>,@@ -129,7 +129,7 @@ pub trait AgentConnection {/// Close an existing session. Allows the agent to free the session from memory.fn close_session(self: Rc<Self>,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &mut App,) -> Task<Result<()>> {Task::ready(Err(anyhow::Error::msg("Closing sessions is not supported")))@@ -143,7 +143,7 @@ pub trait AgentConnection {/// Resume an existing session by ID without replaying previous messages.fn resume_session(self: Rc<Self>,- _session_id: acp_v1::SessionId,+ _session_id: acp_v2::SessionId,_project: Entity<Project>,_work_dirs: PathList,_title: Option<SharedString>,@@ -194,7 +194,7 @@ pub trait AgentConnection {fn receipt_submissions(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn ReceiptSessionSubmissions>> {None@@ -216,13 +216,13 @@ pub trait AgentConnection {fn retry(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionRetry>> {None}- fn cancel(&self, session_id: &acp_v1::SessionId, cx: &mut App);+ fn cancel(&self, session_id: &acp_v2::SessionId, cx: &mut App);/// Request-scoped elicitations are connection-level because they can arrive before a session/// thread exists. Session-scoped elicitations stay in the thread timeline, but use@@ -233,7 +233,7 @@ pub trait AgentConnection {fn truncate(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionTruncate>> {None@@ -241,7 +241,7 @@ pub trait AgentConnection {fn set_title(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionSetTitle>> {None@@ -253,7 +253,7 @@ pub trait AgentConnection {/// This allows sharing the selector in UI components.fn model_selector(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,) -> Option<Rc<dyn AgentModelSelector>> {None}@@ -264,7 +264,7 @@ pub trait AgentConnection {fn session_modes(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionModes>> {None@@ -272,7 +272,7 @@ pub trait AgentConnection {fn session_config_options(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionConfigOptions>> {None@@ -331,7 +331,7 @@ pub trait AgentTelemetry {/// storage with telemetry events.fn thread_data(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &mut App,) -> Task<Result<serde_json::Value>>;}@@ -390,7 +390,7 @@ impl AgentSessionListResponse {#[derive(Debug, Clone, PartialEq)]pub struct AgentSessionInfo {- pub session_id: acp_v1::SessionId,+ pub session_id: acp_v2::SessionId,pub work_dirs: Option<PathList>,pub title: Option<SharedString>,pub updated_at: Option<DateTime<Utc>>,@@ -399,7 +399,7 @@ pub struct AgentSessionInfo {}impl AgentSessionInfo {- pub fn new(session_id: impl Into<acp_v1::SessionId>) -> Self {+ pub fn new(session_id: impl Into<acp_v2::SessionId>) -> Self {Self {session_id: session_id.into(),work_dirs: None,@@ -457,7 +457,7 @@ pub fn session_info_update_from_v1(update: acp_v1::SessionInfoUpdate) -> acp_v2:pub enum SessionListUpdate {Refresh,SessionInfo {- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,update: acp_v2::SessionInfoUpdate,},}@@ -473,7 +473,7 @@ pub trait AgentSessionList {false}- fn delete_session(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) -> Task<Result<()>> {+ fn delete_session(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) -> Task<Result<()>> {Task::ready(Err(anyhow::anyhow!("delete_session not supported")))}@@ -852,15 +852,15 @@ mod test_support {#[derive(Clone)]pub struct StubAgentConnection {- sessions: Arc<Mutex<HashMap<acp_v1::SessionId, Session>>>,- permission_requests: HashMap<acp_v1::ToolCallId, PermissionOptions>,+ sessions: Arc<Mutex<HashMap<acp_v2::SessionId, Session>>>,+ permission_requests: HashMap<acp_v2::ToolCallId, PermissionOptions>,next_prompt_updates: Arc<Mutex<Vec<acp_v1::SessionUpdate>>>,next_prompt_response: Arc<Mutex<Option<oneshot::Receiver<Result<acp_v1::PromptResponse>>>>>,next_receipt_response:Arc<Mutex<Option<oneshot::Receiver<Result<acp_v2::PromptResponse>>>>>,receipt_prompt: Arc<Mutex<Option<Vec<acp_v2::ContentBlock>>>>,next_truncate: Arc<Mutex<Option<oneshot::Receiver<()>>>>,- set_title_calls: Arc<Mutex<Vec<(acp_v1::SessionId, SharedString)>>>,+ set_title_calls: Arc<Mutex<Vec<(acp_v2::SessionId, SharedString)>>>,supports_receipt_submissions: bool,supports_retry: bool,supports_load_session: bool,@@ -938,7 +938,7 @@ mod test_support {self.receipt_prompt.lock().take()}- pub fn take_set_title_calls(&self) -> Vec<(acp_v1::SessionId, SharedString)> {+ pub fn take_set_title_calls(&self) -> Vec<(acp_v2::SessionId, SharedString)> {std::mem::take(&mut *self.set_title_calls.lock())}@@ -950,7 +950,7 @@ mod test_support {pub fn with_permission_requests(mut self,- permission_requests: HashMap<acp_v1::ToolCallId, PermissionOptions>,+ permission_requests: HashMap<acp_v2::ToolCallId, PermissionOptions>,) -> Self {self.permission_requests = permission_requests;self@@ -1004,7 +1004,7 @@ mod test_support {fn create_session(self: Rc<Self>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -1036,7 +1036,7 @@ mod test_support {pub fn send_update(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,update: acp_v1::SessionUpdate,cx: &mut App,) {@@ -1056,7 +1056,7 @@ mod test_support {.unwrap();}- pub fn end_turn(&self, session_id: acp_v1::SessionId, stop_reason: acp_v1::StopReason) {+ pub fn end_turn(&self, session_id: acp_v2::SessionId, stop_reason: acp_v1::StopReason) {self.sessions.lock().get_mut(&session_id)@@ -1084,7 +1084,7 @@ mod test_support {fn model_selector(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,) -> Option<Rc<dyn AgentModelSelector>> {Some(self.model_selector_impl())}@@ -1095,7 +1095,7 @@ mod test_support {work_dirs: PathList,cx: &mut gpui::App,) -> Task<gpui::Result<Entity<AcpThread>>> {- let session_id = acp_v1::SessionId::new(StubSessionCounter::next(cx).to_string());+ let session_id = acp_v2::SessionId::new(StubSessionCounter::next(cx).to_string());let thread = self.create_session(session_id, project, work_dirs, None, cx);Task::ready(Ok(thread))}@@ -1110,7 +1110,7 @@ mod test_support {fn load_session(self: Rc<Self>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -1141,15 +1141,15 @@ mod test_support {params: acp_v2::PromptRequest,cx: &mut App,) -> Task<gpui::Result<acp_v1::PromptResponse>> {- let params = match crate::content::prompt_to_v1(params) {- Ok(params) => params,- Err(error) => return Task::ready(Err(error)),- };+ let session_id = params.session_id.clone();+ if let Err(error) = crate::content::prompt_to_v1(params) {+ return Task::ready(Err(error));+ }let mut sessions = self.sessions.lock();let Session {thread,response_tx,- } = sessions.get_mut(¶ms.session_id).unwrap();+ } = sessions.get_mut(&session_id).unwrap();let mut tasks = vec![];if let Some(receiver) = self.next_prompt_response.lock().take() {cx.spawn(async move |_| receiver.await?)@@ -1166,7 +1166,9 @@ mod test_support {let update = update.clone();let permission_request = if let acp_v1::SessionUpdate::ToolCall(tool_call) =&update- && let Some(options) = self.permission_requests.get(&tool_call.tool_call_id)+ && let Some(options) = self+ .permission_requests+ .get(&acp_v2::ToolCallId::new(tool_call.tool_call_id.0.clone())){Some((tool_call.clone(), options.clone()))} else {@@ -1211,7 +1213,7 @@ mod test_support {fn receipt_submissions(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn ReceiptSessionSubmissions>> {self.supports_receipt_submissions.then(|| {@@ -1226,14 +1228,14 @@ mod test_support {fn retry(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionRetry>> {self.supports_retry.then(|| Rc::new(StubAgentSessionRetry) as Rc<dyn AgentSessionRetry>)}- fn cancel(&self, session_id: &acp_v1::SessionId, _cx: &mut App) {+ fn cancel(&self, session_id: &acp_v2::SessionId, _cx: &mut App) {if let Some(end_turn_tx) = self.sessions.lock()@@ -1248,7 +1250,7 @@ mod test_support {fn set_title(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionSetTitle>> {self.supports_set_title.then(|| {@@ -1261,7 +1263,7 @@ mod test_support {fn truncate(&self,- _session_id: &acp_v1::SessionId,+ _session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn AgentSessionTruncate>> {// Capability checks also call this; only run may consume the gate.@@ -1276,8 +1278,8 @@ mod test_support {}struct StubAgentSessionSetTitle {- session_id: acp_v1::SessionId,- calls: Arc<Mutex<Vec<(acp_v1::SessionId, SharedString)>>>,+ session_id: acp_v2::SessionId,+ calls: Arc<Mutex<Vec<(acp_v2::SessionId, SharedString)>>>,}impl AgentSessionSetTitle for StubAgentSessionSetTitle {@@ -1303,8 +1305,8 @@ mod test_support {}struct StubReceiptSessionSubmissions {- session_id: acp_v1::SessionId,- sessions: Arc<Mutex<HashMap<acp_v1::SessionId, Session>>>,+ session_id: acp_v2::SessionId,+ sessions: Arc<Mutex<HashMap<acp_v2::SessionId, Session>>>,next_receipt_response:Arc<Mutex<Option<oneshot::Receiver<Result<acp_v2::PromptResponse>>>>>,receipt_prompt: Arc<Mutex<Option<Vec<acp_v2::ContentBlock>>>>,@@ -1404,6 +1406,27 @@ pub use test_support::*;mod tests {use super::*;use serde_json::json;+ use std::sync::Arc;++ #[test]+ fn session_info_id_preserves_backing_arc_and_legacy_serialization() {+ for value in ["", "session/ \0 雪 😀"] {+ let backing: Arc<str> = value.into();+ let info = AgentSessionInfo::new(acp_v2::SessionId::new(backing.clone()));+ assert!(Arc::ptr_eq(&info.session_id.0, &backing));+ let wire_id = acp_v1::SessionId::new(backing);+ let serialized = serde_json::to_value(&info.session_id).expect("application ID");+ assert_eq!(serialized, json!(value));+ assert_eq!(+ serialized,+ serde_json::to_value(&wire_id).expect("legacy ID"),+ );+ let restored = AgentSessionInfo::new(+ serde_json::from_value::<acp_v2::SessionId>(serialized).expect("restored ID"),+ );+ assert_eq!(restored, info);+ }+ }#[test]fn session_info_patches_preserve_legacy_fields_and_apply_tristate_updates() {@@ -1416,7 +1439,7 @@ mod tests {json!({"nested": [1, {"value": "retained"}]}),)]);let original = AgentSessionInfo {- session_id: acp_v1::SessionId::new("opaque/session"),+ session_id: acp_v2::SessionId::new("opaque/session"),work_dirs: Some(PathList::new(&[std::path::Path::new("/workspace")])),title: Some("Original title".into()),updated_at: Some(updated_at),diff --git a/crates/acp_thread/src/elicitation.rs b/crates/acp_thread/src/elicitation.rsindex 8e023c18e8e..88054153ad3 100644--- a/crates/acp_thread/src/elicitation.rs+++ b/crates/acp_thread/src/elicitation.rs@@ -216,6 +216,33 @@ mod tests {use super::*;use serde_json::json;+ #[test]+ fn session_scope_ids_preserve_backing_arcs_and_legacy_serialization() -> Result<()> {+ for value in ["", "scope/ \0 雪 😀"] {+ let session_backing: std::sync::Arc<str> = value.into();+ let tool_backing: std::sync::Arc<str> = value.into();+ let legacy: v1::ElicitationScope =+ v1::ElicitationSessionScope::new(v1::SessionId::new(session_backing.clone()))+ .tool_call_id(v1::ToolCallId::new(tool_backing.clone()))+ .into();+ let wire = serde_json::to_value(&legacy)?;+ let converted = scope_from_v1(legacy)?;+ let v2::ElicitationScope::Session(scope) = &converted else {+ bail!("expected session scope");+ };+ assert_eq!(scope.session_id, v2::SessionId::new(value));+ assert!(std::sync::Arc::ptr_eq(+ &scope.session_id.0,+ &session_backing+ ));+ let tool_call_id = scope.tool_call_id.as_ref().expect("tool scope");+ assert_eq!(tool_call_id, &v2::ToolCallId::new(value));+ assert!(std::sync::Arc::ptr_eq(&tool_call_id.0, &tool_backing));+ assert_eq!(serde_json::to_value(converted)?, wire);+ }+ Ok(())+ }+#[test]fn elicitation_request_adapter_preserves_schema_scopes_and_extensions() -> Result<()> {let fixture = json!({diff --git a/crates/acp_thread/src/mention.rs b/crates/acp_thread/src/mention.rsindex f52e281212e..3fdd66a7315 100644--- a/crates/acp_thread/src/mention.rs+++ b/crates/acp_thread/src/mention.rs@@ -1,4 +1,4 @@-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use anyhow::{Context as _, Result, bail};use file_icons::FileIcons;use serde::{Deserialize, Serialize};@@ -864,6 +864,25 @@ mod tests {use super::*;+ #[test]+ fn thread_mention_preserves_legacy_id_serialization() {+ for value in ["", "session/ \0 雪 😀"] {+ let wire = serde_json::json!({+ "Thread": {+ "id": agent_client_protocol::schema::v1::SessionId::new(value),+ "name": "Thread",+ },+ });+ let mention: MentionUri =+ serde_json::from_value(wire.clone()).expect("legacy thread mention");+ let MentionUri::Thread { id, .. } = &mention else {+ panic!("thread mention");+ };+ assert_eq!(id, &acp::SessionId::new(value));+ assert_eq!(serde_json::to_value(mention).expect("thread mention"), wire);+ }+ }+#[test]fn test_parse_file_uri() {let file_uri = uri!("file:///path/to/file.rs");diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rsindex 3a50a19a24e..2deba3ad5d0 100644--- a/crates/agent/src/agent.rs+++ b/crates/agent/src/agent.rs@@ -460,8 +460,8 @@ pub trait SiblingThreadHost {pub struct NativeAgent {/// Session ID -> Session mapping- sessions: HashMap<acp_v1::SessionId, Session>,- pending_sessions: HashMap<acp_v1::SessionId, PendingSession>,+ sessions: HashMap<acp_v2::SessionId, Session>,+ pending_sessions: HashMap<acp_v2::SessionId, PendingSession>,thread_store: Entity<ThreadStore>,/// Project-specific state keyed by project EntityIdprojects: HashMap<EntityId, ProjectState>,@@ -1014,7 +1014,7 @@ impl NativeAgent {);}- fn session_project_state(&self, session_id: &acp_v1::SessionId) -> Option<&ProjectState> {+ fn session_project_state(&self, session_id: &acp_v2::SessionId) -> Option<&ProjectState> {self.sessions.get(session_id).and_then(|session| self.projects.get(&session.project_id))@@ -1663,7 +1663,7 @@ impl NativeAgent {pub fn load_thread(&mut self,- id: acp_v1::SessionId,+ id: acp_v2::SessionId,project: Entity<Project>,cx: &mut Context<Self>,) -> Task<Result<Entity<Thread>>> {@@ -1703,7 +1703,7 @@ impl NativeAgent {pub fn open_thread(&mut self,- id: acp_v1::SessionId,+ id: acp_v2::SessionId,project: Entity<Project>,cx: &mut Context<Self>,) -> Task<Result<Entity<AcpThread>>> {@@ -1770,7 +1770,7 @@ impl NativeAgent {pub fn thread_summary(&mut self,- id: acp_v1::SessionId,+ id: acp_v2::SessionId,project: Entity<Project>,cx: &mut Context<Self>,) -> Task<Result<SharedString>> {@@ -1795,7 +1795,7 @@ impl NativeAgent {fn release_session(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,acp_thread_id: EntityId,draft_prompt: Option<Vec<acp_v2::ContentBlock>>,cx: &mut Context<Self>,@@ -1835,7 +1835,7 @@ impl NativeAgent {fn enqueue_save(&mut self,- id: &acp_v1::SessionId,+ id: &acp_v2::SessionId,draft_prompt: Option<Vec<acp_v2::ContentBlock>>,cx: &mut Context<Self>,) {@@ -1861,7 +1861,7 @@ impl NativeAgent {}async fn run_save_worker(- id: acp_v1::SessionId,+ id: acp_v2::SessionId,mut wake: watch::Receiver<()>,pending_save: Arc<Mutex<Option<PendingThreadSave>>>,database_future: Shared<Task<Result<Arc<ThreadsDatabase>, Arc<anyhow::Error>>>>,@@ -1903,7 +1903,7 @@ impl NativeAgent {session: &Session,draft_prompt: Option<Vec<acp_v2::ContentBlock>>,cx: &mut App,- ) -> Option<(acp_v1::SessionId, PathList, Task<DbThread>)> {+ ) -> Option<(acp_v2::SessionId, PathList, Task<DbThread>)> {if session.thread.read(cx).is_empty() {return None;}@@ -1961,7 +1961,7 @@ impl NativeAgent {fn send_mcp_prompt(&self,client_user_message_id: ClientUserMessageId,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,prompt_name: String,server_id: ContextServerId,arguments: HashMap<String, String>,@@ -2073,7 +2073,7 @@ impl NativeAgent {fn send_compact_command(&self,client_user_message_id: ClientUserMessageId,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,cx: &mut Context<Self>,) -> Task<Result<acp_v1::PromptResponse>> {cx.spawn(async move |this, cx| {@@ -2119,7 +2119,7 @@ impl NativeAgent {fn send_skill_invocation(&self,client_user_message_id: ClientUserMessageId,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,skill: Skill,original_content: Vec<acp_v1::ContentBlock>,cx: &mut Context<Self>,@@ -2223,7 +2223,7 @@ impl NativeAgent {pub struct NativeAgentConnection(pub Entity<NativeAgent>);impl NativeAgentConnection {- pub fn thread(&self, session_id: &acp_v1::SessionId, cx: &App) -> Option<Entity<Thread>> {+ pub fn thread(&self, session_id: &acp_v2::SessionId, cx: &App) -> Option<Entity<Thread>> {self.0.read(cx).sessions@@ -2253,7 +2253,7 @@ impl NativeAgentConnection {pub fn available_skills(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Vec<NativeAvailableSkill> {self.0@@ -2271,7 +2271,7 @@ impl NativeAgentConnection {pub fn load_thread(&self,- id: acp_v1::SessionId,+ id: acp_v2::SessionId,project: Entity<Project>,cx: &mut App,) -> Task<Result<Entity<Thread>>> {@@ -2281,7 +2281,7 @@ impl NativeAgentConnection {fn run_turn(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,cx: &mut App,f: impl 'static+ FnOnce(Entity<Thread>, &mut App) -> Result<mpsc::UnboundedReceiver<Result<ThreadEvent>>>,@@ -2388,7 +2388,7 @@ impl NativeAgentConnection {}) => {let request_result = acp_thread.update(cx, |thread, cx| {let scope = acp_v2::ElicitationSessionScope::new(- acp_v2::SessionId::new(thread.session_id().0.clone()),+ thread.session_id().clone(),).tool_call_id(tool_call_id);let request = acp_v2::CreateElicitationRequest::new(@@ -2577,7 +2577,7 @@ fn strip_slash_command_prefix(text: &str) -> String {}struct NativeAgentModelSelector {- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,connection: NativeAgentConnection,}@@ -2826,7 +2826,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {fn load_session(self: Rc<Self>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,_work_dirs: PathList,_title: Option<SharedString>,@@ -2844,7 +2844,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {Task::ready(Ok(()))}- fn model_selector(&self, session_id: &acp_v1::SessionId) -> Option<Rc<dyn AgentModelSelector>> {+ fn model_selector(&self, session_id: &acp_v2::SessionId) -> Option<Rc<dyn AgentModelSelector>> {Some(Rc::new(NativeAgentModelSelector {session_id: session_id.clone(),connection: self.clone(),@@ -2878,7 +2878,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {fn retry(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn acp_thread::AgentSessionRetry>> {Some(Rc::new(NativeAgentSessionRetry {@@ -2887,7 +2887,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {}) as _)}- fn cancel(&self, session_id: &acp_v1::SessionId, cx: &mut App) {+ fn cancel(&self, session_id: &acp_v2::SessionId, cx: &mut App) {log::info!("Cancelling on session: {}", session_id);self.0.update(cx, |agent, cx| {if let Some(session) = agent.sessions.get(session_id) {@@ -2901,7 +2901,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {fn truncate(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn acp_thread::AgentSessionTruncate>> {self.0.read_with(cx, |agent, _cx| {@@ -2916,7 +2916,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {fn set_title(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn acp_thread::AgentSessionSetTitle>> {self.0.read_with(cx, |agent, _cx| {@@ -2953,11 +2953,11 @@ impl acp_thread::AgentSessionClientUserMessageIds for NativeAgentConnection {params: acp_v2::PromptRequest,cx: &mut App,) -> Task<Result<acp_v1::PromptResponse>> {+ let session_id = params.session_id.clone();let params = match acp_thread::content::prompt_to_v1(params) {Ok(params) => params,Err(error) => return Task::ready(Err(error)),};- let session_id = params.session_id.clone();log::info!("Received prompt request for session: {}", session_id);log::debug!("Prompt blocks count: {}", params.prompt.len());@@ -3114,7 +3114,7 @@ impl acp_thread::AgentSessionClientUserMessageIds for NativeAgentConnection {impl acp_thread::AgentTelemetry for NativeAgentConnection {fn thread_data(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &mut App,) -> Task<Result<serde_json::Value>> {let Some(session) = self.0.read(cx).sessions.get(session_id) else {@@ -3176,7 +3176,7 @@ impl AgentSessionList for NativeAgentSessionList {true}- fn delete_session(&self, session_id: &acp_v1::SessionId, cx: &mut App) -> Task<Result<()>> {+ fn delete_session(&self, session_id: &acp_v2::SessionId, cx: &mut App) -> Task<Result<()>> {self.thread_store.update(cx, |store, cx| store.delete_thread(session_id.clone(), cx))}@@ -3234,7 +3234,7 @@ impl acp_thread::AgentSessionTruncate for NativeAgentSessionTruncate {struct NativeAgentSessionRetry {connection: NativeAgentConnection,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,}impl acp_thread::AgentSessionRetry for NativeAgentSessionRetry {@@ -3338,7 +3338,7 @@ impl NativeThreadEnvironment {pub(crate) fn resume_subagent_thread(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,cx: &mut App,) -> Result<Rc<dyn SubagentHandle>> {let (subagent_thread, acp_thread) = self.agent.update(cx, |agent, _cx| {@@ -3370,7 +3370,7 @@ impl NativeThreadEnvironment {fn prompt_subagent(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,subagent_thread: Entity<Thread>,acp_thread: Entity<acp_thread::AcpThread>,) -> Result<Rc<dyn SubagentHandle>> {@@ -3502,7 +3502,7 @@ impl ThreadEnvironment for NativeThreadEnvironment {fn resume_subagent(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,cx: &mut App,) -> Result<Rc<dyn SubagentHandle>> {self.resume_subagent_thread(session_id, cx)@@ -3544,7 +3544,7 @@ impl ThreadEnvironment for NativeThreadEnvironment {}pub struct NativeSubagentHandle {- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,parent_thread: WeakEntity<Thread>,subagent_thread: Entity<Thread>,acp_thread: Entity<acp_thread::AcpThread>,@@ -3552,7 +3552,7 @@ pub struct NativeSubagentHandle {impl NativeSubagentHandle {fn new(- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,subagent_thread: Entity<Thread>,acp_thread: Entity<acp_thread::AcpThread>,parent_thread_entity: Entity<Thread>,@@ -3567,7 +3567,7 @@ impl NativeSubagentHandle {}impl SubagentHandle for NativeSubagentHandle {- fn id(&self) -> acp_v1::SessionId {+ fn id(&self) -> acp_v2::SessionId {self.session_id.clone()}@@ -4212,7 +4212,7 @@ mod internal_tests {fn native_thread_for_session(agent: &Entity<NativeAgent>,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Entity<Thread> {agent.read_with(cx, |agent, _cx| {@@ -4466,7 +4466,7 @@ mod internal_tests {items: vec![json!({"type": "compaction", "encrypted_content": "opaque state"})],},)));- let restored_session_id = acp_v1::SessionId::new("provider-native-compaction");+ let restored_session_id = acp_v2::SessionId::new("provider-native-compaction");let database = cx.update(|cx| ThreadsDatabase::connect(cx)).await@@ -7092,7 +7092,7 @@ mod internal_tests {Entity<NativeAgent>,Rc<NativeAgentConnection>,Entity<Project>,- acp_v1::SessionId,+ acp_v2::SessionId,Arc<FakeLanguageModelProvider>,) {let fs = FakeFs::new(cx.executor());@@ -7931,7 +7931,7 @@ mod internal_tests {model: LanguageModel,acp_thread: Entity<AcpThread>,thread: Entity<Thread>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,database: Arc<ThreadsDatabase>,}@@ -8274,7 +8274,7 @@ mod internal_tests {fn thread_entries(thread_store: &Entity<ThreadStore>,cx: &mut TestAppContext,- ) -> Vec<(acp_v1::SessionId, String)> {+ ) -> Vec<(acp_v2::SessionId, String)> {thread_store.read_with(cx, |store, _| {store.entries()diff --git a/crates/agent/src/db.rs b/crates/agent/src/db.rsindex c0639fb0fd9..650d660d802 100644--- a/crates/agent/src/db.rs+++ b/crates/agent/src/db.rs@@ -1,6 +1,5 @@use crate::{AgentMessage, AgentMessageContent, UserMessage, UserMessageContent};use acp_thread::ClientUserMessageId;-use agent_client_protocol::schema::v1 as acp;use agent_client_protocol::schema::v2 as acp_v2;use agent_settings::AgentProfileId;use anyhow::Result;@@ -28,8 +27,8 @@ pub type DbLanguageModel = crate::legacy_thread::SerializedLanguageModel;#[derive(Debug, Clone)]pub struct DbThreadMetadata {- pub id: acp::SessionId,- pub parent_session_id: Option<acp::SessionId>,+ pub id: acp_v2::SessionId,+ pub parent_session_id: Option<acp_v2::SessionId>,pub title: SharedString,pub updated_at: DateTime<Utc>,pub created_at: Option<DateTime<Utc>>,@@ -501,7 +500,7 @@ impl ThreadsDatabase {fn save_thread_sync(connection: &Arc<Mutex<Connection>>,- id: acp::SessionId,+ id: acp_v2::SessionId,thread: DbThread,folder_paths: &PathList,) -> Result<()> {@@ -604,8 +603,8 @@ impl ThreadsDatabase {.map(|dt| dt.with_timezone(&Utc));threads.push(DbThreadMetadata {- id: acp::SessionId::new(id),- parent_session_id: parent_id.map(acp::SessionId::new),+ id: acp_v2::SessionId::new(id),+ parent_session_id: parent_id.map(acp_v2::SessionId::new),title: summary.into(),updated_at: DateTime::parse_from_rfc3339(&updated_at)?.with_timezone(&Utc),created_at,@@ -617,7 +616,7 @@ impl ThreadsDatabase {})}- pub fn load_thread(&self, id: acp::SessionId) -> Task<Result<Option<DbThread>>> {+ pub fn load_thread(&self, id: acp_v2::SessionId) -> Task<Result<Option<DbThread>>> {let connection = self.connection.clone();self.executor.spawn(async move {@@ -637,7 +636,7 @@ impl ThreadsDatabase {pub fn save_thread(&self,- id: acp::SessionId,+ id: acp_v2::SessionId,thread: DbThread,folder_paths: PathList,) -> Task<Result<()>> {@@ -701,7 +700,7 @@ impl ThreadsDatabase {}}- pub fn delete_thread(&self, id: acp::SessionId) -> Task<Result<()>> {+ pub fn delete_thread(&self, id: acp_v2::SessionId) -> Task<Result<()>> {let connection = self.connection.clone();self.executor.spawn(async move {@@ -793,6 +792,7 @@ impl ThreadsDatabase {#[cfg(test)]mod tests {use super::*;+ use agent_client_protocol::schema::v1 as acp;use chrono::{DateTime, TimeZone, Utc};use collections::HashMap;use gpui::TestAppContext;@@ -816,8 +816,111 @@ mod tests {assert_eq!(restored.updated_at, original.updated_at);}- fn session_id(value: &str) -> acp::SessionId {- acp::SessionId::new(Arc::<str>::from(value))+ fn session_id(value: &str) -> acp_v2::SessionId {+ acp_v2::SessionId::new(Arc::<str>::from(value))+ }++ #[test]+ fn test_session_metadata_preserves_backing_storage() {+ let storage: Arc<str> = Arc::from(" session/雪:\"quoted\"\\opaque ");+ let metadata = DbThreadMetadata {+ id: acp_v2::SessionId::new(storage.clone()),+ parent_session_id: None,+ title: "Opaque session".into(),+ updated_at: Utc::now(),+ created_at: None,+ folder_paths: PathList::default(),+ };+ let session_info = acp_thread::AgentSessionInfo::from(&metadata);++ assert_eq!(session_info.session_id.0.as_ref(), storage.as_ref());+ assert!(Arc::ptr_eq(&session_info.session_id.0, &storage));+ assert!(Arc::ptr_eq(&metadata.id.0, &storage));+ }++ #[gpui::test]+ async fn test_session_ids_preserve_legacy_persistence(cx: &mut TestAppContext) {+ let database = ThreadsDatabase::new(cx.executor()).expect("create database");+ let thread_id = session_id(" session/雪:\"quoted\"\\opaque ");+ let parent_id = session_id(" parent/雪:\"quoted\"\\opaque ");+ let legacy_json = serde_json::json!({+ "version": "0.3.0",+ "title": "Legacy subagent",+ "messages": [],+ "updated_at": "2024-01-01T00:00:00Z",+ "subagent_context": {+ "parent_thread_id": parent_id.0.as_ref(),+ "depth": 1,+ },+ });+ {+ let connection = database.connection.lock();+ let mut insert = connection+ .exec_bound::<(Arc<str>, Arc<str>, Vec<u8>)>(indoc! {"+ INSERT INTO threads (id, parent_id, summary, updated_at, data_type, data)+ VALUES (?1, ?2, 'Legacy subagent', '2024-01-01T00:00:00Z', 'json', ?3)+ "})+ .expect("prepare legacy row");+ insert((+ thread_id.0.clone(),+ parent_id.0.clone(),+ serde_json::to_vec(&legacy_json).expect("encode legacy JSON"),+ ))+ .expect("insert legacy row");+ }++ let restored = database+ .load_thread(thread_id.clone())+ .await+ .expect("load legacy row")+ .expect("legacy row exists");+ assert_eq!(+ serde_json::to_value(&restored.subagent_context).expect("encode restored context"),+ legacy_json["subagent_context"]+ );+ let entries = database.list_threads().await.expect("list legacy row");+ let metadata = entries.first().expect("legacy metadata exists");+ assert_eq!(metadata.id, thread_id);+ assert_eq!(metadata.parent_session_id.as_ref(), Some(&parent_id));++ database+ .save_thread(thread_id.clone(), restored, PathList::default())+ .await+ .expect("save with v2 session IDs");+ {+ let connection = database.connection.lock();+ let mut select = connection+ .select_bound::<Arc<str>, (String, String, DataType, Vec<u8>)>(+ "SELECT id, parent_id, data_type, data FROM threads WHERE id = ?",+ )+ .expect("prepare saved row query");+ let rows = select(thread_id.0.clone()).expect("query saved row");+ let (stored_id, stored_parent_id, data_type, data) =+ rows.first().expect("saved row exists");+ assert_eq!(stored_id, thread_id.0.as_ref());+ assert_eq!(stored_parent_id, parent_id.0.as_ref());+ assert_eq!(*data_type, DataType::Zstd);+ let json = zstd::decode_all(data.as_slice()).expect("decompress saved JSON");+ let saved_json: serde_json::Value =+ serde_json::from_slice(&json).expect("decode saved JSON");+ assert_eq!(saved_json["version"], legacy_json["version"]);+ assert_eq!(+ saved_json["subagent_context"],+ legacy_json["subagent_context"]+ );+ }++ database+ .delete_thread(thread_id.clone())+ .await+ .expect("delete using v2 ID");+ assert!(+ database+ .load_thread(thread_id)+ .await+ .expect("load deleted row")+ .is_none()+ );}fn make_thread(title: &str, updated_at: DateTime<Utc>) -> DbThread {diff --git a/crates/agent/src/tests/mod.rs b/crates/agent/src/tests/mod.rsindex 51aadd3d63d..c23b8edaf8b 100644--- a/crates/agent/src/tests/mod.rs+++ b/crates/agent/src/tests/mod.rs@@ -169,12 +169,12 @@ impl crate::TerminalHandle for FakeTerminalHandle {}struct FakeSubagentHandle {- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,send_task: Shared<Task<String>>,}impl SubagentHandle for FakeSubagentHandle {- fn id(&self) -> acp::SessionId {+ fn id(&self) -> acp_v2::SessionId {self.session_id.clone()}@@ -1296,7 +1296,7 @@ async fn test_replayed_tool_call_ids_scoped_across_messages(cx: &mut TestAppContlet templates = thread.templates.clone();cx.new(|cx| {Thread::from_db(- acp::SessionId::new("restored"),+ acp_v2::SessionId::new("restored"),db_thread,project,project_context.clone(),@@ -3917,7 +3917,7 @@ async fn test_cumulative_token_usage(cx: &mut TestAppContext) {let templates = thread.templates.clone();cx.new(|cx| {Thread::from_db(- acp::SessionId::new("restored"),+ acp_v2::SessionId::new("restored"),db_thread,project,project_context.clone(),@@ -4568,7 +4568,7 @@ async fn test_tool_updates_to_completion(cx: &mut TestAppContext) {let tool_call = expect_tool_call(&mut events).await;assert_eq!(tool_call,- acp::ToolCall::new(tool_call_id.clone(), "Echo")+ acp::ToolCall::new(acp::ToolCallId::new(tool_call_id.0.clone()), "Echo").name("echo").raw_input(json!({})));@@ -4576,7 +4576,7 @@ async fn test_tool_updates_to_completion(cx: &mut TestAppContext) {assert_eq!(update,acp::ToolCallUpdate::new(- tool_call_id.clone(),+ acp::ToolCallId::new(tool_call_id.0.clone()),acp::ToolCallUpdateFields::new().title("Echo").kind(acp::ToolKind::Other)@@ -4587,7 +4587,7 @@ async fn test_tool_updates_to_completion(cx: &mut TestAppContext) {assert_eq!(update,acp::ToolCallUpdate::new(- tool_call_id.clone(),+ acp::ToolCallId::new(tool_call_id.0.clone()),acp::ToolCallUpdateFields::new().status(acp::ToolCallStatus::InProgress)));@@ -4595,7 +4595,7 @@ async fn test_tool_updates_to_completion(cx: &mut TestAppContext) {assert_eq!(update,acp::ToolCallUpdate::new(- tool_call_id,+ acp::ToolCallId::new(tool_call_id.0),acp::ToolCallUpdateFields::new().status(acp::ToolCallStatus::Completed).raw_output("Hello!")@@ -5892,7 +5892,7 @@ async fn test_ask_user_elicitation_references_scoped_tool_call_id(cx: &mut TestAlet acp_v2::ElicitationScope::Session(scope) = elicitation.request.scope() else {panic!("ask_user elicitation should be session-scoped");};- assert_ne!(tool_call_id, acp::ToolCallId::new("call_1"));+ assert_ne!(tool_call_id, acp_v2::ToolCallId::new("call_1"));assert_eq!(scope.tool_call_id.as_ref().map(|id| &id.0),Some(&tool_call_id.0),@@ -5942,7 +5942,7 @@ async fn test_spawn_agent_tool_forwards_explicit_model(cx: &mut TestAppContext)let environment = Rc::new(FakeThreadEnvironment::default().with_subagent(FakeSubagentHandle {- session_id: acp::SessionId::new("subagent-id"),+ session_id: acp_v2::SessionId::new("subagent-id"),send_task: Task::ready("done".to_string()).shared(),}),);@@ -5989,7 +5989,7 @@ async fn test_spawn_agent_tool_rejects_model_when_resuming(cx: &mut TestAppConteToolInput::resolved(SpawnAgentToolInput {label: "task".to_string(),message: "prompt".to_string(),- session_id: Some(acp::SessionId::new("subagent-id")),+ session_id: Some(acp_v2::SessionId::new("subagent-id")),model: Some("fake-corp/other-model".to_string()),}),event_stream,@@ -6818,7 +6818,7 @@ async fn test_max_subagent_depth_prevents_tool_registration(cx: &mut TestAppContcx,);thread.set_subagent_context(SubagentContext {- parent_thread_id: acp::SessionId::new("parent-id"),+ parent_thread_id: acp_v2::SessionId::new("parent-id"),depth: MAX_SUBAGENT_DEPTH - 1,});threaddiff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex 2a189a3ff53..e25f43752a3 100644--- a/crates/agent/src/thread.rs+++ b/crates/agent/src/thread.rs@@ -143,7 +143,7 @@ impl std::error::Error for NoModelConfiguredError {}#[derive(Clone, Debug, Serialize, Deserialize)]pub struct SubagentContext {/// ID of the parent thread- pub parent_thread_id: acp::SessionId,+ pub parent_thread_id: acp_v2::SessionId,/// Current depth level (0 = root agent, 1 = first-level subagent, etc.)pub depth: u8,@@ -769,7 +769,7 @@ pub trait TerminalHandle {pub trait SubagentHandle {/// The session ID of this subagent thread- fn id(&self) -> acp::SessionId;+ fn id(&self) -> acp_v2::SessionId;/// The current number of entries in the thread./// Useful for knowing where the next turn will beginfn num_entries(&self, cx: &App) -> usize;@@ -797,7 +797,7 @@ pub trait ThreadEnvironment {fn resume_subagent(&self,- _session_id: acp::SessionId,+ _session_id: acp_v2::SessionId,_cx: &mut App,) -> Result<Rc<dyn SubagentHandle>> {Err(anyhow::anyhow!(@@ -907,11 +907,11 @@ pub enum ThreadEvent {ToolCallUpdate(acp_thread::ToolCallUpdate),ToolCallAuthorization(ToolCallAuthorization),ToolCallAuthorizationResolved {- tool_call_id: acp::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,outcome: acp_thread::SelectedPermissionOutcome,},Elicitation(ElicitationRequest),- SubagentSpawned(acp::SessionId),+ SubagentSpawned(acp_v2::SessionId),Retry(acp_thread::RetryStatus),ContextCompaction(acp_thread::ContextCompaction),ContextCompactionUpdate(acp_thread::ContextCompactionUpdate),@@ -1288,7 +1288,7 @@ pub(crate) struct StreamingSaveKey {}pub struct Thread {- id: acp::SessionId,+ id: acp_v2::SessionId,prompt_id: PromptId,updated_at: DateTime<Utc>,title: Option<SharedString>,@@ -1445,7 +1445,7 @@ impl Thread {.map_or(ThreadModel::Unset, ThreadModel::Unresolved),};Self {- id: acp::SessionId::new(uuid::Uuid::new_v4().to_string()),+ id: acp_v2::SessionId::new(uuid::Uuid::new_v4().to_string()),prompt_id: PromptId::new(),updated_at: Utc::now(),title: None,@@ -1531,7 +1531,7 @@ impl Thread {self.model = ThreadModel::Ready(model);}- pub fn id(&self) -> &acp::SessionId {+ pub fn id(&self) -> &acp_v2::SessionId {&self.id}@@ -1673,10 +1673,13 @@ impl Thread {stream.sender.unbounded_send(Ok(ThreadEvent::ToolCall(- acp::ToolCall::new(tool_call_id.clone(), tool_use.name.to_string())- .name(tool_use.name.to_string())- .status(status)- .raw_input(tool_use.input.to_display_json()),+ acp::ToolCall::new(+ acp::ToolCallId::new(tool_call_id.0.clone()),+ tool_use.name.to_string(),+ )+ .name(tool_use.name.to_string())+ .status(status)+ .raw_input(tool_use.input.to_display_json()),))).ok();let mut fields = acp::ToolCallUpdateFields::new()@@ -1780,7 +1783,7 @@ impl Thread {}pub fn from_db(- id: acp::SessionId,+ id: acp_v2::SessionId,db_thread: DbThread,project: Entity<Project>,project_context: Entity<ProjectContext>,@@ -4373,7 +4376,7 @@ impl Thread {pub(crate) fn unregister_running_subagent(&mut self,- subagent_session_id: &acp::SessionId,+ subagent_session_id: &acp_v2::SessionId,cx: &App,) {self.running_subagents.retain(|s| {@@ -4383,7 +4386,7 @@ impl Thread {}#[cfg(any(test, feature = "test-support"))]- pub fn running_subagent_ids(&self, cx: &App) -> Vec<acp::SessionId> {+ pub fn running_subagent_ids(&self, cx: &App) -> Vec<acp_v2::SessionId> {self.running_subagents.iter().filter_map(|s| s.upgrade().map(|s| s.read(cx).id().clone()))@@ -4394,7 +4397,7 @@ impl Thread {self.subagent_context.is_some()}- pub fn parent_thread_id(&self) -> Option<acp::SessionId> {+ pub fn parent_thread_id(&self) -> Option<acp_v2::SessionId> {self.subagent_context.as_ref().map(|c| c.parent_thread_id.clone())@@ -5034,7 +5037,7 @@ fn retained_user_request_messages_before(}pub fn build_thread_title_request(- thread_id: &acp::SessionId,+ thread_id: &acp_v2::SessionId,messages: &[Arc<Message>],temperature: Option<f32>,) -> LanguageModelRequest {@@ -5448,10 +5451,10 @@ wherepub(crate) fn scoped_tool_call_id(message_ix: usize,tool_use_id: &LanguageModelToolUseId,-) -> acp::ToolCallId {+) -> acp_v2::ToolCallId {// `message_ix` is non-zero-padded decimal, so the `:` delimiter is always// unambiguous -- this would break if the index were zero-padded.- acp::ToolCallId::new(format!("{message_ix}:{tool_use_id}"))+ acp_v2::ToolCallId::new(format!("{message_ix}:{tool_use_id}"))}#[derive(Clone)]@@ -5488,7 +5491,7 @@ impl ThreadEventStream {fn send_tool_call(&self,- id: &acp::ToolCallId,+ id: &acp_v2::ToolCallId,tool_name: &str,title: SharedString,kind: acp::ToolKind,@@ -5506,13 +5509,13 @@ impl ThreadEventStream {}fn initial_tool_call(- id: &acp::ToolCallId,+ id: &acp_v2::ToolCallId,tool_name: &str,title: String,kind: acp::ToolKind,input: serde_json::Value,) -> acp::ToolCall {- acp::ToolCall::new(id.clone(), title)+ acp::ToolCall::new(acp::ToolCallId::new(id.0.clone()), title).name(tool_name).kind(kind).raw_input(input)@@ -5520,13 +5523,13 @@ impl ThreadEventStream {fn update_tool_call_fields(&self,- tool_call_id: &acp::ToolCallId,+ tool_call_id: &acp_v2::ToolCallId,fields: acp::ToolCallUpdateFields,meta: Option<acp::Meta>,) {self.sender.unbounded_send(Ok(ThreadEvent::ToolCallUpdate(- acp::ToolCallUpdate::new(tool_call_id.clone(), fields)+ acp::ToolCallUpdate::new(acp::ToolCallId::new(tool_call_id.0.clone()), fields).meta(meta).into(),)))@@ -5535,7 +5538,7 @@ impl ThreadEventStream {fn resolve_tool_call_authorization(&self,- tool_call_id: &acp::ToolCallId,+ tool_call_id: &acp_v2::ToolCallId,outcome: acp_thread::SelectedPermissionOutcome,) {self.sender@@ -5654,7 +5657,7 @@ pub struct ToolCallEventStream {tool_use_id: LanguageModelToolUseId,/// The ACP-facing id for this tool call (see [`scoped_tool_call_id`])./// Distinct from `tool_use_id`, which is the raw, provider-issued id.- tool_call_id: acp::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,stream: ThreadEventStream,fs: Option<Arc<dyn Fs>>,cancellation_rx: watch::Receiver<bool>,@@ -5689,7 +5692,7 @@ impl ToolCallEventStream {// of silently passing.let stream = ToolCallEventStream::new("test_id".into(),- acp::ToolCallId::new("0:test_id"),+ acp_v2::ToolCallId::new("0:test_id"),ThreadEventStream::new(events_tx),None,cancellation_rx,@@ -5710,7 +5713,7 @@ impl ToolCallEventStream {// of silently passing.let stream = ToolCallEventStream::new("test_id".into(),- acp::ToolCallId::new("0:test_id"),+ acp_v2::ToolCallId::new("0:test_id"),ThreadEventStream::new(events_tx),None,cancellation_rx,@@ -5733,7 +5736,7 @@ impl ToolCallEventStream {fn new(tool_use_id: LanguageModelToolUseId,- tool_call_id: acp::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,stream: ThreadEventStream,fs: Option<Arc<dyn Fs>>,cancellation_rx: watch::Receiver<bool>,@@ -5799,7 +5802,7 @@ impl ToolCallEventStream {}/// The ACP-facing id for this tool call (see [`scoped_tool_call_id`]).- pub fn tool_call_id(&self) -> &acp::ToolCallId {+ pub fn tool_call_id(&self) -> &acp_v2::ToolCallId {&self.tool_call_id}@@ -5835,7 +5838,7 @@ impl ToolCallEventStream {.ok();}- pub fn subagent_spawned(&self, id: acp::SessionId) {+ pub fn subagent_spawned(&self, id: acp_v2::SessionId) {self.stream.sender.unbounded_send(Ok(ThreadEvent::SubagentSpawned(id)))@@ -6041,7 +6044,7 @@ impl ToolCallEventStream {.unbounded_send(Ok(ThreadEvent::ToolCallAuthorization(ToolCallAuthorization {tool_call: acp::ToolCallUpdate::new(- tool_call_id.clone(),+ acp::ToolCallId::new(tool_call_id.0.clone()),// Leave the title untouched so the card keeps// showing the command (matching the fallback flow).acp::ToolCallUpdateFields::new(),@@ -6161,7 +6164,7 @@ impl ToolCallEventStream {.unbounded_send(Ok(ThreadEvent::ToolCallAuthorization(ToolCallAuthorization {tool_call: acp::ToolCallUpdate::new(- tool_call_id,+ acp::ToolCallId::new(tool_call_id.0),// Leave the title untouched so the card keeps// showing the command (matching the escalation// flow).@@ -6439,7 +6442,7 @@ impl ToolCallEventStream {// they're approving to run unsandboxed. The reason is// surfaced separately by the fallback details / warning.tool_call: acp::ToolCallUpdate::new(- tool_call_id.clone(),+ acp::ToolCallId::new(tool_call_id.0.clone()),acp::ToolCallUpdateFields::new(),).meta(@@ -6547,7 +6550,10 @@ impl ToolCallEventStream {.sender.unbounded_send(Ok(ThreadEvent::ToolCallAuthorization(ToolCallAuthorization {- tool_call: acp::ToolCallUpdate::new(tool_call_id.clone(), fields),+ tool_call: acp::ToolCallUpdate::new(+ acp::ToolCallId::new(tool_call_id.0.clone()),+ fields,+ ),options,response: response_tx,context: None,@@ -6581,7 +6587,7 @@ impl ToolCallEventStream {cx: &mut App,) -> Task<Result<acp_v2::CreateElicitationResponse>> {let stream = self.stream.clone();- let tool_call_id = acp_v2::ToolCallId::new(self.tool_call_id.0.clone());+ let tool_call_id = self.tool_call_id.clone();cx.spawn(async move |_cx| {let (response_tx, response_rx) = oneshot::channel();if let Err(error) =@@ -6657,7 +6663,7 @@ impl ToolCallEventStream {.unbounded_send(Ok(ThreadEvent::ToolCallAuthorization(ToolCallAuthorization {tool_call: acp::ToolCallUpdate::new(- tool_call_id.clone(),+ acp::ToolCallId::new(tool_call_id.0.clone()),acp::ToolCallUpdateFields::new().title(title),),options,@@ -6886,7 +6892,7 @@ impl ToolCallEventStreamReceiver {pub async fn expect_authorization_resolved(&mut self,- ) -> (acp::ToolCallId, acp_thread::SelectedPermissionOutcome) {+ ) -> (acp_v2::ToolCallId, acp_thread::SelectedPermissionOutcome) {let event = self.0.next().await;if let Some(Ok(ThreadEvent::ToolCallAuthorizationResolved {tool_call_id,@@ -7041,6 +7047,63 @@ mod tests {use settings::LanguageModelProviderSetting;use std::sync::Arc;+ #[gpui::test]+ async fn test_tool_call_events_preserve_opaque_id_storage() {+ let storage: Arc<str> = Arc::from(" call/雪:\"quoted\"\\opaque ");+ let tool_call_id = acp_v2::ToolCallId::new(storage.clone());+ let (sender, mut receiver) = mpsc::unbounded();+ let stream = ThreadEventStream::new(sender);++ stream.send_tool_call(+ &tool_call_id,+ "test_tool",+ "Test tool".into(),+ acp::ToolKind::Other,+ json!({}),+ );+ let ThreadEvent::ToolCall(tool_call) = receiver+ .next()+ .await+ .expect("tool call event exists")+ .expect("tool call event succeeded")+ else {+ panic!("expected v1 tool call payload");+ };+ assert_eq!(tool_call.tool_call_id.0.as_ref(), storage.as_ref());+ assert!(Arc::ptr_eq(&tool_call.tool_call_id.0, &storage));++ stream.update_tool_call_fields(&tool_call_id, acp::ToolCallUpdateFields::new(), None);+ let ThreadEvent::ToolCallUpdate(acp_thread::ToolCallUpdate::UpdateFields(update)) =+ receiver+ .next()+ .await+ .expect("update event exists")+ .expect("update event succeeded")+ else {+ panic!("expected v1 tool call update payload");+ };+ assert_eq!(update.tool_call_id.0.as_ref(), storage.as_ref());+ assert!(Arc::ptr_eq(&update.tool_call_id.0, &storage));++ stream.resolve_tool_call_authorization(+ &tool_call_id,+ acp_thread::SelectedPermissionOutcome::new(+ acp::PermissionOptionId::new("allow"),+ acp::PermissionOptionKind::AllowOnce,+ ),+ );+ let ThreadEvent::ToolCallAuthorizationResolved { tool_call_id, .. } = receiver+ .next()+ .await+ .expect("authorization resolution exists")+ .expect("authorization resolution succeeded")+ else {+ panic!("expected shared authorization resolution");+ };+ assert_eq!(tool_call_id.0.as_ref(), storage.as_ref());+ assert!(Arc::ptr_eq(&tool_call_id.0, &storage));+ }+#[test]fn compaction_capacity_respects_prompt_and_combined_limits() {assert_eq!(@@ -7376,7 +7439,7 @@ mod tests {];let request =- build_thread_title_request(&acp::SessionId::new("thread-id"), &messages, Some(0.2));+ build_thread_title_request(&acp_v2::SessionId::new("thread-id"), &messages, Some(0.2));assert_eq!(request.thread_id.as_deref(), Some("thread-id"));assert_eq!(request.intent, Some(CompletionIntent::ThreadSummarization));@@ -8748,11 +8811,15 @@ mod tests {let authorization = receiver.expect_authorization().await;assert_eq!(- &authorization.tool_call.tool_call_id,- event_stream.tool_call_id(),+ &authorization.tool_call.tool_call_id.0,+ &event_stream.tool_call_id().0,"the warning prompt must reference the scoped ACP tool-call id, \not the raw provider id");+ assert!(Arc::ptr_eq(+ &authorization.tool_call.tool_call_id.0,+ &event_stream.tool_call_id().0,+ ));let details =acp_thread::sandbox_authorization_details_from_meta(&authorization.tool_call.meta).expect("warning authorization should include sandbox details");diff --git a/crates/agent/src/thread_store.rs b/crates/agent/src/thread_store.rsindex c09c2df88fd..39c2a5dcc04 100644--- a/crates/agent/src/thread_store.rs+++ b/crates/agent/src/thread_store.rs@@ -1,5 +1,5 @@use crate::{DbThread, DbThreadMetadata, ThreadsDatabase};-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp_v2;use anyhow::{Result, anyhow};use futures::{FutureExt, future::Shared};use gpui::{App, Context, Entity, Global, Task, prelude::*};@@ -43,13 +43,16 @@ impl ThreadStore {self.reload_task.clone()}- pub fn thread_from_session_id(&self, session_id: &acp::SessionId) -> Option<&DbThreadMetadata> {+ pub fn thread_from_session_id(+ &self,+ session_id: &acp_v2::SessionId,+ ) -> Option<&DbThreadMetadata> {self.threads.iter().find(|thread| &thread.id == session_id)}pub fn load_thread(&mut self,- id: acp::SessionId,+ id: acp_v2::SessionId,cx: &mut Context<Self>,) -> Task<Result<Option<DbThread>>> {let database_future = ThreadsDatabase::connect(cx);@@ -61,7 +64,7 @@ impl ThreadStore {pub fn save_thread(&mut self,- id: acp::SessionId,+ id: acp_v2::SessionId,thread: crate::DbThread,folder_paths: PathList,cx: &mut Context<Self>,@@ -76,7 +79,7 @@ impl ThreadStore {pub fn delete_thread(&mut self,- id: acp::SessionId,+ id: acp_v2::SessionId,cx: &mut Context<Self>,) -> Task<Result<()>> {let database_future = ThreadsDatabase::connect(cx);@@ -132,7 +135,7 @@ impl ThreadStore {self.threads.iter().cloned()}- pub fn entry_ids(&self) -> impl Iterator<Item = acp::SessionId> + '_ {+ pub fn entry_ids(&self) -> impl Iterator<Item = acp_v2::SessionId> + '_ {self.threads.iter().map(|t| t.id.clone())}}@@ -145,8 +148,8 @@ mod tests {use gpui::TestAppContext;use std::sync::Arc;- fn session_id(value: &str) -> acp::SessionId {- acp::SessionId::new(Arc::<str>::from(value))+ fn session_id(value: &str) -> acp_v2::SessionId {+ acp_v2::SessionId::new(Arc::<str>::from(value))}fn make_thread(title: &str, updated_at: DateTime<Utc>) -> DbThread {diff --git a/crates/agent/src/tools/spawn_agent_tool.rs b/crates/agent/src/tools/spawn_agent_tool.rsindex ddb4c66a65f..73dad1e9619 100644--- a/crates/agent/src/tools/spawn_agent_tool.rs+++ b/crates/agent/src/tools/spawn_agent_tool.rs@@ -1,5 +1,6 @@use acp_thread::{SUBAGENT_SESSION_INFO_META_KEY, SubagentSessionInfo};use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp_v2;use anyhow::Result;use gpui::{App, SharedString, Task};use language_model::LanguageModelToolResultContent;@@ -51,7 +52,7 @@ pub struct SpawnAgentToolInput {pub message: String,/// Session ID of an existing agent session to continue instead of creating a new one. Omit to create a new agent.#[serde(default, deserialize_with = "deserialize_session_id")]- pub session_id: Option<acp::SessionId>,+ pub session_id: Option<acp_v2::SessionId>,/// Optional model override. Pass the exact `models[].id` returned for the/// native Zed agent (`is_native: true`) by `list_agents_and_models`./// Omit to preserve default behavior.@@ -59,7 +60,7 @@ pub struct SpawnAgentToolInput {pub model: Option<String>,}-fn deserialize_session_id<'de, D>(deserializer: D) -> Result<Option<acp::SessionId>, D::Error>+fn deserialize_session_id<'de, D>(deserializer: D) -> Result<Option<acp_v2::SessionId>, D::Error>whereD: Deserializer<'de>,{@@ -84,14 +85,14 @@ where#[serde(rename_all = "snake_case")]pub enum SpawnAgentToolOutput {Success {- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,output: String,session_info: SubagentSessionInfo,},Error {#[serde(skip_serializing_if = "Option::is_none")]#[serde(default)]- session_id: Option<acp::SessionId>,+ session_id: Option<acp_v2::SessionId>,error: String,session_info: Option<SubagentSessionInfo>,},@@ -304,6 +305,31 @@ mod tests {use super::*;use serde_json::json;+ #[test]+ fn session_ids_preserve_legacy_tool_json() -> Result<(), serde_json::Error> {+ let session_id = " session/雪:\"quoted\"\\opaque ";+ let input_json = json!({+ "label": "label",+ "message": "message",+ "session_id": session_id,+ });+ let input: SpawnAgentToolInput = serde_json::from_value(input_json.clone())?;+ assert_eq!(+ input.session_id.as_ref().map(|id| id.0.as_ref()),+ Some(session_id)+ );+ assert_eq!(serde_json::to_value(input)?, input_json);++ let output_json = json!({+ "session_id": session_id,+ "error": "failed after session creation",+ "session_info": null,+ });+ let output: SpawnAgentToolOutput = serde_json::from_value(output_json.clone())?;+ assert_eq!(serde_json::to_value(output)?, output_json);+ Ok(())+ }+#[test]fn deserializes_blank_session_id_as_absent() {for session_id in [json!(null), json!(""), json!(" ")] {diff --git a/crates/agent_servers/src/acp.rs b/crates/agent_servers/src/acp.rsindex 2aa0324dbb1..0e36a60810e 100644--- a/crates/agent_servers/src/acp.rs+++ b/crates/agent_servers/src/acp.rs@@ -113,7 +113,7 @@ impl<T> FlattenAcpResult<T> for Result<Result<T, acp::Error>, anyhow::Error> {/// Holds state needed by foreground work dispatched from background handler closures.struct ClientContext {- sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>>,+ sessions: Rc<RefCell<HashMap<acp_v2::SessionId, AcpSession>>>,session_list: Rc<RefCell<Option<Rc<AcpSessionList>>>>,request_elicitations: Entity<ElicitationStore>,}@@ -193,13 +193,15 @@ async fn cancel_elicitations_after_disconnect(async fn close_session_and_drain(connection: &ConnectionTo<Agent>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,supports_close: bool,dispatch_tx: &mpsc::UnboundedSender<ForegroundWork>,) -> Result<()> {if supports_close {connection- .send_request(acp::CloseSessionRequest::new(session_id))+ .send_request(acp::CloseSessionRequest::new(acp::SessionId::new(+ session_id.0,+ ))).block_task().await.log_err();@@ -318,8 +320,8 @@ pub struct AcpConnection {telemetry_id: SharedString,agent_version: Option<SharedString>,connection: ConnectionTo<Agent>,- sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>>,- pending_sessions: RefCell<HashMap<acp::SessionId, PendingAcpSession>>,+ sessions: Rc<RefCell<HashMap<acp_v2::SessionId, AcpSession>>>,+ pending_sessions: RefCell<HashMap<acp_v2::SessionId, PendingAcpSession>>,auth_methods: Vec<acp_v2::AuthMethod>,agent_server_store: WeakEntity<AgentServerStore>,agent_capabilities: acp::AgentCapabilities,@@ -440,14 +442,14 @@ impl ConfigOptions {async fn set_config_option(&self,connection: &ConnectionTo<Agent>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,config_id: acp_v2::SessionConfigId,value: acp_v2::SessionConfigOptionValue,) -> Result<Vec<acp_v2::SessionConfigOption>> {let value = acp_thread::config_options::value_to_v1(value)?;let response = connection.send_request(acp::SetSessionConfigOptionRequest::new(- session_id,+ acp::SessionId::new(session_id.0),acp::SessionConfigId::new(config_id.0),value,))@@ -493,7 +495,7 @@ impl AcpSessionList {.log_err();}- fn send_info_update(&self, session_id: acp::SessionId, update: acp::SessionInfoUpdate) {+ fn send_info_update(&self, session_id: acp_v2::SessionId, update: acp::SessionInfoUpdate) {self.updates_tx.try_send(acp_thread::SessionListUpdate::SessionInfo {session_id,@@ -524,7 +526,7 @@ impl AgentSessionList for AcpSessionList {.sessions.into_iter().map(|s| AgentSessionInfo {- session_id: s.session_id,+ session_id: acp_v2::SessionId::new(s.session_id.0),work_dirs: Some(work_dirs_from_session_info(s.cwd,s.additional_directories,@@ -549,14 +551,14 @@ impl AgentSessionList for AcpSessionList {self.supports_delete}- fn delete_session(&self, session_id: &acp::SessionId, cx: &mut App) -> Task<Result<()>> {+ fn delete_session(&self, session_id: &acp_v2::SessionId, cx: &mut App) -> Task<Result<()>> {if !self.supports_delete() {return Task::ready(Err(anyhow::anyhow!("delete_session not supported")));}let conn = self.connection.clone();let updates_tx = self.updates_tx.clone();- let session_id = session_id.clone();+ let session_id = acp::SessionId::new(session_id.0.clone());cx.foreground_executor().spawn(async move {conn.send_request(acp::DeleteSessionRequest::new(session_id)).block_task()@@ -1071,7 +1073,7 @@ impl AcpConnection {#[cfg(any(test, feature = "test-support"))]fn new_for_test(connection: ConnectionTo<Agent>,- sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>>,+ sessions: Rc<RefCell<HashMap<acp_v2::SessionId, AcpSession>>>,agent_capabilities: acp::AgentCapabilities,request_elicitations: Entity<ElicitationStore>,agent_server_store: WeakEntity<AgentServerStore>,@@ -1118,7 +1120,7 @@ impl AcpConnection {fn register_session(self: &Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,thread: &Entity<AcpThread>,session_modes: Option<Rc<RefCell<acp::SessionModeState>>>,config_options: Option<ConfigOptions>,@@ -1148,7 +1150,7 @@ impl AcpConnection {);}- fn remove_session(&self, session_id: &acp::SessionId, thread_id: gpui::EntityId) {+ fn remove_session(&self, session_id: &acp_v2::SessionId, thread_id: gpui::EntityId) {let mut sessions = self.sessions.borrow_mut();if sessions.get(session_id)@@ -1158,7 +1160,7 @@ impl AcpConnection {}}- fn remove_pending_session(&self, session_id: &acp::SessionId, thread_id: gpui::EntityId) {+ fn remove_pending_session(&self, session_id: &acp_v2::SessionId, thread_id: gpui::EntityId) {let mut sessions = self.pending_sessions.borrow_mut();if sessions.get(session_id)@@ -1170,7 +1172,7 @@ impl AcpConnection {fn release_session(self: &Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,thread: WeakEntity<AcpThread>,cx: &mut App,) {@@ -1223,13 +1225,13 @@ impl AcpConnection {fn open_or_create_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,rpc_call: impl FnOnce(ConnectionTo<Agent>,- acp::SessionId,+ acp_v2::SessionId,SessionDirectories,)-> futures::future::LocalBoxFuture<'static, Result<SessionConfigResponse>>@@ -1395,7 +1397,7 @@ impl AcpConnection {fn apply_default_config_options(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,config_options: &ConfigOptions,cx: &mut AsyncApp,) -> Task<()> {@@ -1500,20 +1502,20 @@ impl SessionDirectories {fn into_load_session_request(self,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,mcp_servers: Vec<acp::McpServer>,) -> acp::LoadSessionRequest {- acp::LoadSessionRequest::new(session_id, self.cwd)+ acp::LoadSessionRequest::new(acp::SessionId::new(session_id.0), self.cwd).additional_directories(self.additional_directories).mcp_servers(mcp_servers)}fn into_resume_session_request(self,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,mcp_servers: Vec<acp::McpServer>,) -> acp::ResumeSessionRequest {- acp::ResumeSessionRequest::new(session_id, self.cwd)+ acp::ResumeSessionRequest::new(acp::SessionId::new(session_id.0), self.cwd).additional_directories(self.additional_directories).mcp_servers(mcp_servers)}@@ -1557,7 +1559,7 @@ fn work_dirs_from_session_info(cwd: PathBuf, additional_directories: Vec<PathBuf}fn emit_load_error_to_all_sessions(- sessions: &Rc<RefCell<HashMap<acp::SessionId, AcpSession>>>,+ sessions: &Rc<RefCell<HashMap<acp_v2::SessionId, AcpSession>>>,error: LoadError,cx: &mut AsyncApp,) {@@ -1764,8 +1766,9 @@ impl AgentConnection for AcpConnection {}}+ let session_id = acp_v2::SessionId::new(response.session_id.0);let default_config_task = config_options.as_ref().map(|options| {- self.apply_default_config_options(&response.session_id, options, cx)+ self.apply_default_config_options(&session_id, options, cx)});let action_log = cx.new(|_| ActionLog::new(project.clone()));@@ -1777,7 +1780,7 @@ impl AgentConnection for AcpConnection {self.clone(),project,action_log,- response.session_id.clone(),+ session_id.clone(),// ACP doesn't currently support per-session prompt capabilities or changing capabilities dynamically.watch::Receiver::constant(self.prompt_capabilities()),cx,@@ -1786,7 +1789,7 @@ impl AgentConnection for AcpConnection {cx.update(|cx| {self.register_session(- response.session_id,+ session_id,&thread,modes,config_options,@@ -1822,7 +1825,7 @@ impl AgentConnection for AcpConnection {fn load_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -1861,7 +1864,7 @@ impl AgentConnection for AcpConnection {fn resume_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -1998,13 +2001,13 @@ impl AgentConnection for AcpConnection {params: acp_v2::PromptRequest,cx: &mut App,) -> Task<Result<acp::PromptResponse>> {+ let session_id = params.session_id.clone();let params = match acp_thread::content::prompt_to_v1(params) {Ok(params) => params,Err(error) => return Task::ready(Err(error)),};let conn = self.connection.clone();let sessions = self.sessions.clone();- let session_id = params.session_id.clone();cx.foreground_executor().spawn(async move {let result = conn.send_request(params).block_task().await;@@ -2057,11 +2060,11 @@ impl AgentConnection for AcpConnection {})}- fn cancel(&self, session_id: &acp::SessionId, _cx: &mut App) {+ fn cancel(&self, session_id: &acp_v2::SessionId, _cx: &mut App) {if let Some(session) = self.sessions.borrow_mut().get_mut(session_id) {session.suppress_abort_err = true;}- let params = acp::CancelNotification::new(session_id.clone());+ let params = acp::CancelNotification::new(acp::SessionId::new(session_id.0.clone()));self.connection.send_notification(params).log_err();}@@ -2071,7 +2074,7 @@ impl AgentConnection for AcpConnection {fn session_modes(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn acp_thread::AgentSessionModes>> {let sessions = self.sessions.clone();@@ -2093,7 +2096,7 @@ impl AgentConnection for AcpConnection {fn session_config_options(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,_cx: &App,) -> Option<Rc<dyn acp_thread::AgentSessionConfigOptions>> {let sessions = self.sessions.borrow();@@ -2311,7 +2314,7 @@ pub mod test_support {fn load_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -2332,7 +2335,7 @@ pub mod test_support {fn resume_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -2388,13 +2391,13 @@ pub mod test_support {fn retry(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn AgentSessionRetry>> {self.inner.retry(session_id, cx)}- fn cancel(&self, session_id: &acp::SessionId, cx: &mut App) {+ fn cancel(&self, session_id: &acp_v2::SessionId, cx: &mut App) {self.inner.cancel(session_id, cx)}@@ -2404,7 +2407,7 @@ pub mod test_support {fn truncate(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn AgentSessionTruncate>> {self.inner.truncate(session_id, cx)@@ -2412,7 +2415,7 @@ pub mod test_support {fn set_title(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn AgentSessionSetTitle>> {self.inner.set_title(session_id, cx)@@ -2424,7 +2427,7 @@ pub mod test_support {fn session_modes(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn AgentSessionModes>> {self.inner.session_modes(session_id, cx)@@ -2432,7 +2435,7 @@ pub mod test_support {fn session_config_options(&self,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Option<Rc<dyn AgentSessionConfigOptions>> {self.inner.session_config_options(session_id, cx)@@ -2463,7 +2466,7 @@ pub mod test_support {let authenticate_count = Arc::new(AtomicUsize::new(0));let logout_count = Arc::new(AtomicUsize::new(0));- let sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>> =+ let sessions: Rc<RefCell<HashMap<acp_v2::SessionId, AcpSession>>> =Rc::new(RefCell::new(HashMap::default()));let client_session_list: Rc<RefCell<Option<Rc<AcpSessionList>>>> =Rc::new(RefCell::new(None));@@ -2786,8 +2789,7 @@ mod tests {cx: &mut AsyncApp,context: &ClientContext,) {- let session_id = acp::SessionId::new(notification.session_id.to_string());- session_thread(context, &session_id)+ session_thread(context, ¬ification.session_id).expect("registered terminal session").update(cx, |thread, cx| notification.apply(thread, cx)).expect("live terminal session")@@ -2805,7 +2807,7 @@ mod tests {let thread = cx.update(|cx| {connection.clone().load_session(- acp::SessionId::new("v2-terminal-session"),+ acp_v2::SessionId::new("v2-terminal-session"),project,PathList::new(&[std::path::Path::new("/a")]),None,@@ -3146,7 +3148,7 @@ mod tests {assert_eq!(harness.terminal("terminal-1", cx), terminal);harness.thread.read_with(cx, |thread, _| {let (_, tool) = thread- .tool_call(&acp::ToolCallId::new("terminal-tool"))+ .tool_call(&acp_v2::ToolCallId::new("terminal-tool")).expect("tool");assert_eq!(tool.terminals().next(), Some(&terminal));});@@ -3583,7 +3585,7 @@ mod tests {let first_thread = cx.update(|cx| {connection.clone().load_session(- acp::SessionId::new("session-1"),+ acp_v2::SessionId::new("session-1"),project.clone(),work_dirs.clone(),None,@@ -3595,7 +3597,7 @@ mod tests {let second_thread = cx.update(|cx| {connection.clone().load_session(- acp::SessionId::new("session-2"),+ acp_v2::SessionId::new("session-2"),project,work_dirs,None,@@ -4016,7 +4018,7 @@ mod tests {});- let session_id = acp::SessionId::new("session-1");+ let session_id = acp_v2::SessionId::new("session-1");let new_session_request = directories.clone().into_new_session_request(Vec::new());let load_session_request = directories.clone()@@ -4045,6 +4047,31 @@ mod tests {);}+ #[test]+ fn legacy_session_requests_preserve_opaque_ids_and_backing_storage() {+ for value in ["", "001", " opaque/会話:007?x=%2F \n", "e\u{301}", "é"] {+ let backing: Arc<str> = value.into();+ let session_id = acp_v2::SessionId::new(backing.clone());+ let directories = SessionDirectories {+ cwd: PathBuf::from("/workspace"),+ additional_directories: Vec::new(),+ };+ let load = directories+ .clone()+ .into_load_session_request(session_id.clone(), Vec::new());+ let resume = directories.into_resume_session_request(session_id, Vec::new());++ for wire_id in [&load.session_id, &resume.session_id] {+ assert_eq!(wire_id.0.as_ref(), value);+ assert!(Arc::ptr_eq(&backing, &wire_id.0));+ assert_eq!(+ serde_json::to_value(wire_id).expect("serialize legacy ID"),+ serde_json::json!(value)+ );+ }+ }+ }+#[test]fn session_directories_drop_additional_paths_when_unsupported() {let work_dirs = PathList::new(&[@@ -4357,7 +4384,7 @@ mod tests {let mut async_cx = cx.to_async();let _default_config_task = connection.apply_default_config_options(- &acp::SessionId::new("session-config-defaults"),+ &acp_v2::SessionId::new("session-config-defaults"),&config_options,&mut async_cx,);@@ -4475,7 +4502,7 @@ mod tests {let config_options = config_options.expect("config options");let mut receiver = config_options.rx.clone();let _default_config_task = connection.apply_default_config_options(- &acp::SessionId::new("session"),+ &acp_v2::SessionId::new("session"),&config_options,&mut cx.to_async(),);@@ -4553,7 +4580,7 @@ mod tests {let config_options = ConfigOptions::new(Rc::new(RefCell::new(original_options.clone())));let mut receiver = config_options.rx.clone();let _default_config_task = connection.apply_default_config_options(- &acp::SessionId::new("session"),+ &acp_v2::SessionId::new("session"),&config_options,&mut cx.to_async(),);@@ -4596,7 +4623,7 @@ mod tests {acp_v2::SessionConfigOption::boolean("second", "Second", false),])));let _default_config_task = connection.apply_default_config_options(- &acp::SessionId::new("session"),+ &acp_v2::SessionId::new("session"),&config_options,&mut cx.to_async(),);@@ -4645,7 +4672,7 @@ mod tests {),]),);- let session_id = acp::SessionId::new("session");+ let session_id = acp_v2::SessionId::new("session");let initial_options = model_config_options("initial-model", "medium", &["medium"]);let thread = cx.update(|cx| {@@ -4727,7 +4754,7 @@ mod tests {acp_v2::SessionConfigOption::boolean("config", "Config", false),])));let options = AcpSessionConfigOptions {- session_id: acp::SessionId::new("session"),+ session_id: acp_v2::SessionId::new("session"),connection: connection.connection.clone(),config_options: config,};@@ -4894,7 +4921,7 @@ mod tests {let deleted_sessions = Arc::new(std::sync::Mutex::new(Vec::new()));let connection = connect_session_delete_test_agent(deleted_sessions.clone(), cx).await;let session_list = AcpSessionList::new(connection, true);- let session_id = acp::SessionId::new("session-to-delete");+ let session_id = acp_v2::SessionId::new(" opaque/会話:007?x=%2F \n");cx.update(|cx| session_list.delete_session(&session_id, cx)).await@@ -4904,7 +4931,7 @@ mod tests {*deleted_sessions.lock().expect("deleted sessions lock should not be poisoned"),- vec![session_id]+ vec![acp::SessionId::new(session_id.0)]);}@@ -4913,7 +4940,7 @@ mod tests {let deleted_sessions = Arc::new(std::sync::Mutex::new(Vec::new()));let connection = connect_session_delete_test_agent(deleted_sessions.clone(), cx).await;let session_list = AcpSessionList::new(connection, false);- let session_id = acp::SessionId::new("session-to-delete");+ let session_id = acp_v2::SessionId::new("session-to-delete");let error = cx.update(|cx| session_list.delete_session(&session_id, cx))@@ -5259,7 +5286,7 @@ exit 7let (client_transport, agent_transport) = agent_client_protocol::Channel::duplex();- let sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>> =+ let sessions: Rc<RefCell<HashMap<acp_v2::SessionId, AcpSession>>> =Rc::new(RefCell::new(HashMap::default()));let client_session_list: Rc<RefCell<Option<Rc<AcpSessionList>>>> =Rc::new(RefCell::new(None));@@ -5509,7 +5536,7 @@ exit 7let (connection, project, _, _, _, _, keep_agent_alive) =connect_fake_agent_with_handle(None, Some(agent_sender), cx).await;let agent = agent_receiver.await.expect("fake agent handle");- let session_id = acp::SessionId::new("retained-idle-session");+ let session_id = acp_v2::SessionId::new("retained-idle-session");let thread = cx.update(|cx| {connection.clone().load_session(@@ -5527,7 +5554,7 @@ exit 7.expect("connection elicitation store");let session_request = acp::CreateElicitationRequest::new(acp::ElicitationFormMode::new(- acp::ElicitationSessionScope::new(session_id),+ acp::ElicitationSessionScope::new(acp::SessionId::new(session_id.0)),acp::ElicitationSchema::new().string("name", true),),"Session question",@@ -5694,7 +5721,7 @@ exit 7let (connection, project, _, _, _, _, keep_agent_alive) =connect_fake_agent_with_handle(None, Some(agent_sender), cx).await;let agent = agent_receiver.await.expect("fake agent handle");- let session_id = acp::SessionId::new("completion-session");+ let session_id = acp_v2::SessionId::new("completion-session");let thread = cx.update(|cx| {connection.clone().load_session(@@ -5710,9 +5737,8 @@ exit 7let store = connection.request_elicitations().expect("connection elicitation store");- let session_scope = acp_v2::ElicitationScope::Session(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(session_id.0)),- );+ let session_scope =+ acp_v2::ElicitationScope::Session(acp_v2::ElicitationSessionScope::new(session_id));let request_scope = acp_v2::ElicitationScope::Request(acp_v2::ElicitationRequestScope::new(acp_v2::RequestId::Number(1)),);@@ -6029,7 +6055,7 @@ exit 7let thread = cx.update(|cx| {connection.clone().load_session(- acp::SessionId::new("after-abandonment"),+ acp_v2::SessionId::new("after-abandonment"),project,PathList::new(&[std::path::Path::new("/a")]),None,@@ -6040,7 +6066,7 @@ exit 7.expect("abandonment must not end the connection");assert_eq!(thread.read_with(cx, |thread, _| thread.session_id().clone()),- acp::SessionId::new("after-abandonment")+ acp_v2::SessionId::new("after-abandonment"));}@@ -6132,7 +6158,7 @@ exit 7let thread = cx.update(|cx| {connection.clone().load_session(- acp::SessionId::new("after-rejection"),+ acp_v2::SessionId::new("after-rejection"),project,PathList::new(&[std::path::Path::new("/a")]),None,@@ -6143,7 +6169,7 @@ exit 7.expect("rejection must not end or block the connection");assert_eq!(thread.read_with(cx, |thread, _| thread.session_id().clone()),- acp::SessionId::new("after-rejection")+ acp_v2::SessionId::new("after-rejection"));}@@ -6194,7 +6220,7 @@ exit 7let (connection, project, _, _, _, _, _keep_agent_alive) =connect_fake_agent_with_handle(None, Some(agent_sender), cx).await;let agent = agent_receiver.await.expect("fake agent handle");- let session_id = acp::SessionId::new("permission-session");+ let session_id = acp_v2::SessionId::new("permission-session");let thread = cx.update(|cx| {connection.clone().load_session(@@ -6213,12 +6239,12 @@ exit 7.background_executor.timer(std::time::Duration::from_secs(5));let exchange = async {- let tool_id = acp::ToolCallId::new("reused-tool");+ let tool_id = acp_v2::ToolCallId::new("reused-tool");let permission = |option_id: &str| {acp::RequestPermissionRequest::new(- session_id.clone(),+ acp::SessionId::new(session_id.0.clone()),acp::ToolCallUpdate::new(- tool_id.clone(),+ acp::ToolCallId::new(tool_id.0.clone()),acp::ToolCallUpdateFields::default().title("Run a command").status(acp::ToolCallStatus::Pending),@@ -6366,7 +6392,7 @@ exit 7_keep_agent_alive,) = connect_fake_agent(None, cx).await;- let session_id = acp::SessionId::new("session-1");+ let session_id = acp_v2::SessionId::new("session-1");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);// Load the same session twice concurrently — the second call should join@@ -6459,7 +6485,7 @@ exit 7.lock().expect("load_session_updates mutex poisoned") = vec![notice_update];- let session_id = acp::SessionId::new("session-with-notice");+ let session_id = acp_v2::SessionId::new("session-with-notice");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);let thread = cx.update(|cx| {@@ -6495,7 +6521,7 @@ exit 7let other_thread = cx.update(|cx| {connection.clone().load_session(- acp::SessionId::new("other-session"),+ acp_v2::SessionId::new("other-session"),project.clone(),work_dirs.clone(),None,@@ -6552,7 +6578,7 @@ exit 7))),];- let session_id = acp::SessionId::new("session-replay");+ let session_id = acp_v2::SessionId::new("session-replay");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);let thread = cx@@ -6596,7 +6622,7 @@ exit 7) {let (connection, project, _, _, _, _, _keep_agent_alive) =connect_fake_agent(None, cx).await;- let session_id = acp::SessionId::new("session-config-update");+ let session_id = acp_v2::SessionId::new("session-config-update");let updated_options = vec![acp::SessionConfigOption::boolean("web_search","Web Search",@@ -6618,7 +6644,7 @@ exit 7enqueue_notification(&dispatch_tx,acp::SessionNotification::new(- session_id,+ acp::SessionId::new(session_id.0),acp::SessionUpdate::ConfigOptionUpdate(acp::ConfigOptionUpdate::new(updated_options),),@@ -6676,7 +6702,7 @@ exit 7.lock().expect("load_session_gate mutex poisoned") = Some(gate_rx);- let session_id = acp::SessionId::new("session-close-during-load");+ let session_id = acp_v2::SessionId::new("session-close-during-load");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);let load_task = cx.update(|cx| {@@ -6760,7 +6786,7 @@ exit 7.lock().expect("load_session_gate mutex poisoned") = Some(gate_rx);- let session_id = acp::SessionId::new("session-abandoned-during-load");+ let session_id = acp_v2::SessionId::new("session-abandoned-during-load");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);let load_task = cx.update(|cx| {connection.clone().load_session(@@ -6838,7 +6864,7 @@ exit 7))),)];- let session_id = acp::SessionId::new("session-reopen-abandoned-load");+ let session_id = acp_v2::SessionId::new("session-reopen-abandoned-load");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);let first_load = cx.update(|cx| {connection.clone().load_session(@@ -6968,7 +6994,7 @@ exit 7async fn test_reopening_after_failed_load_discards_old_replay(cx: &mut gpui::TestAppContext) {let (connection, project, load_count, close_count, _, _, _keep_agent_alive) =connect_fake_agent(None, cx).await;- let session_id = acp::SessionId::new("session-failed-load");+ let session_id = acp_v2::SessionId::new("session-failed-load");let work_dirs = PathList::new(&[std::path::Path::new("/a")]);let (response_tx, response_rx) = futures::channel::oneshot::channel::<()>();let first_load = cx.update(|cx| {@@ -6985,7 +7011,7 @@ exit 7enqueue_notification(&dispatch_tx,acp::SessionNotification::new(- session_id,+ acp::SessionId::new(session_id.0),acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("old replay".into(),)),@@ -7066,7 +7092,7 @@ exit 7.lock().expect("load_session_gate mutex poisoned") = Some(gate_rx);- let session_id = acp::SessionId::new("session-concurrent-close");+ let session_id = acp_v2::SessionId::new("session-concurrent-close");let work_dirs = util::path_list::PathList::new(&[std::path::Path::new("/a")]);// Kick off two concurrent loads; the second must join the first's pending@@ -7216,7 +7242,7 @@ fn config_state(}struct AcpSessionModes {- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,connection: ConnectionTo<Agent>,state: Rc<RefCell<acp::SessionModeState>>,}@@ -7232,7 +7258,7 @@ impl acp_thread::AgentSessionModes for AcpSessionModes {fn set_mode(&self, mode_id: acp::SessionModeId, cx: &mut App) -> Task<Result<()>> {let connection = self.connection.clone();- let session_id = self.session_id.clone();+ let session_id = acp::SessionId::new(self.session_id.0.clone());let old_mode_id;{let mut state = self.state.borrow_mut();@@ -7258,7 +7284,7 @@ impl acp_thread::AgentSessionModes for AcpSessionModes {}struct AcpSessionConfigOptions {- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,connection: ConnectionTo<Agent>,config_options: ConfigOptions,}@@ -7297,7 +7323,7 @@ impl acp_thread::AgentSessionConfigOptions for AcpSessionConfigOptions {fn session_thread(ctx: &ClientContext,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,) -> Result<WeakEntity<AcpThread>, acp::Error> {let sessions = ctx.sessions.borrow();sessions@@ -7332,7 +7358,7 @@ fn handle_request_permission(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7390,8 +7416,7 @@ fn handle_create_elicitation(};match args.scope() {acp_v2::ElicitationScope::Session(scope) => {- let thread = match session_thread(ctx, &acp::SessionId::new(scope.session_id.0.clone()))- {+ let thread = match session_thread(ctx, &scope.session_id) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7515,7 +7540,7 @@ fn handle_write_text_file(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7550,7 +7575,7 @@ fn handle_read_text_file(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7578,13 +7603,14 @@ fn handle_session_notification(cx: &mut AsyncApp,ctx: &ClientContext,) {+ let session_id = acp_v2::SessionId::new(notification.session_id.0);// Extract everything we need from the session while briefly borrowing.let (thread, session_modes, config_opts_data) = {let sessions = ctx.sessions.borrow();- let Some(session) = sessions.get(¬ification.session_id) else {+ let Some(session) = sessions.get(&session_id) else {log::warn!("Received session notification for unknown session: {:?}",- notification.session_id+ session_id);return;};@@ -7627,7 +7653,7 @@ fn handle_session_notification(if let acp::SessionUpdate::SessionInfoUpdate(info_update) = ¬ification.update&& let Some(session_list) = ctx.session_list.borrow().as_ref(){- session_list.send_info_update(notification.session_id.clone(), info_update.clone());+ session_list.send_info_update(session_id.clone(), info_update.clone());}// Abandoned loads can keep replaying until their wire operation settles.@@ -7682,7 +7708,7 @@ fn handle_session_notification({log::error!("Failed to handle session update for {:?}: {err:?}",- notification.session_id+ session_id);}@@ -7745,7 +7771,7 @@ fn handle_create_terminal(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7805,7 +7831,7 @@ fn handle_kill_terminal(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7829,7 +7855,7 @@ fn handle_release_terminal(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7855,7 +7881,7 @@ fn handle_terminal_output(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};@@ -7883,7 +7909,7 @@ fn handle_wait_for_terminal_exit(cx: &mut AsyncApp,ctx: &ClientContext,) {- let thread = match session_thread(ctx, &args.session_id) {+ let thread = match session_thread(ctx, &acp_v2::SessionId::new(args.session_id.0)) {Ok(t) => t,Err(e) => return respond_err(responder, e),};diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 5ef03a5a8ed..0bbabd69e39 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -12,7 +12,7 @@ use std::{use acp_thread::{AcpThread, AcpThreadEvent, MentionUri, line_range_suffix};use agent::{ContextServerRegistry, SharedThread, ThreadStore};-use agent_client_protocol::schema::{v1 as acp, v2 as acp_v2};+use agent_client_protocol::schema::v2 as acp_v2;use agent_servers::AgentServer;use agent_settings::UserAgentsMd;use collections::HashSet;@@ -1335,7 +1335,7 @@ impl AgentPanel {let thread_id = store.read_with(cx, |store, _cx| {let primary = info.thread_id.and_then(|tid| store.entry(tid));let fallback = info.session_id.as_ref().and_then(|sid| {- store.entry_by_session(&acp::SessionId::new(sid.clone()))+ store.entry_by_session(&acp_v2::SessionId::new(sid.clone()))});primary.or(fallback)@@ -1661,7 +1661,7 @@ impl AgentPanel {pub fn open_thread(&mut self,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,work_dirs: Option<PathList>,title: Option<SharedString>,window: &mut Window,@@ -1704,7 +1704,7 @@ impl AgentPanel {fn external_thread_by_session(&mut self,agent: Agent,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,work_dirs: Option<PathList>,title: Option<SharedString>,focus: bool,@@ -3519,7 +3519,7 @@ impl AgentPanel {}fn initial_content_for_thread_summary(- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,cx: &App,) -> Option<AgentInitialContent> {let thread = ThreadStore::global(cx)@@ -3890,7 +3890,7 @@ impl AgentPanel {};let db_thread = shared_thread.to_db_thread();- let session_id = acp::SessionId::new(uuid::Uuid::new_v4().to_string());+ let session_id = acp_v2::SessionId::new(uuid::Uuid::new_v4().to_string());let thread_store = self.thread_store.clone();let title = db_thread.title.clone();let workspace = self.workspace.clone();@@ -4617,7 +4617,7 @@ impl AgentPanel {&mut self,agent: Agent,server_override: Option<Rc<dyn AgentServer>>,- resume_session_id: acp::SessionId,+ resume_session_id: acp_v2::SessionId,work_dirs: Option<PathList>,title: Option<SharedString>,initial_content: Option<AgentInitialContent>,@@ -4645,7 +4645,7 @@ impl AgentPanel {agent: Agent,server_override: Option<Rc<dyn AgentServer>>,resume_thread_id: Option<ThreadId>,- resume_session_id: Option<acp::SessionId>,+ resume_session_id: Option<acp_v2::SessionId>,work_dirs: Option<PathList>,title: Option<SharedString>,initial_content: Option<AgentInitialContent>,@@ -6772,7 +6772,7 @@ impl AgentPanel {pub fn open_restored_thread_with_server(&mut self,server: Rc<dyn AgentServer>,- resume_session_id: acp::SessionId,+ resume_session_id: acp_v2::SessionId,window: &mut Window,cx: &mut Context<Self>,) {@@ -7004,6 +7004,7 @@ mod tests {};use acp_thread::{AgentConnection, StubAgentConnection, ThreadStatus};use action_log::ActionLog;+ use agent_client_protocol::schema::v1 as acp;use anyhow::{Result, anyhow};use feature_flags::FeatureFlagAppExt;use fs::FakeFs;@@ -7094,7 +7095,7 @@ mod tests {#[derive(Clone, Default)]struct SessionTrackingConnection {next_session_number: Arc<Mutex<usize>>,- sessions: Arc<Mutex<HashSet<acp::SessionId>>>,+ sessions: Arc<Mutex<HashSet<acp_v2::SessionId>>>,}impl SessionTrackingConnection {@@ -7104,7 +7105,7 @@ mod tests {fn create_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -7151,7 +7152,7 @@ mod tests {) -> Task<Result<Entity<AcpThread>>> {let session_id = {let mut next_session_number = self.next_session_number.lock();- let session_id = acp::SessionId::new(format!(+ let session_id = acp_v2::SessionId::new(format!("session-tracking-session-{}",*next_session_number));@@ -7168,7 +7169,7 @@ mod tests {fn load_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -7202,7 +7203,7 @@ mod tests {fn close_session(self: Rc<Self>,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,_cx: &mut App,) -> Task<Result<()>> {self.sessions.lock().remove(session_id);@@ -7226,7 +7227,7 @@ mod tests {params: acp_v2::PromptRequest,_cx: &mut App,) -> Task<Result<acp::PromptResponse>> {- let session_id = acp::SessionId::new(params.session_id.0);+ let session_id = params.session_id;if !self.sessions.lock().contains(&session_id) {return Task::ready(Err(anyhow!("Session not found")));}@@ -7234,7 +7235,7 @@ mod tests {Task::ready(Ok(acp::PromptResponse::new(acp::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -7273,12 +7274,12 @@ mod tests {open_thread_with_connection(&panel, connection.clone(), cx);let session_id = active_session_id(&panel, cx);- let tool_call_id = acp::ToolCallId::new("tool-call-output-focus-regression");+ let tool_call_id = acp_v2::ToolCallId::new("tool-call-output-focus-regression");cx.update(|_window, cx| {connection.send_update(session_id.clone(),acp::SessionUpdate::ToolCall(- acp::ToolCall::new(tool_call_id.clone(), "Read file")+ acp::ToolCall::new(acp::ToolCallId::new(tool_call_id.0.clone()), "Read file").kind(acp::ToolKind::Fetch).status(acp::ToolCallStatus::InProgress),),@@ -7287,7 +7288,7 @@ mod tests {connection.send_update(session_id,acp::SessionUpdate::ToolCallUpdate(acp::ToolCallUpdate::new(- tool_call_id.clone(),+ acp::ToolCallId::new(tool_call_id.0.clone()),acp::ToolCallUpdateFields::new().status(acp::ToolCallStatus::Completed).content(vec![acp::ToolCallContent::Content(acp::Content::new(@@ -8239,7 +8240,7 @@ mod tests {let cx = &mut VisualTestContext::from_window(multi_workspace.into(), cx);// Simulate a previous run that persisted metadata for this session.- let resume_session_id = acp::SessionId::new("persistent-session");+ let resume_session_id = acp_v2::SessionId::new("persistent-session");cx.update(|_window, cx| {ThreadMetadataStore::global(cx).update(cx, |store, cx| {store.save(@@ -8780,7 +8781,7 @@ mod tests {panel: &Entity<AgentPanel>,connection: &StubAgentConnection,cx: &mut VisualTestContext,- ) -> (acp::SessionId, ThreadId) {+ ) -> (acp_v2::SessionId, ThreadId) {open_thread_with_custom_connection(panel, connection.clone(), cx);let session_id = active_session_id(panel, cx);let thread_id = active_thread_id(panel, cx);@@ -8800,7 +8801,7 @@ mod tests {panel: &Entity<AgentPanel>,connection: &StubAgentConnection,cx: &mut VisualTestContext,- ) -> (acp::SessionId, ThreadId) {+ ) -> (acp_v2::SessionId, ThreadId) {open_thread_with_custom_connection(panel, connection.clone(), cx);let session_id = active_session_id(panel, cx);let thread_id = active_thread_id(panel, cx);@@ -11708,7 +11709,7 @@ mod tests {language_model::LanguageModelRegistry::test(cx);});- let source_session_id = acp::SessionId::new("source-thread-session");+ let source_session_id = acp_v2::SessionId::new("source-thread-session");let source_title: SharedString = "Source Thread Title".into();let db_thread = agent::DbThread {title: source_title.clone(),@@ -11774,7 +11775,7 @@ mod tests {// Unknown session ids should still produce no content.let missing = cx.update(|cx| {AgentPanel::initial_content_for_thread_summary(- acp::SessionId::new("does-not-exist"),+ acp_v2::SessionId::new("does-not-exist"),cx,)});@@ -13955,9 +13956,9 @@ mod tests {#[derive(Clone, Default)]struct DisassociationTrackingConnection {next_session_number: Arc<Mutex<usize>>,- sessions: Arc<Mutex<HashSet<acp::SessionId>>>,- closed_sessions: Arc<Mutex<Vec<acp::SessionId>>>,- missing_prompt_sessions: Arc<Mutex<Vec<acp::SessionId>>>,+ sessions: Arc<Mutex<HashSet<acp_v2::SessionId>>>,+ closed_sessions: Arc<Mutex<Vec<acp_v2::SessionId>>>,+ missing_prompt_sessions: Arc<Mutex<Vec<acp_v2::SessionId>>>,}impl DisassociationTrackingConnection {@@ -13967,7 +13968,7 @@ mod tests {fn create_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -14014,7 +14015,7 @@ mod tests {) -> Task<Result<Entity<AcpThread>>> {let session_id = {let mut next_session_number = self.next_session_number.lock();- let session_id = acp::SessionId::new(format!(+ let session_id = acp_v2::SessionId::new(format!("disassociation-tracking-session-{}",*next_session_number));@@ -14031,7 +14032,7 @@ mod tests {fn load_session(self: Rc<Self>,- session_id: acp::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,title: Option<SharedString>,@@ -14065,7 +14066,7 @@ mod tests {fn close_session(self: Rc<Self>,- session_id: &acp::SessionId,+ session_id: &acp_v2::SessionId,_cx: &mut App,) -> Task<Result<()>> {self.sessions.lock().remove(session_id);@@ -14090,7 +14091,7 @@ mod tests {params: acp_v2::PromptRequest,_cx: &mut App,) -> Task<Result<acp::PromptResponse>> {- let session_id = acp::SessionId::new(params.session_id.0);+ let session_id = params.session_id;if !self.sessions.lock().contains(&session_id) {self.missing_prompt_sessions.lock().push(session_id);return Task::ready(Err(anyhow!("Session not found")));@@ -14099,7 +14100,7 @@ mod tests {Task::ready(Ok(acp::PromptResponse::new(acp::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {selfdiff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rsindex eee943e6657..617921278ef 100644--- a/crates/agent_ui/src/agent_ui.rs+++ b/crates/agent_ui/src/agent_ui.rs@@ -41,7 +41,7 @@ use std::rc::Rc;use std::sync::Arc;use ::ui::IconName;-use agent_client_protocol::schema::{v1 as acp_v1, v2 as acp_v2};+use agent_client_protocol::schema::v2 as acp_v2;use agent_settings::{AgentProfileId, AgentSettings};use anyhow::Context as _;use command_palette_hooks::CommandPaletteFilter;@@ -511,7 +511,7 @@ where#[action(namespace = agent)]#[serde(deny_unknown_fields)]pub struct NewNativeAgentThreadFromSummary {- from_session_id: acp_v1::SessionId,+ from_session_id: acp_v2::SessionId,}#[derive(Debug, Default, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]@@ -594,7 +594,7 @@ impl Agent {/// Content to initialize new external agent with.pub enum AgentInitialContent {ThreadSummary {- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,title: Option<SharedString>,},ContentBlock {diff --git a/crates/agent_ui/src/completion_provider.rs b/crates/agent_ui/src/completion_provider.rsindex 6b6196c4382..80589fa87ab 100644--- a/crates/agent_ui/src/completion_provider.rs+++ b/crates/agent_ui/src/completion_provider.rs@@ -7,7 +7,7 @@ use std::sync::atomic::AtomicBool;use crate::DEFAULT_THREAD_TITLE;use crate::thread_metadata_store::{ThreadMetadata, ThreadMetadataStore};use acp_thread::MentionUri;-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use anyhow::Result;use editor::{CompletionProvider, Editor, code_context_menus::COMPLETION_MENU_MAX_WIDTH};use futures::FutureExt as _;diff --git a/crates/agent_ui/src/conversation_view.rs b/crates/agent_ui/src/conversation_view.rsindex e24db7f1fc3..ea6eac30693 100644--- a/crates/agent_ui/src/conversation_view.rs+++ b/crates/agent_ui/src/conversation_view.rs@@ -284,10 +284,10 @@ impl ProfileProvider for Entity<agent::Thread> {#[derive(Default)]pub(crate) struct Conversation {- threads: HashMap<acp_v1::SessionId, Entity<AcpThread>>,- permission_requests: IndexMap<acp_v1::SessionId, Vec<PermissionRequestId>>,+ threads: HashMap<acp_v2::SessionId, Entity<AcpThread>>,+ permission_requests: IndexMap<acp_v2::SessionId, Vec<PermissionRequestId>>,permission_selections: HashMap<PermissionRequestId, thread_view::PermissionSelection>,- elicitation_requests: IndexMap<acp_v1::SessionId, Vec<ElicitationEntryId>>,+ elicitation_requests: IndexMap<acp_v2::SessionId, Vec<ElicitationEntryId>>,subscriptions: Vec<Subscription>,updated_at: Option<Instant>,}@@ -363,7 +363,7 @@ impl Conversation {fn set_permission_choice(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,request_id: PermissionRequestId,index: usize,cx: &mut Context<Self>,@@ -382,7 +382,7 @@ impl Conversation {fn toggle_permission_pattern(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,request_id: PermissionRequestId,pattern_index: usize,cx: &mut Context<Self>,@@ -415,7 +415,7 @@ impl Conversation {fn add_permission_request(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,request_id: &PermissionRequestId,) {let requests = self@@ -429,7 +429,7 @@ impl Conversation {fn permission_request<'a>(&'a self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,request_id: PermissionRequestId,cx: &'a App,) -> Option<&'a PermissionRequest> {@@ -441,7 +441,7 @@ impl Conversation {fn pending_permission_request_for_session<'a>(&'a self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &'a App,) -> Option<&'a PermissionRequest> {self.permission_requests@@ -452,9 +452,9 @@ impl Conversation {fn pending_permission_request<'a>(&'a self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &'a App,- ) -> Option<(acp_v1::SessionId, &'a PermissionRequest)> {+ ) -> Option<(acp_v2::SessionId, &'a PermissionRequest)> {if self.threads.get(session_id)?@@ -477,9 +477,9 @@ impl Conversation {pub fn pending_tool_call<'a>(&'a self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &'a App,- ) -> Option<(acp_v1::SessionId, acp_v1::ToolCallId, &'a PermissionOptions)> {+ ) -> Option<(acp_v2::SessionId, acp_v2::ToolCallId, &'a PermissionOptions)> {let (result_session_id, request) = self.pending_permission_request(session_id, cx)?;Some((result_session_id,@@ -488,7 +488,7 @@ impl Conversation {))}- pub fn subagents_awaiting_permission(&self, cx: &App) -> Vec<(acp_v1::SessionId, usize)> {+ pub fn subagents_awaiting_permission(&self, cx: &App) -> Vec<(acp_v2::SessionId, usize)> {self.permission_requests.iter().filter_map(|(session_id, _)| {@@ -508,9 +508,9 @@ impl Conversation {/// request for non-subagent sessions.pub fn pending_tool_call_for_session(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,- ) -> Option<acp_v1::ToolCallId> {+ ) -> Option<acp_v2::ToolCallId> {Some(self.pending_permission_request_for_session(session_id, cx)?.legacy_tool_call_id()?@@ -520,7 +520,7 @@ impl Conversation {pub fn pending_tool_call_count_for_session(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> usize {self.permission_requests@@ -538,7 +538,7 @@ impl Conversation {pub fn respond_to_elicitation(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,elicitation_id: ElicitationEntryId,response: acp_v2::CreateElicitationResponse,cx: &mut Context<Self>,@@ -552,7 +552,7 @@ impl Conversation {pub fn authorize_pending_tool_call(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,kind: acp_v1::PermissionOptionKind,cx: &mut Context<Self>,) -> Option<()> {@@ -569,7 +569,7 @@ impl Conversation {pub fn authorize_with_granularity(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,is_allow: bool,cx: &mut Context<Self>,@@ -587,8 +587,8 @@ impl Conversation {#[cfg(test)]fn authorize_tool_call(&mut self,- session_id: acp_v1::SessionId,- tool_call_id: acp_v1::ToolCallId,+ session_id: acp_v2::SessionId,+ tool_call_id: acp_v2::ToolCallId,outcome: SelectedPermissionOutcome,cx: &mut Context<Self>,) {@@ -604,7 +604,7 @@ impl Conversation {pub fn authorize_permission_request(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,outcome: SelectedPermissionOutcome,cx: &mut Context<Self>,@@ -638,7 +638,7 @@ impl Conversation {fn select_permission_option(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,request_id: PermissionRequestId,option_id: acp_v2::PermissionOptionId,cx: &mut Context<Self>,@@ -654,7 +654,7 @@ impl Conversation {fn cancel_permission_request(&mut self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,request_id: PermissionRequestId,cx: &mut Context<Self>,) {@@ -782,7 +782,7 @@ pub struct ConversationView {project: Entity<Project>,thread_store: Option<Entity<ThreadStore>>,pub(crate) thread_id: ThreadId,- pub(crate) root_session_id: Option<acp_v1::SessionId>,+ pub(crate) root_session_id: Option<acp_v2::SessionId>,server_state: ServerState,pending_selections: Vec<AgentContextSelection>,focus_handle: FocusHandle,@@ -828,7 +828,7 @@ impl ConversationView {pub fn pending_tool_call<'a>(&'a self,cx: &'a App,- ) -> Option<(acp_v1::SessionId, acp_v1::ToolCallId, &'a PermissionOptions)> {+ ) -> Option<(acp_v2::SessionId, acp_v2::ToolCallId, &'a PermissionOptions)> {let session_id = self.active_thread()?.read(cx).session_id.clone();self.as_connected()?.conversation@@ -861,7 +861,7 @@ impl ConversationView {.and_then(|id| self.thread_view(id))}- pub fn thread_view(&self, session_id: &acp_v1::SessionId) -> Option<Entity<ThreadView>> {+ pub fn thread_view(&self, session_id: &acp_v2::SessionId) -> Option<Entity<ThreadView>> {let connected = self.as_connected()?;connected.threads.get(session_id).cloned()}@@ -887,7 +887,7 @@ impl ConversationView {pub fn navigate_to_thread(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,window: &mut Window,cx: &mut Context<Self>,) {@@ -928,8 +928,8 @@ enum ServerState {// hashmap of threads, current becomes session_idpub struct ConnectedServerState {auth_state: AuthState,- active_id: Option<acp_v1::SessionId>,- pub(crate) threads: HashMap<acp_v1::SessionId, Entity<ThreadView>>,+ active_id: Option<acp_v2::SessionId>,+ pub(crate) threads: HashMap<acp_v2::SessionId, Entity<ThreadView>>,connection: Rc<dyn AgentConnection>,conversation: Entity<Conversation>,_connection_entry_subscription: Subscription,@@ -964,7 +964,7 @@ impl ConnectedServerState {.map_or(false, |view| view.read(cx).thread_error.is_some())}- pub fn navigate_to_thread(&mut self, session_id: acp_v1::SessionId) {+ pub fn navigate_to_thread(&mut self, session_id: acp_v2::SessionId) {if self.threads.contains_key(&session_id) {self.active_id = Some(session_id);}@@ -991,7 +991,7 @@ impl ConversationView {agent: Rc<dyn AgentServer>,connection_store: Entity<AgentConnectionStore>,connection_key: Agent,- resume_session_id: Option<acp_v1::SessionId>,+ resume_session_id: Option<acp_v2::SessionId>,thread_id: Option<ThreadId>,work_dirs: Option<PathList>,title: Option<SharedString>,@@ -1224,7 +1224,7 @@ impl ConversationView {agent: Rc<dyn AgentServer>,connection_store: Entity<AgentConnectionStore>,connection_key: Agent,- resume_session_id: Option<acp_v1::SessionId>,+ resume_session_id: Option<acp_v2::SessionId>,work_dirs: Option<PathList>,title: Option<SharedString>,project: Entity<Project>,@@ -2323,8 +2323,8 @@ impl ConversationView {fn load_subagent_session(&mut self,- subagent_id: acp_v1::SessionId,- parent_session_id: acp_v1::SessionId,+ subagent_id: acp_v2::SessionId,+ parent_session_id: acp_v2::SessionId,window: &mut Window,cx: &mut Context<Self>,) {@@ -3584,7 +3584,7 @@ fn loading_contents_spinner(size: IconSize) -> AnyElement {fn native_available_skills(native_connection: &agent::NativeAgentConnection,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,cx: &App,) -> Vec<AvailableSkill> {native_connection@@ -3637,7 +3637,7 @@ impl ConversationView {impl ConversationView {/// Expands a tool call so its content is visible./// This is primarily useful for visual testing.- pub fn expand_tool_call(&mut self, tool_call_id: acp_v1::ToolCallId, cx: &mut Context<Self>) {+ pub fn expand_tool_call(&mut self, tool_call_id: acp_v2::ToolCallId, cx: &mut Context<Self>) {if let Some(active) = self.active_thread() {active.update(cx, |active, cx| {active.entry_view_state.update(cx, |state, _cx| {@@ -5419,7 +5419,7 @@ pub(crate) mod tests {let root_thread =active_thread(&conversation_view, cx).read_with(cx, |view, _| view.thread.clone());let root_session_id = root_thread.read_with(cx, |thread, _| thread.session_id().clone());- let other_session_id = acp_v1::SessionId::new("other-session");+ let other_session_id = acp_v2::SessionId::new("other-session");conversation_view.update_in(cx, |view, window, cx| {view.load_subagent_session(other_session_id.clone(),@@ -5669,7 +5669,7 @@ pub(crate) mod tests {Rc::new(StubAgentServer::new(ResumeOnlyAgentConnection)),connection_store,Agent::Custom { id: "Test".into() },- Some(acp_v1::SessionId::new("resume-session")),+ Some(acp_v2::SessionId::new("resume-session")),None,None,None,@@ -5718,7 +5718,7 @@ pub(crate) mod tests {self,project,"RestoredAvailableCommandsConnection",- acp_v1::SessionId::new("new-session"),+ acp_v2::SessionId::new("new-session"),cx,);Task::ready(Ok(thread))@@ -5730,7 +5730,7 @@ pub(crate) mod tests {fn load_session(self: Rc<Self>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,_work_dirs: PathList,title: Option<SharedString>,@@ -5803,7 +5803,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -5832,7 +5832,7 @@ pub(crate) mod tests {)),connection_store,Agent::Custom { id: "Test".into() },- Some(acp_v1::SessionId::new("restored-session")),+ Some(acp_v2::SessionId::new("restored-session")),None,None,None,@@ -5977,7 +5977,7 @@ pub(crate) mod tests {});let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());let thread_id = ThreadId::new();- let session_id = acp_v1::SessionId::new(format!("early-title-{index}"));+ let session_id = acp_v2::SessionId::new(format!("early-title-{index}"));cx.update(|_, cx| {ThreadMetadataStore::global(cx).update(cx, |store, cx| {store.save(@@ -6103,7 +6103,7 @@ pub(crate) mod tests {Rc::new(StubAgentServer::new(connection)),connection_store,Agent::Custom { id: "Test".into() },- Some(acp_v1::SessionId::new("session-1")),+ Some(acp_v2::SessionId::new("session-1")),None,Some(PathList::new(&[PathBuf::from("/project/subdir")])),None,@@ -6209,7 +6209,7 @@ pub(crate) mod tests {cx.update(|_window, cx| cx.new(|cx| AgentConnectionStore::new(project.clone(), cx)));// Simulate a previous run that persisted metadata for this session.- let resume_session_id = acp_v1::SessionId::new("persistent-session");+ let resume_session_id = acp_v2::SessionId::new("persistent-session");let stored_title: SharedString = "Persistent chat".into();cx.update(|_window, cx| {ThreadMetadataStore::global(cx).update(cx, |store, cx| {@@ -6682,10 +6682,11 @@ pub(crate) mod tests {async fn test_notification_for_tool_authorization(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Label")- .kind(acp_v1::ToolKind::Edit)- .content(vec!["hi".into()]);+ let tool_call_id = acp_v2::ToolCallId::new("1");+ let tool_call =+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(tool_call_id.0.clone()), "Label")+ .kind(acp_v1::ToolKind::Edit)+ .content(vec!["hi".into()]);let connection =StubAgentConnection::new().with_permission_requests(HashMap::from_iter([(tool_call_id,@@ -8056,7 +8057,7 @@ pub(crate) mod tests {connection: Rc<dyn AgentConnection>,project: Entity<Project>,name: &'static str,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,cx: &mut App,) -> Entity<AcpThread> {let action_log = cx.new(|_| ActionLog::new(project.clone()));@@ -8100,7 +8101,7 @@ pub(crate) mod tests {_work_dirs: PathList,cx: &mut App,) -> Task<gpui::Result<Entity<AcpThread>>> {- let session_id = acp_v1::SessionId::new("new-session");+ let session_id = acp_v2::SessionId::new("new-session");let thread = build_test_thread(self.clone(),project,@@ -8113,9 +8114,7 @@ pub(crate) mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0,- )),+ acp_v2::ElicitationSessionScope::new(session_id),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",@@ -8158,7 +8157,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -8221,7 +8220,7 @@ pub(crate) mod tests {self.clone(),project,"SessionCreationRequestElicitationConnection",- acp_v1::SessionId::new("session-creation-request-elicitation-session"),+ acp_v2::SessionId::new("session-creation-request-elicitation-session"),cx,);let first_response_task = self.store.update(cx, |store, cx| {@@ -8289,7 +8288,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -8351,7 +8350,7 @@ pub(crate) mod tests {self.clone(),project,"ReleaseRequestElicitationConnection",- acp_v1::SessionId::new("release-request-elicitation-session"),+ acp_v2::SessionId::new("release-request-elicitation-session"),cx,);let response_task = self.store.update(cx, |store, cx| {@@ -8401,7 +8400,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -8430,7 +8429,7 @@ pub(crate) mod tests {self,project,"ResumeOnlyAgentConnection",- acp_v1::SessionId::new("new-session"),+ acp_v2::SessionId::new("new-session"),cx,);Task::ready(Ok(thread))@@ -8442,7 +8441,7 @@ pub(crate) mod tests {fn resume_session(self: Rc<Self>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,_work_dirs: PathList,_title: Option<SharedString>,@@ -8473,7 +8472,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -8559,7 +8558,7 @@ pub(crate) mod tests {.into()));}- let session_id = acp_v1::SessionId::new("auth-gated-session");+ let session_id = acp_v2::SessionId::new("auth-gated-session");let action_log = cx.new(|_| ActionLog::new(project.clone()));Task::ready(Ok(cx.new(|cx| {AcpThread::new(@@ -8625,7 +8624,7 @@ pub(crate) mod tests {unimplemented!()}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {unimplemented!()}@@ -8662,7 +8661,7 @@ pub(crate) mod tests {self,project,action_log,- acp_v1::SessionId::new("test"),+ acp_v2::SessionId::new("test"),watch::Receiver::constant(acp_v2::PromptCapabilities::new().image(acp_v2::PromptImageCapabilities::new())@@ -8694,7 +8693,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::Refusal)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {unimplemented!()}@@ -8741,7 +8740,7 @@ pub(crate) mod tests {self.clone(),project,action_log,- acp_v1::SessionId::new("new-session"),+ acp_v2::SessionId::new("new-session"),watch::Receiver::constant(acp_v2::PromptCapabilities::new().image(acp_v2::PromptImageCapabilities::new())@@ -8760,7 +8759,7 @@ pub(crate) mod tests {fn load_session(self: Rc<Self>,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,project: Entity<Project>,work_dirs: PathList,_title: Option<SharedString>,@@ -8809,7 +8808,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {self@@ -9296,13 +9295,16 @@ pub(crate) mod tests {) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("ask-user-1");+ let tool_call_id = acp_v2::ToolCallId::new("ask-user-1");let connection = StubAgentConnection::new();connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_call_id.clone(), "Which directory should we explore?")- .kind(acp_v1::ToolKind::Other)- .status(acp_v1::ToolCallStatus::InProgress)- .meta(acp_thread::meta_with_tool_name("ask_user")),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Which directory should we explore?",+ )+ .kind(acp_v1::ToolKind::Other)+ .status(acp_v1::ToolCallStatus::InProgress)+ .meta(acp_thread::meta_with_tool_name("ask_user")),)]);let (conversation_view, cx) =@@ -9328,10 +9330,8 @@ pub(crate) mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0.clone(),- ))- .tool_call_id(acp_v2::ToolCallId::new(tool_call_id.0.clone())),+ acp_v2::ElicitationSessionScope::new(session_id.clone())+ .tool_call_id(tool_call_id.clone()),acp_v2::ElicitationSchema::new().string("other", true),),"Which directory should we explore?",@@ -9372,7 +9372,7 @@ pub(crate) mod tests {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new().title("Answered: delve into src").status(acp_v1::ToolCallStatus::Completed),@@ -9415,12 +9415,15 @@ pub(crate) mod tests {async fn test_scroll_to_user_message_skips_accepted_url_elicitation(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("sign-in-1");+ let tool_call_id = acp_v2::ToolCallId::new("sign-in-1");let connection = StubAgentConnection::new();connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_call_id.clone(), "Sign in to continue")- .kind(acp_v1::ToolKind::Other)- .status(acp_v1::ToolCallStatus::InProgress),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Sign in to continue",+ )+ .kind(acp_v1::ToolKind::Other)+ .status(acp_v1::ToolCallStatus::InProgress),)]);let (conversation_view, cx) =@@ -9446,10 +9449,8 @@ pub(crate) mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationUrlMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0.clone(),- ))- .tool_call_id(acp_v2::ToolCallId::new(tool_call_id.0.clone())),+ acp_v2::ElicitationSessionScope::new(session_id.clone())+ .tool_call_id(tool_call_id.clone()),acp_v2::ElicitationId::new("sign-in-url-1"),"https://example.com/sign-in",),@@ -10311,13 +10312,16 @@ pub(crate) mod tests {async fn test_thread_search_includes_expanded_tool_call_content(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("search-tool-content");+ let tool_call_id = acp_v2::ToolCallId::new("search-tool-content");let connection = StubAgentConnection::new();connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_call_id.clone(), "Inspect output")- .kind(acp_v1::ToolKind::Other)- .status(acp_v1::ToolCallStatus::Completed)- .content(vec!["Tool output mentions papaya once.".into()]),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Inspect output",+ )+ .kind(acp_v1::ToolKind::Other)+ .status(acp_v1::ToolCallStatus::Completed)+ .content(vec!["Tool output mentions papaya once.".into()]),)]);let (conversation_view, cx) =@@ -10474,7 +10478,7 @@ pub(crate) mod tests {setup_conversation_view(StubAgentServer::default_response(), cx).await;let thread_view = active_thread(&conversation_view, cx);let thread = thread_view.read_with(cx, |view, _| view.thread.clone());- let tool_call_id = acp_v1::ToolCallId::new("new-patch");+ let tool_call_id = acp_v2::ToolCallId::new("new-patch");let patch: acp_v2::ToolCallUpdate = serde_json::from_value(json!({"toolCallId": "new-patch",@@ -10564,7 +10568,7 @@ pub(crate) mod tests {setup_conversation_view(StubAgentServer::default_response(), cx).await;let thread_view = active_thread(&conversation_view, cx);let thread = thread_view.read_with(cx, |view, _| view.thread.clone());- let tool_call_id = acp_v1::ToolCallId::new("authorization-patch");+ let tool_call_id = acp_v2::ToolCallId::new("authorization-patch");let patch: acp_v2::ToolCallUpdate = serde_json::from_value(json!({"toolCallId": "authorization-patch","title": "Review patch",@@ -10589,7 +10593,7 @@ pub(crate) mod tests {.update(cx, |thread, cx| {thread.request_tool_call_authorization(acp_v1::ToolCallUpdate::new(- tool_call_id.clone(),+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),acp_v1::ToolCallUpdateFields::new(),),PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(@@ -10671,7 +10675,7 @@ pub(crate) mod tests {setup_conversation_view(StubAgentServer::new(StubAgentConnection::new()), cx).await;let thread_view = active_thread(&conversation_view, cx);let thread = thread_view.read_with(cx, |view, _| view.thread.clone());- let tool_call_id = acp_v1::ToolCallId::new("shared-search-tool");+ let tool_call_id = acp_v2::ToolCallId::new("shared-search-tool");let patch: acp_v2::ToolCallUpdate = serde_json::from_value(json!({"toolCallId": "shared-search-tool",@@ -11033,8 +11037,8 @@ pub(crate) mod tests {add_to_workspace(conversation_view.clone(), cx);let thread_view = active_thread(&conversation_view, cx);let thread = thread_view.read_with(cx, |view, _| view.thread.clone());- let tool_call_id = acp_v1::ToolCallId::new("historical-chunks");- let later_tool_call_id = acp_v1::ToolCallId::new("later-tool");+ let tool_call_id = acp_v2::ToolCallId::new("historical-chunks");+ let later_tool_call_id = acp_v2::ToolCallId::new("later-tool");for (id, text) in [("historical-chunks", "Original mango output"),("later-tool", "Unchanged later output"),@@ -11694,7 +11698,7 @@ pub(crate) mod tests {);thread.read_with(cx, |thread, cx| {let (_, call) = thread- .tool_call(&acp_v1::ToolCallId::new("tool"))+ .tool_call(&acp_v2::ToolCallId::new("tool")).expect("tool call should exist");assert_eq!(!call.label.read(cx).search_highlights().is_empty(),@@ -13507,7 +13511,7 @@ pub(crate) mod tests {cx.run_until_parked();let entry_state = thread_view.read_with(cx, |view, _| view.entry_view_state.clone());entry_state.update(cx, |state, cx| {- state.expand_tool_call(acp_v1::ToolCallId::new("tool"));+ state.expand_tool_call(acp_v2::ToolCallId::new("tool"));cx.notify();});let terminal = thread.read_with(cx, |thread, _| {@@ -13638,7 +13642,7 @@ pub(crate) mod tests {let thread_view = active_thread(&conversation_view, cx);let thread = thread_view.read_with(cx, |view, _| view.thread.clone());let terminal_id = acp_v1::TerminalId::new("provider-terminal");- let tool_id = acp_v1::ToolCallId::new("provider-tool");+ let tool_id = acp_v2::ToolCallId::new("provider-tool");let terminal = cx.new(|cx| {terminal::TerminalBuilder::new_display_only(Default::default(),@@ -13665,12 +13669,17 @@ pub(crate) mod tests {thread.handle_session_update(acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_id.clone(), "provider command")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::InProgress)- .content(vec![acp_v1::ToolCallContent::Terminal(- acp_v1::Terminal::new(terminal_id.clone()),- )]),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_id.0.clone()),+ "provider command",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::InProgress)+ .content(vec![+ acp_v1::ToolCallContent::Terminal(acp_v1::Terminal::new(+ terminal_id.clone(),+ )),+ ]),),cx,)@@ -13730,7 +13739,7 @@ pub(crate) mod tests {thread.handle_session_update(acp_v1::SessionUpdate::ToolCallUpdate(acp_v1::ToolCallUpdate::new(- tool_id.clone(),+ acp_v1::ToolCallId::new(tool_id.0.clone()),acp_v1::ToolCallUpdateFields::new().status(acp_v1::ToolCallStatus::Completed),)),@@ -13769,7 +13778,7 @@ pub(crate) mod tests {let thread_view = active_thread(&conversation_view, cx);let thread = thread_view.read_with(cx, |view, _| view.thread.clone());let terminal_id = acp_v1::TerminalId::new("acp-owned-terminal");- let tool_id = acp_v1::ToolCallId::new("acp-owned-tool");+ let tool_id = acp_v2::ToolCallId::new("acp-owned-tool");let lower_terminal = cx.new(|cx| {terminal::TerminalBuilder::new_display_only(Default::default(),@@ -13795,12 +13804,15 @@ pub(crate) mod tests {thread.handle_session_update(acp_v1::SessionUpdate::ToolCall(- acp_v1::ToolCall::new(tool_id.clone(), "client-owned command")- .kind(acp_v1::ToolKind::Execute)- .status(acp_v1::ToolCallStatus::InProgress)- .content(vec![acp_v1::ToolCallContent::Terminal(- acp_v1::Terminal::new(terminal_id),- )]),+ acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_id.0.clone()),+ "client-owned command",+ )+ .kind(acp_v1::ToolKind::Execute)+ .status(acp_v1::ToolCallStatus::InProgress)+ .content(vec![acp_v1::ToolCallContent::Terminal(+ acp_v1::Terminal::new(terminal_id),+ )]),),cx,)@@ -13843,9 +13855,12 @@ pub(crate) mod tests {async fn test_tool_permission_buttons_terminal_with_pattern(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("terminal-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Run `cargo build --release`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("terminal-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `cargo build --release`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options = ToolPermissionContext::new(TerminalTool::NAME,@@ -13957,9 +13972,12 @@ pub(crate) mod tests {async fn test_tool_permission_buttons_edit_file_with_path_pattern(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("edit-file-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Edit `src/main.rs`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("edit-file-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Edit `src/main.rs`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options =ToolPermissionContext::new(EditFileTool::NAME, vec!["src/main.rs".to_string()])@@ -14049,9 +14067,12 @@ pub(crate) mod tests {async fn test_tool_permission_buttons_fetch_with_domain_pattern(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("fetch-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Fetch `https://docs.rs/gpui`")- .kind(acp_v1::ToolKind::Fetch);+ let tool_call_id = acp_v2::ToolCallId::new("fetch-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Fetch `https://docs.rs/gpui`",+ )+ .kind(acp_v1::ToolKind::Fetch);let permission_options =ToolPermissionContext::new(FetchTool::NAME, vec!["https://docs.rs/gpui".to_string()])@@ -14141,10 +14162,12 @@ pub(crate) mod tests {async fn test_tool_permission_buttons_without_pattern(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("terminal-no-pattern-1");- let tool_call =- acp_v1::ToolCall::new(tool_call_id.clone(), "Run `./deploy.sh --production`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("terminal-no-pattern-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `./deploy.sh --production`",+ )+ .kind(acp_v1::ToolKind::Edit);// No pattern button since ./deploy.sh doesn't match the alphanumeric patternlet permission_options = ToolPermissionContext::new(@@ -14248,9 +14271,12 @@ pub(crate) mod tests {async fn test_authorize_tool_call_action_triggers_authorization(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("action-test-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Run `cargo test`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("action-test-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `cargo test`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options =ToolPermissionContext::new(TerminalTool::NAME, vec!["cargo test".to_string()])@@ -14328,9 +14354,12 @@ pub(crate) mod tests {async fn test_authorize_tool_call_action_with_pattern_option(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("pattern-action-test-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Run `npm install`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("pattern-action-test-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `npm install`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options =ToolPermissionContext::new(TerminalTool::NAME, vec!["npm install".to_string()])@@ -14409,9 +14438,12 @@ pub(crate) mod tests {async fn test_granularity_selection_updates_state(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("granularity-test-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Run `cargo build`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("granularity-test-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `cargo build`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options =ToolPermissionContext::new(TerminalTool::NAME, vec!["cargo build".to_string()])@@ -14511,9 +14543,12 @@ pub(crate) mod tests {async fn test_allow_button_uses_selected_granularity(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("allow-granularity-test-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Run `npm install`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("allow-granularity-test-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `npm install`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options =ToolPermissionContext::new(TerminalTool::NAME, vec!["npm install".to_string()])@@ -14610,9 +14645,12 @@ pub(crate) mod tests {async fn test_deny_button_uses_selected_granularity(cx: &mut TestAppContext) {init_test(cx);- let tool_call_id = acp_v1::ToolCallId::new("deny-granularity-test-1");- let tool_call = acp_v1::ToolCall::new(tool_call_id.clone(), "Run `git push`")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id = acp_v2::ToolCallId::new("deny-granularity-test-1");+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id.0.clone()),+ "Run `git push`",+ )+ .kind(acp_v1::ToolKind::Edit);let permission_options =ToolPermissionContext::new(TerminalTool::NAME, vec!["git push".to_string()])@@ -15106,7 +15144,7 @@ pub(crate) mod tests {}fn create_test_acp_thread(- parent_session_id: Option<acp_v1::SessionId>,+ parent_session_id: Option<acp_v2::SessionId>,session_id: &str,connection: Rc<dyn AgentConnection>,project: Entity<Project>,@@ -15121,7 +15159,7 @@ pub(crate) mod tests {connection,project,action_log,- acp_v1::SessionId::new(session_id),+ acp_v2::SessionId::new(session_id),watch::Receiver::constant(acp_v2::PromptCapabilities::new()),cx,)@@ -15156,13 +15194,13 @@ pub(crate) mod tests {PermissionRequestId,Task<acp_thread::RequestPermissionOutcome>,) {- let tool_call_id = acp_v1::ToolCallId::new(tool_call_id);+ let tool_call_id = acp_v2::ToolCallId::new(tool_call_id);let label = format!("Tool {tool_call_id}");cx.update(|cx| {thread.update(cx, |thread, cx| {thread.request_tool_call_authorization_with_id(- acp_v1::ToolCall::new(tool_call_id, label)+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(tool_call_id.0), label).kind(acp_v1::ToolKind::Edit).into(),options,@@ -15227,7 +15265,7 @@ pub(crate) mod tests {(view.thread.clone(), view.conversation.clone())});let root_session_id = root.read_with(cx, |thread, _| thread.session_id().clone());- let child_session_id = acp_v1::SessionId::new("embedded-permission-child");+ let child_session_id = acp_v2::SessionId::new("embedded-permission-child");let child_view = conversation_view.update_in(cx, |view, window, cx| {let child = create_test_acp_thread(Some(root_session_id.clone()),@@ -15692,7 +15730,7 @@ pub(crate) mod tests {let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let session_id = acp_v1::SessionId::new("session-1");+ let session_id = acp_v2::SessionId::new("session-1");let (thread, conversation) = cx.update(|cx| {let thread =create_test_acp_thread(None, "session-1", connection.clone(), project.clone(), cx);@@ -15712,14 +15750,14 @@ pub(crate) mod tests {.read(cx).pending_tool_call(&session_id, cx).expect("Expected a pending tool call");- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("tc-1"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("tc-1"));});cx.update(|cx| {conversation.update(cx, |conversation, cx| {conversation.authorize_tool_call(session_id.clone(),- acp_v1::ToolCallId::new("tc-1"),+ acp_v2::ToolCallId::new("tc-1"),SelectedPermissionOutcome::new(acp_v1::PermissionOptionId::new("allow-1"),acp_v1::PermissionOptionKind::AllowOnce,@@ -15736,14 +15774,14 @@ pub(crate) mod tests {.read(cx).pending_tool_call(&session_id, cx).expect("Expected tc-2 to be pending after tc-1 was authorized");- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("tc-2"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("tc-2"));});cx.update(|cx| {conversation.update(cx, |conversation, cx| {conversation.authorize_tool_call(session_id.clone(),- acp_v1::ToolCallId::new("tc-2"),+ acp_v2::ToolCallId::new("tc-2"),SelectedPermissionOutcome::new(acp_v1::PermissionOptionId::new("allow-2"),acp_v1::PermissionOptionKind::AllowOnce,@@ -15774,8 +15812,8 @@ pub(crate) mod tests {let fs = FakeFs::new(cx.executor());let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let root_session_id = acp_v1::SessionId::new("root");- let child_session_id = acp_v1::SessionId::new("child");+ let root_session_id = acp_v2::SessionId::new("root");+ let child_session_id = acp_v2::SessionId::new("child");let (root, child) = cx.update(|cx| {let root =create_test_acp_thread(None, "root", connection.clone(), project.clone(), cx);@@ -15893,8 +15931,8 @@ pub(crate) mod tests {let fs = FakeFs::new(cx.executor());let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let root_session_id = acp_v1::SessionId::new("root");- let child_session_id = acp_v1::SessionId::new("child");+ let root_session_id = acp_v2::SessionId::new("root");+ let child_session_id = acp_v2::SessionId::new("child");let (root, child, conversation) = cx.update(|cx| {let root =create_test_acp_thread(None, "root", connection.clone(), project.clone(), cx);@@ -15978,13 +16016,13 @@ pub(crate) mod tests {let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let parent_session_id = acp_v1::SessionId::new("parent");- let subagent_session_id = acp_v1::SessionId::new("subagent");+ let parent_session_id = acp_v2::SessionId::new("parent");+ let subagent_session_id = acp_v2::SessionId::new("subagent");let (parent_thread, subagent_thread, conversation) = cx.update(|cx| {let parent_thread =create_test_acp_thread(None, "parent", connection.clone(), project.clone(), cx);let subagent_thread = create_test_acp_thread(- Some(acp_v1::SessionId::new("parent")),+ Some(acp_v2::SessionId::new("parent")),"subagent",connection.clone(),project.clone(),@@ -16012,7 +16050,7 @@ pub(crate) mod tests {.pending_tool_call(&subagent_session_id, cx).expect("Expected subagent's pending tool call");assert_eq!(returned_session_id, subagent_session_id);- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("subagent-tc"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("subagent-tc"));});// Querying with the parent's session ID returns the first pending@@ -16023,7 +16061,7 @@ pub(crate) mod tests {.pending_tool_call(&parent_session_id, cx).expect("Expected a pending tool call from parent query");assert_eq!(returned_session_id, parent_session_id);- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("parent-tc"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("parent-tc"));});}@@ -16035,8 +16073,8 @@ pub(crate) mod tests {let fs = FakeFs::new(cx.executor());let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let parent_session_id = acp_v1::SessionId::new("parent");- let subagent_session_id = acp_v1::SessionId::new("subagent");+ let parent_session_id = acp_v2::SessionId::new("parent");+ let subagent_session_id = acp_v2::SessionId::new("subagent");let (subagent_thread, conversation) = cx.update(|cx| {let parent_thread =create_test_acp_thread(None, "parent", connection.clone(), project.clone(), cx);@@ -16059,7 +16097,7 @@ pub(crate) mod tests {request_test_tool_authorization(&subagent_thread, "resolved-tool", "allow-child", cx);subagent_thread.update(cx, |thread, cx| {thread.authorize_tool_call(- acp_v1::ToolCallId::new("resolved-tool"),+ acp_v2::ToolCallId::new("resolved-tool"),SelectedPermissionOutcome::new(acp_v1::PermissionOptionId::new("allow-child"),acp_v1::PermissionOptionKind::AllowOnce,@@ -16096,7 +16134,7 @@ pub(crate) mod tests {request_test_tool_authorization(&subagent_thread, "later-tool", "allow-child", cx);for (tool_id, pending_count) in [("child-tool", 3), ("queued-tool", 2), ("later-tool", 1)] {- let tool_id = acp_v1::ToolCallId::new(tool_id);+ let tool_id = acp_v2::ToolCallId::new(tool_id);conversation.read_with(cx, |conversation, cx| {assert_eq!(conversation.pending_tool_call_for_session(&subagent_session_id, cx),@@ -16145,8 +16183,8 @@ pub(crate) mod tests {let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let session_id_a = acp_v1::SessionId::new("thread-a");- let session_id_b = acp_v1::SessionId::new("thread-b");+ let session_id_a = acp_v2::SessionId::new("thread-a");+ let session_id_b = acp_v2::SessionId::new("thread-b");let (thread_a, thread_b, conversation) = cx.update(|cx| {let thread_a =create_test_acp_thread(None, "thread-a", connection.clone(), project.clone(), cx);@@ -16172,7 +16210,7 @@ pub(crate) mod tests {.pending_tool_call(&session_id_a, cx).expect("Expected a pending tool call");assert_eq!(returned_session_id, session_id_a);- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("tc-a"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("tc-a"));});// Querying with thread-b also returns thread-a's tool call,@@ -16186,7 +16224,7 @@ pub(crate) mod tests {returned_session_id, session_id_a,"Non-subagent queries always return the first pending request in FIFO order");- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("tc-a"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("tc-a"));});// After authorizing thread-a's tool call, thread-b's becomes first@@ -16194,7 +16232,7 @@ pub(crate) mod tests {conversation.update(cx, |conversation, cx| {conversation.authorize_tool_call(session_id_a.clone(),- acp_v1::ToolCallId::new("tc-a"),+ acp_v2::ToolCallId::new("tc-a"),SelectedPermissionOutcome::new(acp_v1::PermissionOptionId::new("allow-a"),acp_v1::PermissionOptionKind::AllowOnce,@@ -16212,7 +16250,7 @@ pub(crate) mod tests {.pending_tool_call(&session_id_b, cx).expect("Expected thread-b's tool call after thread-a's was authorized");assert_eq!(returned_session_id, session_id_b);- assert_eq!(tool_call_id, acp_v1::ToolCallId::new("tc-b"));+ assert_eq!(tool_call_id, acp_v2::ToolCallId::new("tc-b"));});}@@ -16600,7 +16638,7 @@ pub(crate) mod tests {(view.thread.clone(), view.conversation.clone())});let root_session_id = root.read_with(cx, |thread, _| thread.session_id().clone());- let child_session_id = acp_v1::SessionId::new("generic-child");+ let child_session_id = acp_v2::SessionId::new("generic-child");let child_view = conversation_view.update_in(cx, |view, window, cx| {let child = create_test_acp_thread(Some(root_session_id.clone()),@@ -16708,7 +16746,7 @@ pub(crate) mod tests {cx.run_until_parked();for queued_event in [false, true] {- let child_session_id = acp_v1::SessionId::new(if queued_event {+ let child_session_id = acp_v2::SessionId::new(if queued_event {"queued-generic-child"} else {"late-generic-child"@@ -16799,9 +16837,12 @@ pub(crate) mod tests {usize,&'a mut VisualTestContext,) {- let tool_call_id_value = acp_v1::ToolCallId::new(tool_call_id);- let tool_call = acp_v1::ToolCall::new(tool_call_id_value.clone(), "Run something")- .kind(acp_v1::ToolKind::Edit);+ let tool_call_id_value = acp_v2::ToolCallId::new(tool_call_id);+ let tool_call = acp_v1::ToolCall::new(+ acp_v1::ToolCallId::new(tool_call_id_value.0.clone()),+ "Run something",+ )+ .kind(acp_v1::ToolKind::Edit);let connection =StubAgentConnection::new().with_permission_requests(HashMap::from_iter([(@@ -16921,8 +16962,8 @@ pub(crate) mod tests {let project = Project::test(fs, [], cx).await;let connection: Rc<dyn AgentConnection> = Rc::new(StubAgentConnection::new());- let session_id_a = acp_v1::SessionId::new("thread-a");- let session_id_b = acp_v1::SessionId::new("thread-b");+ let session_id_a = acp_v2::SessionId::new("thread-a");+ let session_id_b = acp_v2::SessionId::new("thread-b");let (thread_a, thread_b, conversation) = cx.update(|cx| {let thread_a =create_test_acp_thread(None, "thread-a", connection.clone(), project.clone(), cx);@@ -16947,13 +16988,13 @@ pub(crate) mod tests {.read(cx).pending_tool_call_for_session(&session_id_a, cx).expect("Expected a pending tool call in thread A");- assert_eq!(tool_call_id_a, acp_v1::ToolCallId::new("tc-a"));+ assert_eq!(tool_call_id_a, acp_v2::ToolCallId::new("tc-a"));let tool_call_id_b = conversation.read(cx).pending_tool_call_for_session(&session_id_b, cx).expect("Expected a pending tool call in thread B");- assert_eq!(tool_call_id_b, acp_v1::ToolCallId::new("tc-b"));+ assert_eq!(tool_call_id_b, acp_v2::ToolCallId::new("tc-b"));});}@@ -17737,7 +17778,7 @@ pub(crate) mod tests {#[derive(Clone)]struct CloseCapableConnection {- closed_sessions: Arc<Mutex<Vec<acp_v1::SessionId>>>,+ closed_sessions: Arc<Mutex<Vec<acp_v2::SessionId>>>,}impl CloseCapableConnection {@@ -17772,7 +17813,7 @@ pub(crate) mod tests {self,project,action_log,- acp_v1::SessionId::new("close-capable-session"),+ acp_v2::SessionId::new("close-capable-session"),watch::Receiver::constant(acp_v2::PromptCapabilities::new().image(acp_v2::PromptImageCapabilities::new())@@ -17791,7 +17832,7 @@ pub(crate) mod tests {fn close_session(self: Rc<Self>,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,_cx: &mut App,) -> Task<Result<()>> {self.closed_sessions.lock().push(session_id.clone());@@ -17818,7 +17859,7 @@ pub(crate) mod tests {Task::ready(Ok(acp_v1::PromptResponse::new(acp_v1::StopReason::EndTurn)))}- fn cancel(&self, _session_id: &acp_v1::SessionId, _cx: &mut App) {}+ fn cancel(&self, _session_id: &acp_v2::SessionId, _cx: &mut App) {}fn into_any(self: Rc<Self>) -> Rc<dyn Any> {selfdiff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rsindex bb39f454faa..45b33f5f860 100644--- a/crates/agent_ui/src/conversation_view/thread_view.rs+++ b/crates/agent_ui/src/conversation_view/thread_view.rs@@ -568,8 +568,8 @@ impl PermissionSelection {pub struct ThreadView {pub(crate) root_thread_id: ThreadId,- pub session_id: acp_v1::SessionId,- pub parent_session_id: Option<acp_v1::SessionId>,+ pub session_id: acp_v2::SessionId,+ pub parent_session_id: Option<acp_v2::SessionId>,pub thread: Entity<AcpThread>,pub(crate) conversation: Entity<super::Conversation>,pub server_view: WeakEntity<ConversationView>,@@ -595,14 +595,14 @@ pub struct ThreadView {thread_feedback: ThreadFeedbackState,pub list_state: ListState,pub session_capabilities: SharedSessionCapabilities,- pub expanded_tool_call_raw_inputs: HashSet<acp_v1::ToolCallId>,- collapsed_sandbox_authorization_details: HashSet<acp_v1::ToolCallId>,- collapsed_sandbox_network_details: HashSet<acp_v1::ToolCallId>,+ pub expanded_tool_call_raw_inputs: HashSet<acp_v2::ToolCallId>,+ collapsed_sandbox_authorization_details: HashSet<acp_v2::ToolCallId>,+ collapsed_sandbox_network_details: HashSet<acp_v2::ToolCallId>,/// Sandbox escalation prompts whose "surprising Unicode" warning the user/// has explicitly acknowledged. Until a prompt's tool call is in this set,/// its allow buttons stay disabled. See [`Self::sandbox_confusable_findings`].- acknowledged_confusable_warnings: HashSet<acp_v1::ToolCallId>,- pub subagent_scroll_handles: RefCell<HashMap<acp_v1::SessionId, ScrollHandle>>,+ acknowledged_confusable_warnings: HashSet<acp_v2::ToolCallId>,+ pub subagent_scroll_handles: RefCell<HashMap<acp_v2::SessionId, ScrollHandle>>,pub edits_expanded: bool,pub plan_expanded: bool,pub queue_expanded: bool,@@ -611,7 +611,7 @@ pub struct ThreadView {pub editing_message: Option<usize>,pub message_queue: MessageQueue,pub turn_fields: TurnFields,- pub discarded_partial_edits: HashSet<acp_v1::ToolCallId>,+ pub discarded_partial_edits: HashSet<acp_v2::ToolCallId>,pub is_loading_contents: bool,pub new_server_version_available: Option<SharedString>,pub resumed_without_history: bool,@@ -2942,7 +2942,7 @@ impl ThreadView {pub fn authorize_permission_request(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,outcome: SelectedPermissionOutcome,window: &mut Window,@@ -3262,9 +3262,9 @@ impl ThreadView {request_id: Option<PermissionRequestId>,tool_call_id: &str,cx: &App,- ) -> Option<(acp_v1::SessionId, PermissionRequestId)> {+ ) -> Option<(acp_v2::SessionId, PermissionRequestId)> {let session_id = session_id- .map(acp_v1::SessionId::new)+ .map(acp_v2::SessionId::new).unwrap_or_else(|| self.thread.read(cx).session_id().clone());let conversation = self.conversation.read(cx);let request = if let Some(id) = request_id {@@ -3274,7 +3274,7 @@ impl ThreadView {.threads.get(&session_id)?.read(cx)- .permission_request_for_tool(&acp_v1::ToolCallId::new(tool_call_id))?+ .permission_request_for_tool(&acp_v2::ToolCallId::new(tool_call_id))?};request.legacy_options()?;Some((session_id, request.id))@@ -3339,7 +3339,7 @@ impl ThreadView {fn authorize_with_granularity(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,is_allow: bool,window: &mut Window,@@ -3902,7 +3902,7 @@ impl ThreadView {fn collect_subagent_items_for_sessions(entries: &[AgentThreadEntry],- awaiting_session_ids: &[acp_v1::SessionId],+ awaiting_session_ids: &[acp_v2::SessionId],cx: &App,) -> Vec<(SharedString, usize)> {let tool_calls_by_session: HashMap<_, _> = entries@@ -3979,7 +3979,7 @@ impl ThreadView {pub(super) fn render_generic_permission_card(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,request: &acp_v2::RequestPermissionRequest,source: Option<String>,@@ -8477,7 +8477,7 @@ impl ThreadView {fn render_terminal_tool_call(&self,- active_session_id: &acp_v1::SessionId,+ active_session_id: &acp_v2::SessionId,entry_ix: usize,terminal: &Entity<acp_thread::Terminal>,tool_call: &ToolCall,@@ -8734,8 +8734,8 @@ impl ThreadView {fn is_first_tool_call(&self,- active_session_id: &acp_v1::SessionId,- tool_call_id: &acp_v1::ToolCallId,+ active_session_id: &acp_v2::SessionId,+ tool_call_id: &acp_v2::ToolCallId,cx: &App,) -> bool {self.conversation@@ -8749,7 +8749,7 @@ impl ThreadView {fn render_any_tool_call(&self,- active_session_id: &acp_v1::SessionId,+ active_session_id: &acp_v2::SessionId,entry_ix: usize,tool_call: &ToolCall,focus_handle: &FocusHandle,@@ -8816,7 +8816,7 @@ impl ThreadView {fn render_tool_call(&self,- active_session_id: &acp_v1::SessionId,+ active_session_id: &acp_v2::SessionId,entry_ix: usize,tool_call: &ToolCall,focus_handle: &FocusHandle,@@ -9359,7 +9359,7 @@ impl ThreadView {fn render_sandbox_authorization_details(&self,entry_ix: usize,- tool_call_id: &acp_v1::ToolCallId,+ tool_call_id: &acp_v2::ToolCallId,details: &SandboxAuthorizationDetails,window: &Window,cx: &Context<Self>,@@ -9709,7 +9709,7 @@ impl ThreadView {/// allow buttons. See [`Self::sandbox_confusables_block_allow`].fn render_sandbox_confusable_warning(&self,- tool_call_id: &acp_v1::ToolCallId,+ tool_call_id: &acp_v2::ToolCallId,findings: &[(String, Vec<unicode_confusables::SuspiciousChar>)],window: &Window,cx: &Context<Self>,@@ -10015,7 +10015,7 @@ impl ThreadView {fn render_permission_buttons(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,is_first: bool,request: &PermissionRequest,entry_ix: usize,@@ -10078,9 +10078,9 @@ impl ThreadView {choices: &[PermissionOptionChoice],patterns: Option<(&[PermissionPattern], &str)>,entry_ix: usize,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,- tool_call_id: acp_v1::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,focus_handle: &FocusHandle,allow_disabled: bool,cx: &Context<Self>,@@ -10219,9 +10219,9 @@ impl ThreadView {choices: &[PermissionOptionChoice],current_label: SharedString,entry_ix: usize,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,- tool_call_id: acp_v1::ToolCallId,+ tool_call_id: acp_v2::ToolCallId,selected_index: usize,is_first: bool,cx: &Context<Self>,@@ -10300,7 +10300,7 @@ impl ThreadView {_tool_name: &str,current_label: SharedString,entry_ix: usize,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,request_id: PermissionRequestId,is_first: bool,cx: &Context<Self>,@@ -10469,7 +10469,7 @@ impl ThreadView {fn render_permission_buttons_flat(&self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,is_first: bool,options: &[acp_v1::PermissionOption],entry_ix: usize,@@ -10868,7 +10868,7 @@ impl ThreadView {fn render_tool_call_content(&self,- session_id: &acp_v1::SessionId,+ session_id: &acp_v2::SessionId,entry_ix: usize,content: &ToolCallContent,context_ix: usize,@@ -11297,10 +11297,10 @@ impl ThreadView {fn render_subagent_tool_call(&self,- active_session_id: &acp_v1::SessionId,+ active_session_id: &acp_v2::SessionId,entry_ix: usize,tool_call: &ToolCall,- subagent_session_id: Option<acp_v1::SessionId>,+ subagent_session_id: Option<acp_v2::SessionId>,focus_handle: &FocusHandle,window: &Window,cx: &Context<Self>,@@ -11327,7 +11327,7 @@ impl ThreadView {fn render_subagent_card(&self,- active_session_id: &acp_v1::SessionId,+ active_session_id: &acp_v2::SessionId,entry_ix: usize,thread_view: Option<&Entity<ThreadView>>,tool_call: &ToolCall,diff --git a/crates/agent_ui/src/entry_view_state.rs b/crates/agent_ui/src/entry_view_state.rsindex 54ea5eb8fe8..92158c97429 100644--- a/crates/agent_ui/src/entry_view_state.rs+++ b/crates/agent_ui/src/entry_view_state.rs@@ -2,7 +2,7 @@ use std::{ops::Range, sync::Arc};use acp_thread::{AcpThread, AgentThreadEntry, AssistantMessageChunk, ToolCall};use agent::ThreadStore;-use agent_client_protocol::schema::v1 as acp_v1;+use agent_client_protocol::schema::v2 as acp_v2;use agent_settings::AgentSettings;use collections::{HashMap, HashSet};use editor::{@@ -48,7 +48,7 @@ pub struct EntryViewState {auto_expanded_thinking_block: Option<(usize, usize)>,user_toggled_thinking_blocks: HashSet<(usize, usize)>,expanded_compactions: HashSet<usize>,- expanded_tool_calls: HashSet<acp_v1::ToolCallId>,+ expanded_tool_calls: HashSet<acp_v2::ToolCallId>,}impl EntryViewState {@@ -74,7 +74,7 @@ impl EntryViewState {}}- pub(crate) fn is_tool_call_expanded(&self, tool_call_id: &acp_v1::ToolCallId) -> bool {+ pub(crate) fn is_tool_call_expanded(&self, tool_call_id: &acp_v2::ToolCallId) -> bool {self.expanded_tool_calls.contains(tool_call_id)}@@ -82,15 +82,15 @@ impl EntryViewState {self.is_tool_call_expanded(&tool_call.id) || tool_call.authorization_id().is_some()}- pub(crate) fn expand_tool_call(&mut self, tool_call_id: acp_v1::ToolCallId) {+ pub(crate) fn expand_tool_call(&mut self, tool_call_id: acp_v2::ToolCallId) {self.expanded_tool_calls.insert(tool_call_id);}- pub(crate) fn collapse_tool_call(&mut self, tool_call_id: &acp_v1::ToolCallId) {+ pub(crate) fn collapse_tool_call(&mut self, tool_call_id: &acp_v2::ToolCallId) {self.expanded_tool_calls.remove(tool_call_id);}- pub(crate) fn toggle_tool_call_expansion(&mut self, tool_call_id: &acp_v1::ToolCallId) {+ pub(crate) fn toggle_tool_call_expansion(&mut self, tool_call_id: &acp_v2::ToolCallId) {if !self.expanded_tool_calls.remove(tool_call_id) {self.expanded_tool_calls.insert(tool_call_id.clone());}@@ -553,9 +553,9 @@ pub struct EntryViewEvent {}pub enum ViewEvent {- NewDiff(acp_v1::ToolCallId),- NewTerminal(acp_v1::ToolCallId),- TerminalMovedToBackground(acp_v1::ToolCallId),+ NewDiff(acp_v2::ToolCallId),+ NewTerminal(acp_v2::ToolCallId),+ TerminalMovedToBackground(acp_v2::ToolCallId),MessageEditorEvent(Entity<MessageEditor>, MessageEditorEvent),OpenDiffLocation {path: String,@@ -979,9 +979,7 @@ mod tests {.request_elicitation(acp_v2::CreateElicitationRequest::new(acp_v2::ElicitationFormMode::new(- acp_v2::ElicitationSessionScope::new(acp_v2::SessionId::new(- session_id.0.clone(),- )),+ acp_v2::ElicitationSessionScope::new(session_id.clone()),acp_v2::ElicitationSchema::new().string("name", true),),"Provide a name",diff --git a/crates/agent_ui/src/mention_set.rs b/crates/agent_ui/src/mention_set.rsindex 3ab2f10060b..13fd7505121 100644--- a/crates/agent_ui/src/mention_set.rs+++ b/crates/agent_ui/src/mention_set.rs@@ -1,7 +1,7 @@use crate::diagnostics::{DiagnosticsOptions, codeblock_fence_for_path, collect_diagnostics};use acp_thread::{MentionUri, selection_name};use agent::{ThreadStore, outline};-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use agent_servers::{AgentServer, AgentServerDelegate};use anyhow::{Context as _, Result, anyhow};use collections::{HashMap, HashSet};diff --git a/crates/agent_ui/src/message_editor.rs b/crates/agent_ui/src/message_editor.rsindex 570213c1395..605817d05b8 100644--- a/crates/agent_ui/src/message_editor.rs+++ b/crates/agent_ui/src/message_editor.rs@@ -11,7 +11,7 @@ use crate::{};use acp_thread::MentionUri;use agent::ThreadStore;-use agent_client_protocol::schema::{v1 as acp_v1, v2 as acp_v2};+use agent_client_protocol::schema::v2 as acp_v2;use anyhow::{Result, anyhow};use base64::Engine as _;use editor::{@@ -682,7 +682,7 @@ impl MessageEditor {pub fn insert_thread_summary(&mut self,- session_id: acp_v1::SessionId,+ session_id: acp_v2::SessionId,title: Option<SharedString>,window: &mut Window,cx: &mut Context<Self>,@@ -2299,7 +2299,7 @@ mod tests {use super::PromptLocalCommand;use acp_thread::MentionUri;use agent::{ThreadStore, outline};- use agent_client_protocol::schema::{v1 as acp_v1, v2 as acp_v2};+ use agent_client_protocol::schema::v2 as acp_v2;use base64::Engine as _;use editor::{AnchorRangeExt as _, Editor, EditorMode, MultiBufferOffset, SelectionEffects,@@ -3878,7 +3878,7 @@ mod tests {let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));- let session_id = acp_v1::SessionId::new("thread-123");+ let session_id = acp_v2::SessionId::new("thread-123");let title = Some("Previous Conversation".into());let message_editor = cx.update(|window, cx| {@@ -3966,7 +3966,7 @@ mod tests {cx,);editor.insert_thread_summary(- acp_v1::SessionId::new("thread-123"),+ acp_v2::SessionId::new("thread-123"),Some("Previous Conversation".into()),window,cx,diff --git a/crates/agent_ui/src/test_support.rs b/crates/agent_ui/src/test_support.rsindex bdce2da8da7..6bc0de1e14d 100644--- a/crates/agent_ui/src/test_support.rs+++ b/crates/agent_ui/src/test_support.rs@@ -1,5 +1,5 @@use acp_thread::{AgentConnection, StubAgentConnection};-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::{v1 as acp_v1, v2 as acp};use agent_servers::{AgentServer, AgentServerDelegate};use gpui::{App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,@@ -67,8 +67,8 @@ whereimpl StubAgentServer<StubAgentConnection> {pub fn default_response() -> Self {let conn = StubAgentConnection::new();- conn.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Default response".into()),+ conn.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Default response".into()),)]);Self::new(conn)}diff --git a/crates/agent_ui/src/thread_import.rs b/crates/agent_ui/src/thread_import.rsindex ca601cc5927..13f31831c25 100644--- a/crates/agent_ui/src/thread_import.rs+++ b/crates/agent_ui/src/thread_import.rs@@ -2,7 +2,7 @@ use std::time::Duration;use acp_thread::AgentSessionListRequest;use agent::ThreadStore;-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use chrono::Utc;use collections::{HashMap, HashSet};use db::kvp::Dismissable;@@ -1257,6 +1257,46 @@ mod tests {assert!(threads.is_empty());}+ #[test]+ fn test_cross_channel_import_preserves_legacy_session_ids_and_drafts() {+ let directory = tempfile::tempdir().expect("temporary database directory should exist");+ let connection = create_channel_db(directory.path(), ReleaseChannel::Nightly);+ let legacy_session_id =+ agent_client_protocol::schema::v1::SessionId::new("legacy/session:opaque-☃");+ let saved_thread_id = ThreadId::new();+ let draft_thread_id = ThreadId::new();+ let mut insert = connection+ .exec_bound::<(ThreadId, Option<std::sync::Arc<str>>)>(+ "INSERT INTO sidebar_threads \+ (thread_id, session_id, title, updated_at, archived) \+ VALUES (?1, ?2, 'Legacy thread', '2025-01-15T10:00:00Z', 1)",+ )+ .expect("legacy metadata insert should prepare");+ insert((saved_thread_id, Some(legacy_session_id.0.clone())))+ .expect("legacy session metadata should insert");+ insert((draft_thread_id, None)).expect("legacy draft metadata should insert");+ drop(insert);+ drop(connection);++ let imported = read_threads_from_channel(directory.path(), ReleaseChannel::Nightly)+ .expect("legacy channel metadata should load");+ assert_eq!(imported.len(), 2);+ let saved = imported+ .iter()+ .find(|metadata| metadata.thread_id == saved_thread_id)+ .expect("legacy session should be imported");+ assert_eq!(+ saved.session_id,+ Some(acp::SessionId::new(legacy_session_id.0))+ );+ let draft = imported+ .iter()+ .find(|metadata| metadata.thread_id == draft_thread_id)+ .expect("legacy draft should be imported");+ assert!(draft.is_draft());+ assert!(saved.archived && draft.archived);+ }+#[test]fn test_preserves_archived_state() {let dir = tempfile::tempdir().unwrap();diff --git a/crates/agent_ui/src/thread_metadata_store.rs b/crates/agent_ui/src/thread_metadata_store.rsindex d859bfc3d26..a26f7ed3f8b 100644--- a/crates/agent_ui/src/thread_metadata_store.rs+++ b/crates/agent_ui/src/thread_metadata_store.rs@@ -4,7 +4,7 @@ use std::{};use agent::{ThreadStore, ZED_AGENT_ID};-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use anyhow::Context as _;use chrono::{DateTime, Utc};use collections::{HashMap, HashSet};@@ -1825,7 +1825,7 @@ mod tests {use acp_thread::StubAgentConnection;use action_log::ActionLog;use agent::DbThread;- use agent_client_protocol::schema::{v1 as acp, v2 as acp_v2};+ use agent_client_protocol::schema::{v1 as acp_v1, v2 as acp};use gpui::{TestAppContext, VisualTestContext};use project::FakeFs;use project::Project;@@ -1947,6 +1947,52 @@ mod tests {assert_eq!(metadata.display_title().as_ref(), "Agent Generated Title");}+ #[gpui::test]+ async fn test_database_preserves_legacy_session_ids(_cx: &mut TestAppContext) {+ let legacy_session_id = acp_v1::SessionId::new("legacy/session:opaque-☃");+ let thread_id = ThreadId::new();+ let db = ThreadMetadataDb(gpui::block_on(db::open_test_db::<ThreadMetadataDb>(+ "THREAD_METADATA_DB_LEGACY_SESSION_IDS",+ )));++ db.write({+ let session_id = legacy_session_id.0.clone();+ move |connection| {+ connection.exec_bound::<(ThreadId, Arc<str>)>(+ "INSERT INTO sidebar_threads \+ (thread_id, session_id, title, updated_at, archived) \+ VALUES (?1, ?2, 'Legacy thread', '2025-01-15T10:00:00Z', 0)",+ )?((thread_id, session_id))+ }+ })+ .await+ .expect("legacy session should be stored as plain text");++ let mut metadata = db+ .list()+ .expect("legacy metadata should load")+ .pop()+ .expect("legacy thread should exist");+ assert_eq!(+ metadata.session_id,+ Some(acp::SessionId::new(legacy_session_id.0.clone()))+ );+ assert_eq!(metadata.thread_id, thread_id);++ metadata.title_override = Some("Renamed legacy thread".into());+ db.save(metadata)+ .await+ .expect("v2 session metadata should save");+ let stored_session_id = db+ .select_row_bound::<ThreadId, Arc<str>>(+ "SELECT session_id FROM sidebar_threads WHERE thread_id = ?1",+ )+ .expect("session ID query should prepare")(thread_id)+ .expect("session ID query should succeed")+ .expect("stored session ID should exist");+ assert_eq!(acp_v1::SessionId::new(stored_session_id), legacy_session_id);+ }+#[gpui::test]async fn test_database_round_trips_title_override(_cx: &mut TestAppContext) {let now = Utc::now();@@ -2859,7 +2905,7 @@ mod tests {project.clone(),action_log,subagent_session_id.clone(),- watch::Receiver::constant(acp_v2::PromptCapabilities::new()),+ watch::Receiver::constant(acp::PromptCapabilities::new()),cx,)})diff --git a/crates/agent_ui/src/threads_archive_view.rs b/crates/agent_ui/src/threads_archive_view.rsindex da6c5ddc4ef..6b7b4a47bc8 100644--- a/crates/agent_ui/src/threads_archive_view.rs+++ b/crates/agent_ui/src/threads_archive_view.rs@@ -10,7 +10,7 @@ use crate::thread_metadata_store::{use crate::{Agent, ArchiveSelectedThread, DEFAULT_THREAD_TITLE, RemoveSelectedThread};use agent::ThreadStore;-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use agent_settings::AgentSettings;use chrono::{DateTime, Datelike as _, Local, NaiveDate, TimeDelta, Utc};use collections::HashMap;diff --git a/crates/agent_ui/src/ui/mention_crease.rs b/crates/agent_ui/src/ui/mention_crease.rsindex 6959b5bc4c0..17890ef167e 100644--- a/crates/agent_ui/src/ui/mention_crease.rs+++ b/crates/agent_ui/src/ui/mention_crease.rs@@ -1,7 +1,7 @@use std::{path::PathBuf, time::Duration};use acp_thread::MentionUri;-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use editor::Editor;use gpui::{Animation, AnimationExt, AnyView, Context, IntoElement, TaskExt, WeakEntity, Window,diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rsindex edf18fc6365..f35151937fc 100644--- a/crates/sidebar/src/sidebar.rs+++ b/crates/sidebar/src/sidebar.rs@@ -3,7 +3,7 @@ mod thread_switcher;use acp_thread::ThreadStatus;use action_log::DiffStats;use agent::{ThreadStore, ZED_AGENT_ID};-use agent_client_protocol::schema::v1 as acp;+use agent_client_protocol::schema::v2 as acp;use agent_settings::{AgentSettings, THREADS_LIST_MAX_WIDTH, THREADS_LIST_MIN_WIDTH};use agent_ui::terminal_thread_metadata_store::{TerminalThreadMetadata, TerminalThreadMetadataStore, terminal_title_prefix,diff --git a/crates/sidebar/src/sidebar_tests.rs b/crates/sidebar/src/sidebar_tests.rsindex dc1a7c81bcb..a7ed6772ee5 100644--- a/crates/sidebar/src/sidebar_tests.rs+++ b/crates/sidebar/src/sidebar_tests.rs@@ -1,7 +1,7 @@use super::*;use acp_thread::{AcpThread, PermissionOptions, StubAgentConnection};use agent::ThreadStore;-use agent_client_protocol::schema::v2 as acp_v2;+use agent_client_protocol::schema::{v1 as acp_v1, v2 as acp_v2};use agent_settings::AgentSettings;use agent_ui::{ThreadId,@@ -604,18 +604,18 @@ fn request_test_tool_authorization() {let tool_call_id = acp::ToolCallId::new(tool_call_id);let label = format!("Tool {tool_call_id}");- let option_id = acp::PermissionOptionId::new(option_id);+ let option_id = acp_v1::PermissionOptionId::new(option_id);let _authorization_task = cx.update(|_, cx| {thread.update(cx, |thread, cx| {thread.request_tool_call_authorization(- acp::ToolCall::new(tool_call_id, label)- .kind(acp::ToolKind::Edit)+ acp_v1::ToolCall::new(acp_v1::ToolCallId::new(tool_call_id.0), label)+ .kind(acp_v1::ToolKind::Edit).into(),- PermissionOptions::Flat(vec![acp::PermissionOption::new(+ PermissionOptions::Flat(vec![acp_v1::PermissionOption::new(option_id,"Allow",- acp::PermissionOptionKind::AllowOnce,+ acp_v1::PermissionOptionKind::AllowOnce,)]),acp_thread::AuthorizationKind::PermissionGrant,cx,@@ -4439,15 +4439,17 @@ async fn test_parallel_threads_shown_with_live_status(cx: &mut TestAppContext) {cx.update(|_, cx| {connection.send_update(session_id_a.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("working...".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new(+ "working...".into(),+ )),cx,);});cx.run_until_parked();// Open thread B (idle, default response) — thread A goes to background.- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -4480,8 +4482,8 @@ async fn test_subagent_permission_request_marks_parent_sidebar_thread_waiting(let (sidebar, panel) = setup_sidebar_with_agent_panel(&multi_workspace, cx);let connection = StubAgentConnection::new().with_supports_load_session(true);- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -4544,7 +4546,7 @@ async fn test_background_thread_completion_triggers_notification(cx: &mut TestApcx.update(|_, cx| {connection_a.send_update(session_id_a.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("chunk".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new("chunk".into())),cx,);});@@ -4569,7 +4571,7 @@ async fn test_background_thread_completion_triggers_notification(cx: &mut TestAp);// Complete thread A's turn (transition Running → Completed).- connection_a.end_turn(session_id_a.clone(), acp::StopReason::EndTurn);+ connection_a.end_turn(session_id_a.clone(), acp_v1::StopReason::EndTurn);cx.run_until_parked();// The completed background thread shows a notification indicator.@@ -5689,8 +5691,8 @@ async fn test_thread_title_update_propagates_to_sidebar(cx: &mut TestAppContext)let (sidebar, panel) = setup_sidebar_with_agent_panel(&multi_workspace, cx);let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Hi there!".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Hi there!".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -5743,8 +5745,8 @@ async fn test_rename_thread_from_sidebar_updates_title_override(cx: &mut TestApplet (sidebar, panel) = setup_sidebar_with_agent_panel(&multi_workspace, cx);let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Hi there!".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Hi there!".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -5872,8 +5874,8 @@ async fn test_rename_selected_thread_action_renames_selected_thread(cx: &mut Teslet (sidebar, panel) = setup_sidebar_with_agent_panel(&multi_workspace, cx);let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Hi there!".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Hi there!".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -5990,8 +5992,8 @@ async fn test_focused_thread_tracks_user_intent(cx: &mut TestAppContext) {// Save a thread so it appears in the list.let connection_a = StubAgentConnection::new();- connection_a.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection_a.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel_a, connection_a, cx);send_message(&panel_a, cx);@@ -6059,8 +6061,8 @@ async fn test_focused_thread_tracks_user_intent(cx: &mut TestAppContext) {});let connection_b = StubAgentConnection::new();- connection_b.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Thread B".into()),+ connection_b.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Thread B".into()),)]);open_thread_with_connection(&panel_b, connection_b, cx);send_message(&panel_b, cx);@@ -6113,8 +6115,8 @@ async fn test_focused_thread_tracks_user_intent(cx: &mut TestAppContext) {});let connection_b2 = StubAgentConnection::new();- connection_b2.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new(DEFAULT_THREAD_TITLE.into()),+ connection_b2.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new(DEFAULT_THREAD_TITLE.into()),)]);open_thread_with_connection(&panel_b, connection_b2, cx);send_message(&panel_b, cx);@@ -6203,8 +6205,8 @@ async fn test_new_thread_button_works_after_adding_folder(cx: &mut TestAppContex// Start a thread and send a message so it has history.let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -6679,8 +6681,8 @@ async fn test_sending_message_from_draft_promotes_in_place(cx: &mut TestAppContecx.run_until_parked();let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("ok".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("ok".into()),)]);open_thread_with_connection(&panel, connection, cx);let draft_id = panel.read_with(cx, |panel, cx| panel.active_thread_id(cx).unwrap());@@ -6734,8 +6736,8 @@ async fn test_cmd_n_shows_new_thread_entry(cx: &mut TestAppContext) {// Create a non-empty thread (has messages).let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -6857,8 +6859,8 @@ async fn test_cmd_n_shows_new_thread_entry_in_absorbed_worktree(cx: &mut TestApp// Create a non-empty thread in the worktree workspace.let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&worktree_panel, connection, cx);send_message(&worktree_panel, cx);@@ -6982,8 +6984,8 @@ async fn test_only_actively_viewed_empty_draft_is_visible_in_sidebar(cx: &mut Te// Give the main panel a real thread we can park the draft behind// later. Send a message to promote the draft→real thread.let real_connection = StubAgentConnection::new();- real_connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("done".into()),+ real_connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("done".into()),)]);agent_ui::test_support::open_thread_with_connection(&main_panel, real_connection, cx);agent_ui::test_support::send_message(&main_panel, cx);@@ -7663,7 +7665,9 @@ async fn test_absorbed_worktree_running_thread_shows_live_status(cx: &mut TestApcx.update(|_, cx| {connection.send_update(session_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("working...".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new(+ "working...".into(),+ )),cx,);});@@ -7750,7 +7754,9 @@ async fn test_absorbed_worktree_completion_triggers_notification(cx: &mut TestApcx.update(|_, cx| {connection.send_update(session_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("working...".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new(+ "working...".into(),+ )),cx,);});@@ -7761,7 +7767,7 @@ async fn test_absorbed_worktree_completion_triggers_notification(cx: &mut TestApvec!["v [project]", " Hello {wt-feature-a} * (running)",]);- connection.end_turn(session_id, acp::StopReason::EndTurn);+ connection.end_turn(session_id, acp_v1::StopReason::EndTurn);cx.run_until_parked();assert_eq!(@@ -8892,7 +8898,9 @@ async fn test_archive_thread_uses_next_threads_own_workspace(cx: &mut TestAppConcx.update(|_, cx| {connection.send_update(thread2_session_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("working...".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new(+ "working...".into(),+ )),cx,);});@@ -9970,8 +9978,8 @@ async fn test_thread_switcher_ordering(cx: &mut TestAppContext) {// Thread C (oldest), Thread B, Thread A (newest) — by created_at.// We send messages in each so they also get last_message_sent_or_queued timestamps.let connection_c = StubAgentConnection::new();- connection_c.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done C".into()),+ connection_c.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done C".into()),)]);open_thread_with_connection(&panel, connection_c, cx);send_message(&panel, cx);@@ -9988,8 +9996,8 @@ async fn test_thread_switcher_ordering(cx: &mut TestAppContext) {);let connection_b = StubAgentConnection::new();- connection_b.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done B".into()),+ connection_b.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done B".into()),)]);open_thread_with_connection(&panel, connection_b, cx);send_message(&panel, cx);@@ -10006,8 +10014,8 @@ async fn test_thread_switcher_ordering(cx: &mut TestAppContext) {);let connection_a = StubAgentConnection::new();- connection_a.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done A".into()),+ connection_a.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done A".into()),)]);open_thread_with_connection(&panel, connection_a, cx);send_message(&panel, cx);@@ -10317,8 +10325,8 @@ async fn test_archive_thread_drops_retained_conversation_view(cx: &mut TestAppCocx.run_until_parked();let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -10392,8 +10400,8 @@ async fn test_archive_thread_active_entry_management(cx: &mut TestAppContext) {// Create a thread in project-a (non-active — project-b is active).let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel_a, connection, cx);agent_ui::test_support::send_message(&panel_a, cx);@@ -10419,8 +10427,8 @@ async fn test_archive_thread_active_entry_management(cx: &mut TestAppContext) {// Create a thread in project-b (the active workspace) and verify it// becomes the active entry.let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel_b, connection, cx);agent_ui::test_support::send_message(&panel_b, cx);@@ -10465,8 +10473,8 @@ async fn test_unarchive_only_shows_restored_thread(cx: &mut TestAppContext) {// Create a thread and send a message so it's a real thread.let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Hello".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Hello".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel, connection, cx);agent_ui::test_support::send_message(&panel, cx);@@ -10790,8 +10798,8 @@ async fn test_unarchive_into_existing_workspace_replaces_draft(cx: &mut TestAppC// Create a thread and send a message so it's no longer a draft.let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel, connection, cx);agent_ui::test_support::send_message(&panel, cx);@@ -11000,8 +11008,8 @@ async fn test_unarchive_after_removing_parent_project_group_restores_real_threadcx.run_until_parked();let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel_b, connection, cx);agent_ui::test_support::send_message(&panel_b, cx);@@ -11131,8 +11139,8 @@ async fn test_unarchive_does_not_create_duplicate_real_thread_metadata(cx: &mutcx.run_until_parked();let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel, connection, cx);agent_ui::test_support::send_message(&panel, cx);@@ -11245,8 +11253,8 @@ async fn test_switch_to_workspace_with_archived_thread_shows_no_active_entry(// Create a thread in project-a's panel (currently non-active).let connection = acp_thread::StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);agent_ui::test_support::open_thread_with_connection(&panel_a, connection, cx);agent_ui::test_support::send_message(&panel_a, cx);@@ -11441,7 +11449,7 @@ async fn test_archive_last_thread_on_linked_worktree_does_not_create_new_thread_cx.update(|_, cx| {connection.send_update(worktree_thread_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("done".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new("done".into())),cx,);});@@ -11610,7 +11618,7 @@ async fn test_archive_last_thread_on_linked_worktree_with_no_siblings_leaves_grocx.update(|_, cx| {connection.send_update(worktree_thread_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("done".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new("done".into())),cx,);});@@ -11912,7 +11920,7 @@ async fn test_archive_thread_on_linked_worktree_selects_sibling_thread(cx: &mutcx.update(|_, cx| {connection.send_update(worktree_thread_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new("done".into())),+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new("done".into())),cx,);});@@ -12532,8 +12540,8 @@ async fn test_startup_successful_restoration_no_spurious_draft(cx: &mut TestAppC// Create and send a message to make a real thread.let connection = StubAgentConnection::new();- connection.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ connection.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel, connection, cx);send_message(&panel, cx);@@ -12563,8 +12571,8 @@ async fn test_project_header_click_restores_last_viewed(cx: &mut TestAppContext)// Create two threads in project-a.let conn1 = StubAgentConnection::new();- conn1.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ conn1.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel_a, conn1, cx);send_message(&panel_a, cx);@@ -12572,8 +12580,8 @@ async fn test_project_header_click_restores_last_viewed(cx: &mut TestAppContext)save_test_thread_metadata(&thread_a1, &project_a, cx).await;let conn2 = StubAgentConnection::new();- conn2.set_next_prompt_updates(vec![acp::SessionUpdate::AgentMessageChunk(- acp::ContentChunk::new("Done".into()),+ conn2.set_next_prompt_updates(vec![acp_v1::SessionUpdate::AgentMessageChunk(+ acp_v1::ContentChunk::new("Done".into()),)]);open_thread_with_connection(&panel_a, conn2, cx);send_message(&panel_a, cx);@@ -13329,7 +13337,7 @@ mod property_test {cx.update(|_, cx| {connection.send_update(session_id.clone(),- acp::SessionUpdate::AgentMessageChunk(acp::ContentChunk::new(+ acp_v1::SessionUpdate::AgentMessageChunk(acp_v1::ContentChunk::new("Done".into(),)),cx,diff --git a/crates/zed/src/visual_test_runner.rs b/crates/zed/src/visual_test_runner.rsindex 6541bf666f3..23a62953753 100644--- a/crates/zed/src/visual_test_runner.rs+++ b/crates/zed/src/visual_test_runner.rs@@ -95,7 +95,7 @@ fn main() {#[cfg(target_os = "macos")]use {acp_thread::{AgentConnection, StubAgentConnection},- agent_client_protocol::schema::v1 as acp,+ agent_client_protocol::schema::{v1 as acp, v2 as acp_v2},agent_servers::{AgentServer, AgentServerDelegate},anyhow::{Context as _, Result},assets::Assets,@@ -2721,7 +2721,7 @@ fn run_multi_workspace_sidebar_visual_tests(let task = thread_store.update(cx, |store, cx| {store.save_thread(- acp::SessionId::new(Arc::from(session_id)),+ acp_v2::SessionId::new(Arc::from(session_id)),agent::DbThread {title: title.to_string().into(),messages: Vec::new(),