agent: Rename a number of constructs from Assistant to Agent (#30196)

This PR renames a number of constructs in the `agent` crate from the
"Assistant" terminology to "Agent".

Not comprehensive, but it's a start.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-07 21:18:51 -04:00 committed by GitHub
parent d6c7cdd60f
commit 6cc6e4d4b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 155 additions and 163 deletions

View file

@ -137,7 +137,7 @@ pub enum ThoughtProcessStatus {
Completed,
}
pub trait AssistantPanelDelegate {
pub trait AgentPanelDelegate {
fn active_context_editor(
&self,
workspace: &mut Workspace,
@ -171,7 +171,7 @@ pub trait AssistantPanelDelegate {
);
}
impl dyn AssistantPanelDelegate {
impl dyn AgentPanelDelegate {
/// Returns the global [`AssistantPanelDelegate`], if it exists.
pub fn try_global(cx: &App) -> Option<Arc<Self>> {
cx.try_global::<GlobalAssistantPanelDelegate>()
@ -184,7 +184,7 @@ impl dyn AssistantPanelDelegate {
}
}
struct GlobalAssistantPanelDelegate(Arc<dyn AssistantPanelDelegate>);
struct GlobalAssistantPanelDelegate(Arc<dyn AgentPanelDelegate>);
impl Global for GlobalAssistantPanelDelegate {}
@ -1666,11 +1666,11 @@ impl ContextEditor {
window: &mut Window,
cx: &mut Context<Workspace>,
) {
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else {
let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return;
};
let Some(context_editor_view) =
assistant_panel_delegate.active_context_editor(workspace, window, cx)
agent_panel_delegate.active_context_editor(workspace, window, cx)
else {
return;
};
@ -1696,9 +1696,9 @@ impl ContextEditor {
cx: &mut Context<Workspace>,
) {
let result = maybe!({
let assistant_panel_delegate = <dyn AssistantPanelDelegate>::try_global(cx)?;
let agent_panel_delegate = <dyn AgentPanelDelegate>::try_global(cx)?;
let context_editor_view =
assistant_panel_delegate.active_context_editor(workspace, window, cx)?;
agent_panel_delegate.active_context_editor(workspace, window, cx)?;
Self::get_selection_or_code_block(&context_editor_view, cx)
});
let Some((text, is_code_block)) = result else {
@ -1731,11 +1731,11 @@ impl ContextEditor {
window: &mut Window,
cx: &mut Context<Workspace>,
) {
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else {
let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return;
};
let Some(context_editor_view) =
assistant_panel_delegate.active_context_editor(workspace, window, cx)
agent_panel_delegate.active_context_editor(workspace, window, cx)
else {
return;
};
@ -1821,7 +1821,7 @@ impl ContextEditor {
window: &mut Window,
cx: &mut Context<Workspace>,
) {
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else {
let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return;
};
@ -1852,7 +1852,7 @@ impl ContextEditor {
return;
}
assistant_panel_delegate.quote_selection(workspace, selections, buffer, window, cx);
agent_panel_delegate.quote_selection(workspace, selections, buffer, window, cx);
}
pub fn quote_ranges(
@ -3361,10 +3361,10 @@ impl FollowableItem for ContextEditor {
let editor_state = state.editor?;
let project = workspace.read(cx).project().clone();
let assistant_panel_delegate = <dyn AssistantPanelDelegate>::try_global(cx)?;
let agent_panel_delegate = <dyn AgentPanelDelegate>::try_global(cx)?;
let context_editor_task = workspace.update(cx, |workspace, cx| {
assistant_panel_delegate.open_remote_context(workspace, context_id, window, cx)
agent_panel_delegate.open_remote_context(workspace, context_id, window, cx)
});
Some(window.spawn(cx, async move |cx| {