feat: enhance agent management with support for multiple instances and update UI accordingly

This commit is contained in:
2026-03-04 23:41:26 +00:00
parent bcbbd974e3
commit 1e5103eb70
7 changed files with 48 additions and 48 deletions
+4 -3
View File
@@ -71,9 +71,10 @@ func ServerMenuOptions() []MenuOption {
func AgentActionOptions(running bool) []MenuOption {
if running {
return []MenuOption{
{Label: "Stop", Desc: "Detener el agente"},
{Label: "Restart", Desc: "Reiniciar"},
{Label: "Kill", Desc: "SIGKILL forzado"},
{Label: "Start", Desc: "Iniciar otra instancia"},
{Label: "Stop", Desc: "Detener todas las instancias"},
{Label: "Restart", Desc: "Reiniciar (stop all + start)"},
{Label: "Kill", Desc: "SIGKILL forzado a todas"},
{Label: "Logs", Desc: "Ver log del agente"},
}
}
+10 -6
View File
@@ -75,15 +75,15 @@ func viewAgentList(m Model) string {
status = "disabled"
} else if a.Running {
icon = "●"
status = fmt.Sprintf("running PID %d", a.PID)
if a.Instances > 1 {
status = fmt.Sprintf("running %d instances", a.Instances)
} else {
status = fmt.Sprintf("running PID %d", a.PID)
}
}
b.WriteString(fmt.Sprintf(" %s%s %-20s %-8s %s\n",
cursor, icon, a.ID, a.Version, status))
if a.Instances > 1 {
b.WriteString(fmt.Sprintf(" ⚠ WARNING: %d instances running!\n", a.Instances))
}
}
if m.StatusMsg != "" {
@@ -104,7 +104,11 @@ func viewAgentActions(m Model) string {
a := m.Selected
icon := "○ stopped"
if a.Running {
icon = fmt.Sprintf("● running PID %d", a.PID)
if a.Instances > 1 {
icon = fmt.Sprintf("● running %d instances", a.Instances)
} else {
icon = fmt.Sprintf("● running PID %d", a.PID)
}
}
b.WriteString(fmt.Sprintf("\n %s %s\n", a.ID, icon))