ACP history mentions (#36551)

- **TEMP**
- **Update @-mentions to use new history**

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-08-20 00:25:07 -06:00 committed by GitHub
parent 159b5e9fb5
commit 5d2bb2466e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 581 additions and 392 deletions

View file

@ -5,7 +5,6 @@ use acp_thread::{
};
use acp_thread::{AgentConnection, Plan};
use action_log::ActionLog;
use agent::{TextThreadStore, ThreadStore};
use agent_client_protocol::{self as acp};
use agent_servers::{AgentServer, ClaudeCode};
use agent_settings::{AgentProfileId, AgentSettings, CompletionMode, NotifyWhenAgentWaiting};
@ -32,7 +31,7 @@ use language::Buffer;
use language_model::LanguageModelRegistry;
use markdown::{HeadingLevelStyles, Markdown, MarkdownElement, MarkdownStyle};
use project::{Project, ProjectEntryId};
use prompt_store::PromptId;
use prompt_store::{PromptId, PromptStore};
use rope::Point;
use settings::{Settings as _, SettingsStore};
use std::sync::Arc;
@ -158,8 +157,7 @@ impl AcpThreadView {
workspace: WeakEntity<Workspace>,
project: Entity<Project>,
history_store: Entity<HistoryStore>,
thread_store: Entity<ThreadStore>,
text_thread_store: Entity<TextThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Self {
@ -168,8 +166,8 @@ impl AcpThreadView {
MessageEditor::new(
workspace.clone(),
project.clone(),
thread_store.clone(),
text_thread_store.clone(),
history_store.clone(),
prompt_store.clone(),
"Message the agent — @ to include context",
prevent_slash_commands,
editor::EditorMode::AutoHeight {
@ -187,8 +185,8 @@ impl AcpThreadView {
EntryViewState::new(
workspace.clone(),
project.clone(),
thread_store.clone(),
text_thread_store.clone(),
history_store.clone(),
prompt_store.clone(),
prevent_slash_commands,
)
});
@ -3201,12 +3199,18 @@ impl AcpThreadView {
})
.detach_and_log_err(cx);
}
MentionUri::Thread { id, .. } => {
MentionUri::Thread { id, name } => {
if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| {
panel
.open_thread_by_id(&id, window, cx)
.detach_and_log_err(cx)
panel.load_agent_thread(
DbThreadMetadata {
id,
title: name.into(),
updated_at: Default::default(),
},
window,
cx,
)
});
}
}
@ -4075,7 +4079,6 @@ fn terminal_command_markdown_style(window: &Window, cx: &App) -> MarkdownStyle {
#[cfg(test)]
pub(crate) mod tests {
use acp_thread::StubAgentConnection;
use agent::{TextThreadStore, ThreadStore};
use agent_client_protocol::SessionId;
use assistant_context::ContextStore;
use editor::EditorSettings;
@ -4211,10 +4214,6 @@ pub(crate) mod tests {
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let thread_store =
cx.update(|_window, cx| cx.new(|cx| ThreadStore::fake(project.clone(), cx)));
let text_thread_store =
cx.update(|_window, cx| cx.new(|cx| TextThreadStore::fake(project.clone(), cx)));
let context_store =
cx.update(|_window, cx| cx.new(|cx| ContextStore::fake(project.clone(), cx)));
let history_store =
@ -4228,8 +4227,7 @@ pub(crate) mod tests {
workspace.downgrade(),
project,
history_store,
thread_store.clone(),
text_thread_store.clone(),
None,
window,
cx,
)
@ -4400,6 +4398,7 @@ pub(crate) mod tests {
ThemeSettings::register(cx);
release_channel::init(SemanticVersion::default(), cx);
EditorSettings::register(cx);
prompt_store::init(cx)
});
}
@ -4420,10 +4419,6 @@ pub(crate) mod tests {
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let thread_store =
cx.update(|_window, cx| cx.new(|cx| ThreadStore::fake(project.clone(), cx)));
let text_thread_store =
cx.update(|_window, cx| cx.new(|cx| TextThreadStore::fake(project.clone(), cx)));
let context_store =
cx.update(|_window, cx| cx.new(|cx| ContextStore::fake(project.clone(), cx)));
let history_store =
@ -4438,8 +4433,7 @@ pub(crate) mod tests {
workspace.downgrade(),
project.clone(),
history_store.clone(),
thread_store.clone(),
text_thread_store.clone(),
None,
window,
cx,
)