bd8e1432e5
- Implemented the assistant bot with basic command handling and LLM routing. - Created configuration file for the assistant bot with personality, behavior, and LLM settings. - Added system prompt for the assistant bot to define its capabilities and limitations. - Developed registration script for creating Matrix bot users via Synapse admin API. - Introduced common development scripts for agent management (start, stop, list, logs). - Scaffolded new agent creation script to streamline the addition of new agents. - Implemented agent removal script to disable agents without deleting data.
62 lines
1.5 KiB
Bash
Executable File
62 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# start.sh — inicia uno o todos los agentes habilitados en background
|
|
#
|
|
# Uso:
|
|
# ./dev-scripts/start.sh # inicia todos los habilitados
|
|
# ./dev-scripts/start.sh assistant-bot # inicia uno específico
|
|
|
|
source "$(dirname "$0")/_common.sh"
|
|
load_env
|
|
|
|
TARGET="${1:-}"
|
|
|
|
start_agent() {
|
|
local id="$1" cfg="$2"
|
|
local log; log="$(log_file "$id")"
|
|
local pid_f; pid_f="$(pid_file "$id")"
|
|
|
|
info "Iniciando $id..."
|
|
|
|
# Lanza el launcher en background, desacoplado del terminal
|
|
nohup "$GO" run ./cmd/launcher -c "$cfg" \
|
|
>> "$log" 2>&1 &
|
|
|
|
local pid=$!
|
|
echo "$pid" > "$pid_f"
|
|
|
|
# Espera un momento y verifica que el proceso siga vivo
|
|
sleep 1
|
|
if kill -0 "$pid" 2>/dev/null; then
|
|
ok "$id PID $pid → logs: $log"
|
|
else
|
|
rm -f "$pid_f"
|
|
fail "$id arrancó pero murió — revisa: tail -f $log"
|
|
fi
|
|
}
|
|
|
|
started=0
|
|
|
|
while IFS='|' read -r id version enabled desc cfg; do
|
|
# Filtrar por TARGET si se especificó uno
|
|
[[ -n "$TARGET" && "$id" != "$TARGET" ]] && continue
|
|
|
|
if [[ "$enabled" != "true" ]]; then
|
|
warn "$id (disabled en config, saltar)"
|
|
continue
|
|
fi
|
|
|
|
if is_running "$id"; then
|
|
warn "$id (ya corriendo, PID $(read_pid "$id"))"
|
|
continue
|
|
fi
|
|
|
|
start_agent "$id" "$cfg"
|
|
((started++)) || true
|
|
|
|
done < <(list_agents_raw)
|
|
|
|
[[ "$started" -eq 0 && -z "$TARGET" ]] && warn "Ningún agente iniciado."
|
|
[[ -n "$TARGET" && "$started" -eq 0 ]] && fail "Agente '$TARGET' no encontrado o ya está corriendo."
|
|
|
|
true
|