feat: implement server-wide management actions and enhance TUI dashboard

This commit is contained in:
2026-03-04 20:51:02 +00:00
parent 150f9d2990
commit ddec55871b
13 changed files with 621 additions and 52 deletions
+21 -2
View File
@@ -14,11 +14,30 @@ start_agent() {
local id="$1" cfg="$2"
local log; log="$(log_file "$id")"
local pid_f; pid_f="$(pid_file "$id")"
local bin="$REPO_ROOT/bin/launcher"
# Check for duplicate instances already running
local existing; existing="$(count_instances "$id")"
if [[ "$existing" -gt 0 ]]; then
warn "$id already has $existing instance(s) running (orphan processes?)"
warn " Run ./dev-scripts/stop.sh $id first to clean up"
return 1
fi
info "Iniciando $id..."
# Lanza el launcher en background, desacoplado del terminal
nohup "$GO" run -tags goolm ./cmd/launcher -c "$cfg" --log-level "${LOG_LEVEL:-info}" \
# Build the binary first to avoid go run wrapper PID issues
if [[ ! -x "$bin" ]] || [[ "$(find ./cmd/launcher -newer "$bin" 2>/dev/null | head -1)" ]]; then
info "Compilando launcher..."
mkdir -p "$(dirname "$bin")"
"$GO" build -tags goolm -o "$bin" ./cmd/launcher || {
fail "$id error de compilación — revisa el código"
return 1
}
fi
# Launch the compiled binary directly (no go run wrapper)
nohup "$bin" -c "$cfg" --log-level "${LOG_LEVEL:-info}" \
>> "$log" 2>&1 &
local pid=$!