Render error state when agent binary exits unexpectedly (#35651)
This PR adds handling for the case where an agent binary exits unexpectedly after successfully establishing a connection. Release Notes: - N/A --------- Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
parent
142efbac0d
commit
bc2108cbba
5 changed files with 116 additions and 35 deletions
|
@ -18,6 +18,7 @@ use project::{AgentLocation, Project};
|
|||
use std::collections::HashMap;
|
||||
use std::error::Error;
|
||||
use std::fmt::Formatter;
|
||||
use std::process::ExitStatus;
|
||||
use std::rc::Rc;
|
||||
use std::{
|
||||
fmt::Display,
|
||||
|
@ -581,6 +582,7 @@ pub enum AcpThreadEvent {
|
|||
ToolAuthorizationRequired,
|
||||
Stopped,
|
||||
Error,
|
||||
ServerExited(ExitStatus),
|
||||
}
|
||||
|
||||
impl EventEmitter<AcpThreadEvent> for AcpThread {}
|
||||
|
@ -1229,6 +1231,10 @@ impl AcpThread {
|
|||
pub fn to_markdown(&self, cx: &App) -> String {
|
||||
self.entries.iter().map(|e| e.to_markdown(cx)).collect()
|
||||
}
|
||||
|
||||
pub fn emit_server_exited(&mut self, status: ExitStatus, cx: &mut Context<Self>) {
|
||||
cx.emit(AcpThreadEvent::ServerExited(status));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue