connection.rs

 1use std::{path::Path, rc::Rc};
 2
 3use agent_client_protocol 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 name(&self) -> &'static str;
13
14    fn new_thread(
15        self: Rc<Self>,
16        project: Entity<Project>,
17        cwd: &Path,
18        cx: &mut AsyncApp,
19    ) -> Task<Result<Entity<AcpThread>>>;
20
21    fn authenticate(&self, cx: &mut App) -> Task<Result<()>>;
22
23    fn prompt(&self, params: acp::PromptToolArguments, cx: &mut App) -> Task<Result<()>>;
24
25    fn cancel(&self, session_id: &acp::SessionId, cx: &mut App);
26}