feat: update dashboard and process manager for unified launcher
Actualiza el dashboard TUI y el process manager para el modelo de launcher unificado donde todos los agentes corren en un solo proceso. Dashboard (pkg/tui): - model.go: campos de estado del launcher (PID, uptime, memory, CPU, log size) - model.go: ServerMenuOptions(running) contextual, AgentActionOptions(enabled) - messages.go: MsgAgentsLoaded incluye estado del launcher, MsgServerActionDone/MsgRebuildDone simplificados - update.go: intents nuevos (Enable/Disable agent, Start/Stop/Restart/Kill launcher) - view.go: vista de servidor muestra stats del launcher, agentes muestran enabled/disabled Shell adapter (shell/tui): - adapter.go: reescrito para usar métodos unificados (StartUnified, StopUnified, ToggleEnabled, StatusAllUnified, UnifiedStats, UnifiedLogTail) Process manager (shell/process): - manager.go: métodos StartUnified, StopUnified, KillUnified, IsUnifiedRunning, UnifiedPID, UnifiedStats, UnifiedLogTail, StatusAllUnified, ToggleEnabled Los agentes ya no se inician/detienen individualmente desde el dashboard. Se habilitan/deshabilitan en config y se reinicia el launcher para aplicar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+34
-23
@@ -24,17 +24,25 @@ type Model struct {
|
||||
StatusMsg string // flash message ("Started OK", "Error: ...")
|
||||
WindowWidth int
|
||||
WindowHeight int
|
||||
|
||||
// Unified launcher state
|
||||
LauncherRunning bool
|
||||
LauncherPID int
|
||||
LauncherUptime string
|
||||
LauncherMemory string
|
||||
LauncherCPU string
|
||||
LauncherLogSize string
|
||||
}
|
||||
|
||||
// AgentView is a pre-formatted projection of an agent for display.
|
||||
type AgentView struct {
|
||||
ID string
|
||||
Name string
|
||||
Version string
|
||||
Desc string
|
||||
Enabled bool
|
||||
Running bool
|
||||
PID int
|
||||
ID string
|
||||
Name string
|
||||
Version string
|
||||
Desc string
|
||||
Enabled bool
|
||||
Running bool
|
||||
PID int
|
||||
Instances int // number of running instances (>1 means duplicates)
|
||||
Uptime string // formatted: "2h 15m"
|
||||
Memory string // formatted: "42 MB"
|
||||
@@ -52,36 +60,39 @@ type MenuOption struct {
|
||||
func MainMenuOptions() []MenuOption {
|
||||
return []MenuOption{
|
||||
{Label: "Agents", Desc: "Gestionar agentes"},
|
||||
{Label: "Server", Desc: "Gestionar servidor"},
|
||||
{Label: "Server", Desc: "Gestionar launcher unificado"},
|
||||
{Label: "Quit", Desc: "Salir"},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerMenuOptions returns the available server-wide actions.
|
||||
func ServerMenuOptions() []MenuOption {
|
||||
func ServerMenuOptions(running bool) []MenuOption {
|
||||
if running {
|
||||
return []MenuOption{
|
||||
{Label: "Stop", Desc: "Detener el launcher"},
|
||||
{Label: "Restart", Desc: "Reiniciar el launcher"},
|
||||
{Label: "Kill", Desc: "SIGKILL forzado"},
|
||||
{Label: "Rebuild & Restart", Desc: "Build + reiniciar"},
|
||||
{Label: "Logs", Desc: "Ver log del launcher"},
|
||||
}
|
||||
}
|
||||
return []MenuOption{
|
||||
{Label: "Start All", Desc: "Iniciar todos los agentes habilitados"},
|
||||
{Label: "Stop All", Desc: "Detener todos los agentes"},
|
||||
{Label: "Restart All", Desc: "Reiniciar todos los agentes"},
|
||||
{Label: "Kill All", Desc: "SIGKILL forzado a todos"},
|
||||
{Label: "Rebuild & Restart", Desc: "Build + reiniciar activos"},
|
||||
{Label: "Start", Desc: "Iniciar el launcher unificado"},
|
||||
{Label: "Rebuild & Restart", Desc: "Build + iniciar"},
|
||||
}
|
||||
}
|
||||
|
||||
// AgentActionOptions returns the available actions based on agent state.
|
||||
func AgentActionOptions(running bool) []MenuOption {
|
||||
if running {
|
||||
func AgentActionOptions(enabled bool) []MenuOption {
|
||||
if enabled {
|
||||
return []MenuOption{
|
||||
{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"},
|
||||
{Label: "Disable", Desc: "Desactivar agente (requiere restart)"},
|
||||
{Label: "Logs", Desc: "Ver log del launcher"},
|
||||
}
|
||||
}
|
||||
return []MenuOption{
|
||||
{Label: "Start", Desc: "Iniciar el agente"},
|
||||
{Label: "Logs", Desc: "Ver log del agente"},
|
||||
{Label: "Enable", Desc: "Activar agente (requiere restart)"},
|
||||
{Label: "Logs", Desc: "Ver log del launcher"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user