Add is_online/is_persistent for persistent agent sessions
- Sessions now track whether agent is online or offline - Persistent agents (no support code) stay in session list when disconnected - Dashboard shows online/offline status with color indicator - Connect/Chat buttons disabled when agent is offline - Agent reconnection reuses existing session
This commit is contained in:
@@ -97,7 +97,9 @@ async fn handle_agent_connection(
|
||||
}
|
||||
|
||||
// Register the agent and get channels
|
||||
let (session_id, frame_tx, mut input_rx) = sessions.register_agent(agent_id.clone(), agent_name.clone()).await;
|
||||
// Persistent agents (no support code) keep their session when disconnected
|
||||
let is_persistent = support_code.is_none();
|
||||
let (session_id, frame_tx, mut input_rx) = sessions.register_agent(agent_id.clone(), agent_name.clone(), is_persistent).await;
|
||||
|
||||
info!("Session created: {} (agent in idle mode)", session_id);
|
||||
|
||||
@@ -221,7 +223,8 @@ async fn handle_agent_connection(
|
||||
// Cleanup
|
||||
input_forward.abort();
|
||||
cancel_check.abort();
|
||||
sessions_cleanup.remove_session(session_id).await;
|
||||
// Mark agent as disconnected (persistent agents stay in list as offline)
|
||||
sessions_cleanup.mark_agent_disconnected(session_id).await;
|
||||
|
||||
// Mark support code as completed if one was used (unless cancelled)
|
||||
if let Some(ref code) = support_code_cleanup {
|
||||
|
||||
Reference in New Issue
Block a user