Extract an agent_ui crate from agent (#33284)

This PR moves the UI-dependent logic in the `agent` crate into its own
crate, `agent_ui`. The remaining `agent` crate no longer depends on
`editor`, `picker`, `ui`, `workspace`, etc.

This has compile time benefits, but the main motivation is to isolate
our core agentic logic, so that we can make agents more
pluggable/configurable.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2025-06-23 18:00:28 -07:00 committed by GitHub
parent 371b7355d3
commit 2283ec5de2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 865 additions and 752 deletions

View file

@ -9,7 +9,7 @@ mod quick_action_bar;
#[cfg(target_os = "windows")]
pub(crate) mod windows_only_instance;
use agent::AgentDiffToolbar;
use agent_ui::AgentDiffToolbar;
use anyhow::Context as _;
pub use app_menus::*;
use assets::Assets;
@ -515,7 +515,7 @@ fn initialize_panels(
let is_assistant2_enabled = !cfg!(test);
let agent_panel = if is_assistant2_enabled {
let agent_panel =
agent::AgentPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
agent_ui::AgentPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
.await?;
Some(agent_panel)
@ -536,13 +536,13 @@ fn initialize_panels(
// Once we ship `assistant2` we can push this back down into `agent::agent_panel::init`.
if is_assistant2_enabled {
<dyn AgentPanelDelegate>::set_global(
Arc::new(agent::ConcreteAssistantPanelDelegate),
Arc::new(agent_ui::ConcreteAssistantPanelDelegate),
cx,
);
workspace
.register_action(agent::AgentPanel::toggle_focus)
.register_action(agent::InlineAssistant::inline_assist);
.register_action(agent_ui::AgentPanel::toggle_focus)
.register_action(agent_ui::InlineAssistant::inline_assist);
}
})?;
@ -4320,7 +4320,7 @@ mod tests {
web_search::init(cx);
web_search_providers::init(app_state.client.clone(), cx);
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), false, cx);
agent::init(
agent_ui::init(
app_state.fs.clone(),
app_state.client.clone(),
prompt_builder.clone(),