agent2: Port feedback (#36603)
Release Notes: - N/A --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
parent
d0fb6120d9
commit
8334cdb358
5 changed files with 321 additions and 58 deletions
|
@ -948,11 +948,36 @@ impl acp_thread::AgentConnection for NativeAgentConnection {
|
|||
})
|
||||
}
|
||||
|
||||
fn telemetry(&self) -> Option<Rc<dyn acp_thread::AgentTelemetry>> {
|
||||
Some(Rc::new(self.clone()) as Rc<dyn acp_thread::AgentTelemetry>)
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl acp_thread::AgentTelemetry for NativeAgentConnection {
|
||||
fn agent_name(&self) -> String {
|
||||
"Zed".into()
|
||||
}
|
||||
|
||||
fn thread_data(
|
||||
&self,
|
||||
session_id: &acp::SessionId,
|
||||
cx: &mut App,
|
||||
) -> Task<Result<serde_json::Value>> {
|
||||
let Some(session) = self.0.read(cx).sessions.get(session_id) else {
|
||||
return Task::ready(Err(anyhow!("Session not found")));
|
||||
};
|
||||
|
||||
let task = session.thread.read(cx).to_db(cx);
|
||||
cx.background_spawn(async move {
|
||||
serde_json::to_value(task.await).context("Failed to serialize thread")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
struct NativeAgentSessionEditor {
|
||||
thread: Entity<Thread>,
|
||||
acp_thread: WeakEntity<AcpThread>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue