diff --git a/INSTALL.md b/INSTALL.md index dcb77b7..2e8d381 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -99,4 +99,10 @@ export CONTEXT_LENGTH=131072 - .env: `~/.hermes/.env` + `~/.config/hermes/rocketchat.env` (für systemd) - room-map.json: `~/.hermes/hermes-agent/data/room-map.json` - SOUL.md: `~/.hermes/SOUL.md` -- systemd unit: `~/.config/systemd/user/hermes-gateway.service` \ No newline at end of file +- systemd unit: `~/.config/systemd/user/hermes-gateway.service` + +## Wichtige Hinweise + +- **Secrets in Logs**: `journalctl --user -u hermes-gateway` zeigt Secrets (API-Keys, Passwörter) in der Prozess-Umgebung an. Logs niemals ungefiltert teilen oder in öffentliche Channels posten. Vor dem Teilen mit `grep -v` filtern oder nur relevante Ausschnitte weitergeben. +- **Idempotenz**: `install.sh` kann mehrfach ausgeführt werden. Bestehende Dateien werden gesichert (`.bak.`), `room-map.json` mit Inhalt wird nicht überschrieben. +- **Python 3.13**: pipx installiert hermes-agent zwingend mit Python 3.13 (`--python python3.13`). Ein abweichendes Python in der pipx-venv wird automatisch erkannt und korrigiert. \ No newline at end of file diff --git a/install.sh b/install.sh index e26949b..89a67ef 100755 --- a/install.sh +++ b/install.sh @@ -215,6 +215,18 @@ install_system_deps() { fi fi + # B1: Python 3.13 für pipx erzwingen (pipx-Python-Version-Drift verhindern) + if ! command -v python3.13 >/dev/null 2>&1; then + log "Python 3.13 nicht gefunden — installiere via apt..." + if ! $DRY_RUN; then + sudo apt-get install -y -qq python3.13 python3.13-venv python3.13-dev >/dev/null \ + || die "python3.13 Installation fehlgeschlagen" + else + printf '%s[dry]%s apt install python3.13 python3.13-venv python3.13-dev\n' "$C_YELLOW" "$C_RESET" + fi + fi + ok "Python 3.13 verfügbar: $(python3.13 --version 2>/dev/null || echo 'dry-run')" + log "Prüfe / installiere apt-Pakete (python3-pip, pipx, git, curl)..." if ! $DRY_RUN; then sudo apt-get update -qq @@ -247,17 +259,35 @@ install_hermes_agent() { local venv if venv="$(find_pipx_venv 2>/dev/null)" && [ -n "$venv" ]; then - log "Hermes Agent bereits in pipx-venv: $venv" + # B1: Prüfe ob pipx-venv tatsächlich Python 3.13 nutzt + local venv_py_ver + venv_py_ver="$("$venv/bin/python" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || echo "0.0")" + if [ "$venv_py_ver" != "3.13" ]; then + warn "pipx-venv nutzt Python $venv_py_ver statt 3.13 — Neuinstallation mit python3.13" + if ! $DRY_RUN; then + pipx uninstall hermes-agent 2>/dev/null || true + pipx install --python python3.13 hermes-agent \ + || die "pipx install --python python3.13 hermes-agent fehlgeschlagen" + export PATH="$HOME/.local/bin:$PATH" + venv="$(find_pipx_venv 2>/dev/null)" \ + || die "pipx-venv nach Neuinstallation nicht gefunden" + else + printf '%s[dry]%s pipx uninstall hermes-agent && pipx install --python python3.13 hermes-agent\n' "$C_YELLOW" "$C_RESET" + fi + else + log "Hermes Agent bereits in pipx-venv (Python 3.13): $venv" + fi else - log "pipx install hermes-agent..." + log "pipx install hermes-agent --python python3.13..." if ! $DRY_RUN; then - pipx install hermes-agent + pipx install --python python3.13 hermes-agent \ + || die "pipx install --python python3.13 hermes-agent fehlgeschlagen" # PATH für diese Session refreshen export PATH="$HOME/.local/bin:$PATH" venv="$(find_pipx_venv 2>/dev/null)" \ || die "pipx-venv nach Installation nicht gefunden" else - printf '%s[dry]%s pipx install hermes-agent\n' "$C_YELLOW" "$C_RESET" + printf '%s[dry]%s pipx install --python python3.13 hermes-agent\n' "$C_YELLOW" "$C_RESET" venv="$HOME/.local/share/pipx/venvs/hermes-agent" fi fi @@ -404,7 +434,8 @@ model: # api_key wird über .env (OLLAMA_API_KEY) injiziert # KEINE base_url für ollama-cloud (nicht nötig) -providers: {} +providers: + ollama-cloud: {} # P2: auxiliary-Provider explizit auf ollama-cloud setzen. # Verhindert Auto-Discovery-Chain (openrouter/Nous → payment errors + Timeout). @@ -488,13 +519,15 @@ plugins: - rocketchat-platform YAML ok "config.yaml geschrieben: $config" - # YAML-Syntax-Check - if command -v python3 >/dev/null 2>&1; then - if ! python3 -c 'import yaml,sys; yaml.safe_load(open(sys.argv[1]))' "$config" 2>/dev/null; then - warn "config.yaml YAML-Syntax-Check fehlgeschlagen — bitte prüfen" + # YAML-Syntax-Check (B2: nutze pipx-venv Python, nicht system-python) + if [ -x "$VENV_PY" ]; then + if ! "$VENV_PY" -c 'import yaml,sys; yaml.safe_load(open(sys.argv[1]))' "$config" 2>/dev/null; then + die "config.yaml YAML-Syntax-Check fehlgeschlagen" else ok "config.yaml YAML-Syntax OK" fi + else + die "VENV_PY nicht ausführbar — kann config.yaml nicht validieren" fi else printf '%s[dry]%s schreibe %s (model=%s, provider=%s, ctx=%s, thr=%s)\n' \ @@ -730,6 +763,15 @@ verify_installation() { return 0 fi + # B1: pipx-venv Python-Version MUSS 3.13 sein + local venv_py_ver + venv_py_ver="$("$VENV_PY" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || echo "0.0")" + if [ "$venv_py_ver" = "3.13" ]; then + ok "pipx-venv Python $venv_py_ver (B1: 3.13 erzwungen)" + else + err "FAIL: pipx-venv Python $venv_py_ver statt 3.13 (B1)"; fail=1 + fi + # P1: snowballstemmer in pipx-venv if "$VENV_PY" -c 'import snowballstemmer' 2>/dev/null; then ok "snowballstemmer in pipx-venv importierbar (P1)" @@ -747,9 +789,9 @@ verify_installation() { err "FAIL: Plugin-Dateien fehlen in $plugin_dir (P3)"; fail=1 fi - # config.yaml syntaktisch korrekt + # config.yaml syntaktisch korrekt (B2: nutze pipx-venv Python) local config="$HOME/.hermes/config.yaml" - if [ -f "$config" ] && python3 -c "import yaml; yaml.safe_load(open('$config'))" 2>/dev/null; then + if [ -f "$config" ] && "$VENV_PY" -c "import yaml; yaml.safe_load(open('$config'))" 2>/dev/null; then ok "config.yaml syntaktisch korrekt" # P6/P7: Provider und Modell prüfen if grep -q "^ provider: ollama-cloud" "$config"; then @@ -798,7 +840,7 @@ verify_installation() { local rm="$HOME/.hermes/hermes-agent/data/room-map.json" if [ -f "$rm" ]; then local rc - rc="$(python3 -c "import json; print(len(json.load(open('$rm')).get('rooms',{})))" 2>/dev/null || echo "?")" + rc="$("$VENV_PY" -c "import json; print(len(json.load(open('$rm')).get('rooms',{})))" 2>/dev/null || echo "?")" if [ "${rc:-0}" = "0" ]; then ok "room-map.json leer (P10: Onboarding füllt sie)" else diff --git a/templates/config.yaml b/templates/config.yaml index b73089a..a18f633 100644 --- a/templates/config.yaml +++ b/templates/config.yaml @@ -7,7 +7,8 @@ model: provider: PLACEHOLDER_PROVIDER base_url: PLACEHOLDER_MODEL_BASE_URL -providers: {} +providers: + ollama-cloud: {} toolsets: - hermes-cli