Re-wire history
This commit is contained in:
parent
8998cdee26
commit
3b7ad6236d
8 changed files with 294 additions and 210 deletions
|
@ -2,6 +2,7 @@ use crate::{AcpThread, AcpThreadMetadata};
|
|||
use agent_client_protocol::{self as acp};
|
||||
use anyhow::Result;
|
||||
use collections::IndexMap;
|
||||
use futures::channel::mpsc::UnboundedReceiver;
|
||||
use gpui::{Entity, SharedString, Task};
|
||||
use project::Project;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -26,25 +27,6 @@ pub trait AgentConnection {
|
|||
cx: &mut App,
|
||||
) -> Task<Result<Entity<AcpThread>>>;
|
||||
|
||||
// todo!(expose a history trait, and include list_threads and load_thread)
|
||||
// todo!(write a test)
|
||||
fn list_threads(
|
||||
&self,
|
||||
_cx: &mut App,
|
||||
) -> Option<watch::Receiver<Option<Vec<AcpThreadMetadata>>>> {
|
||||
return None;
|
||||
}
|
||||
|
||||
fn load_thread(
|
||||
self: Rc<Self>,
|
||||
_project: Entity<Project>,
|
||||
_cwd: &Path,
|
||||
_session_id: acp::SessionId,
|
||||
_cx: &mut App,
|
||||
) -> Task<Result<Entity<AcpThread>>> {
|
||||
Task::ready(Err(anyhow::anyhow!("load thread not implemented")))
|
||||
}
|
||||
|
||||
fn auth_methods(&self) -> &[acp::AuthMethod];
|
||||
|
||||
fn authenticate(&self, method: acp::AuthMethodId, cx: &mut App) -> Task<Result<()>>;
|
||||
|
@ -82,6 +64,10 @@ pub trait AgentConnection {
|
|||
None
|
||||
}
|
||||
|
||||
fn history(self: Rc<Self>) -> Option<Rc<dyn AgentHistory>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
|
||||
}
|
||||
|
||||
|
@ -99,6 +85,18 @@ pub trait AgentSessionResume {
|
|||
fn run(&self, cx: &mut App) -> Task<Result<acp::PromptResponse>>;
|
||||
}
|
||||
|
||||
pub trait AgentHistory {
|
||||
fn list_threads(&self, cx: &mut App) -> Task<Result<Vec<AcpThreadMetadata>>>;
|
||||
fn observe_history(&self, cx: &mut App) -> UnboundedReceiver<AcpThreadMetadata>;
|
||||
fn load_thread(
|
||||
self: Rc<Self>,
|
||||
_project: Entity<Project>,
|
||||
_cwd: &Path,
|
||||
_session_id: acp::SessionId,
|
||||
_cx: &mut App,
|
||||
) -> Task<Result<Entity<AcpThread>>>;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct AuthRequired;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue