1use std::{cell::Ref, path::Path, rc::Rc};
2
3use agent_client_protocol::{self as acp};
4use anyhow::Result;
5use gpui::{AsyncApp, Entity, Task};
6use project::Project;
7use ui::App;
8
9use crate::AcpThread;
10
11pub trait AgentConnection {
12 fn new_thread(
13 self: Rc<Self>,
14 project: Entity<Project>,
15 cwd: &Path,
16 cx: &mut AsyncApp,
17 ) -> Task<Result<Entity<AcpThread>>>;
18
19 fn state(&self) -> Ref<'_, acp::AgentState>;
20
21 fn authenticate(&self, method: acp::AuthMethodId, cx: &mut App) -> Task<Result<()>>;
22
23 fn prompt(&self, params: acp::PromptArguments, cx: &mut App) -> Task<Result<()>>;
24
25 fn cancel(&self, session_id: &acp::SessionId, cx: &mut App);
26}