refactor: update dev-scripts for unified launcher model
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>
This commit is contained in:
+28
-1
@@ -114,13 +114,40 @@ agent_status() {
|
||||
local id="$1" enabled="$2"
|
||||
if [[ "$enabled" != "true" ]]; then
|
||||
echo "disabled"
|
||||
elif is_running "$id"; then
|
||||
elif is_launcher_running; then
|
||||
echo "running"
|
||||
else
|
||||
echo "stopped"
|
||||
fi
|
||||
}
|
||||
|
||||
# ── Unified launcher helpers ───────────────────────────────────────────────
|
||||
LAUNCHER_ID="launcher"
|
||||
|
||||
launcher_pid_file() { echo "$RUN_DIR/$LAUNCHER_ID.pid"; }
|
||||
launcher_log_file() { echo "$RUN_DIR/$LAUNCHER_ID.log"; }
|
||||
|
||||
read_launcher_pid() {
|
||||
local f; f="$(launcher_pid_file)"
|
||||
[[ -f "$f" ]] && cat "$f" || echo 0
|
||||
}
|
||||
|
||||
is_launcher_running() {
|
||||
local pid; pid="$(read_launcher_pid)"
|
||||
if [[ "$pid" -gt 0 ]] && kill -0 "$pid" 2>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
# Fallback: search for launcher process without -c flag
|
||||
local pids; pids="$(pgrep -f 'launcher.*--log-level' 2>/dev/null || true)"
|
||||
if [[ -n "$pids" ]]; then
|
||||
local first_pid; first_pid="$(echo "$pids" | head -1)"
|
||||
echo "$first_pid" > "$(launcher_pid_file)"
|
||||
return 0
|
||||
fi
|
||||
[[ "$pid" -gt 0 ]] && rm -f "$(launcher_pid_file)"
|
||||
return 1
|
||||
}
|
||||
|
||||
# ── Agent discovery ────────────────────────────────────────────────────────
|
||||
# Prints: id|version|enabled|description (one line per agent)
|
||||
list_agents_raw() {
|
||||
|
||||
Reference in New Issue
Block a user