b86da0b805
Actualiza todos los scripts de desarrollo para el modelo de launcher unificado. Ya no se inician procesos individuales por agente — un solo proceso corre todos. _common.sh: helpers para launcher unificado (is_launcher_running, read_launcher_pid, launcher_pid_file/log_file), agent_status() ahora deriva estado del launcher start.sh: inicia el launcher unificado (sin -c flag, descubre todos los agentes) stop.sh: detiene el launcher unificado restart.sh: stop + start del launcher ps.sh: muestra stats del proceso launcher + lista de agentes enabled/disabled logs.sh: tail -f del log unificado del launcher server.sh: añade comandos enable/disable para gestionar agentes, elimina start/stop por agente remove.sh: simplificado a toggle enabled:false + sugerencia de restart Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.4 KiB
Bash
Executable File
52 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# start.sh — inicia el launcher unificado (todos los agentes habilitados)
|
|
#
|
|
# Uso:
|
|
# ./dev-scripts/start.sh # inicia el launcher unificado
|
|
|
|
source "$(dirname "$0")/_common.sh"
|
|
load_env
|
|
|
|
if is_launcher_running; then
|
|
pid="$(read_launcher_pid)"
|
|
fail "El launcher ya está corriendo (PID $pid). Usa restart.sh para reiniciar."
|
|
fi
|
|
|
|
BIN="$REPO_ROOT/bin/launcher"
|
|
LOG="$(launcher_log_file)"
|
|
PID_F="$(launcher_pid_file)"
|
|
|
|
# Build if needed
|
|
if [[ ! -x "$BIN" ]] || [[ "$(find ./cmd/launcher -newer "$BIN" 2>/dev/null | head -1)" ]]; then
|
|
info "Ejecutando tests..."
|
|
"$GO" test -tags goolm ./... || fail "Tests fallaron — corrige antes de compilar"
|
|
|
|
info "Compilando launcher..."
|
|
mkdir -p "$(dirname "$BIN")"
|
|
"$GO" build -tags goolm -o "$BIN" ./cmd/launcher || fail "Error de compilación"
|
|
fi
|
|
|
|
info "Iniciando launcher unificado..."
|
|
|
|
nohup "$BIN" --log-level "${LOG_LEVEL:-info}" \
|
|
>> "$LOG" 2>&1 &
|
|
|
|
pid=$!
|
|
echo "$pid" > "$PID_F"
|
|
|
|
sleep 1
|
|
if kill -0 "$pid" 2>/dev/null; then
|
|
# Count enabled agents
|
|
enabled=0
|
|
total=0
|
|
while IFS='|' read -r _id _v en _d _c; do
|
|
((total++)) || true
|
|
[[ "$en" == "true" ]] && ((enabled++)) || true
|
|
done < <(list_agents_raw)
|
|
|
|
ok "Launcher PID $pid ($enabled/$total agentes habilitados) → logs: $LOG"
|
|
else
|
|
rm -f "$PID_F"
|
|
fail "Launcher arrancó pero murió — revisa: tail -f $LOG"
|
|
fi
|