namespace ControlCenter.Models; /// /// Persistent state for an agent in the Control Center. /// Maps to the agents table in PostgreSQL. /// /// Tracks the operational status, current task, progress, /// session identity, and last activity timestamp for each agent /// in the minion fleet. /// /// The property uses string values matching /// the AgentStatus enum: "active", "idle", "thinking", "error". /// Stored as varchar rather than a DB enum for schema flexibility. /// public class AgentState { /// /// Unique identifier for the agent state record. /// Defaults to a new on creation. /// public Guid Id { get; set; } = Guid.NewGuid(); /// /// Operational status of the agent. /// Valid values: "active", "idle", "thinking", "error". /// Maps to the AgentStatus enum used by SignalR. /// public string Status { get; set; } = "idle"; /// /// Description of the agent's current task, if any. /// Null when the agent is idle with no active assignment. /// public string? Task { get; set; } /// /// Task progress percentage (0–100). /// Null when progress is not trackable for the current task. /// public int? Progress { get; set; } /// /// Full session key identifying the agent's active session. /// Format: agent:{agentId}:{channel}:... /// Used to correlate SignalR events with persistent state. /// public string SessionKey { get; set; } = string.Empty; /// /// The channel the agent is operating on (e.g., "telegram", "discord", "slack"). /// public string Channel { get; set; } = string.Empty; /// /// Timestamp of the agent's last recorded activity. /// Updated on every status change or task progress event. /// public DateTime LastActivity { get; set; } = DateTime.UtcNow; }