Implement idle/active mode for scalable agent connections
- Add StartStream/StopStream/AgentStatus messages to protobuf - Agent now starts in idle mode (heartbeat only, no capture) - Agent enters streaming mode when viewer connects (StartStream) - Agent returns to idle when all viewers disconnect (StopStream) - Server tracks viewer IDs and sends start/stop commands - Heartbeat mechanism with 90 second timeout detection - Session API now includes streaming status and agent info This allows 2000+ agents to connect with minimal bandwidth. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,12 @@ pub struct SessionInfo {
|
||||
pub agent_name: String,
|
||||
pub started_at: String,
|
||||
pub viewer_count: usize,
|
||||
pub is_streaming: bool,
|
||||
pub last_heartbeat: String,
|
||||
pub os_version: Option<String>,
|
||||
pub is_elevated: bool,
|
||||
pub uptime_secs: i64,
|
||||
pub display_count: i32,
|
||||
}
|
||||
|
||||
impl From<crate::session::Session> for SessionInfo {
|
||||
@@ -27,6 +33,12 @@ impl From<crate::session::Session> for SessionInfo {
|
||||
agent_name: s.agent_name,
|
||||
started_at: s.started_at.to_rfc3339(),
|
||||
viewer_count: s.viewer_count,
|
||||
is_streaming: s.is_streaming,
|
||||
last_heartbeat: s.last_heartbeat.to_rfc3339(),
|
||||
os_version: s.os_version,
|
||||
is_elevated: s.is_elevated,
|
||||
uptime_secs: s.uptime_secs,
|
||||
display_count: s.display_count,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user