fix(install): M11 numpy/faiss via uv pip, M12 bootstrap.sh + broken clone recovery

M11: _venv_install() helper nutzt uv pip (Hermes v0.18.0+) mit Fallback-Kette:
  uv pip > pip > python -m pip, für venv/ und .venv/.
  Ersetzt alle 3 numpy/faiss-Installationsblöcke (perform_update,
  perform_update_only, main install path).

M12: bootstrap.sh als One-Command-Entrypoint:
  ssh-keyscan → git clone (SSH→HTTP fallback) → exec install.sh.
  _bootstrap_repo() erkennt jetzt broken clones (.git ja, plugin/ nein)
  und löscht + cloned neu statt fatal abzubrechen.
This commit is contained in:
Bernd (Hermes)
2026-07-12 14:34:20 +02:00
parent 17e6670358
commit d478d8079a
2 changed files with 112 additions and 29 deletions
+49 -29
View File
@@ -43,14 +43,23 @@ _bootstrap_repo() {
# U2: git clone mit SSH→HTTP Fallback
echo "📦 Klone Plugin-Repo..."
if [ -d "$clone_target/.git" ]; then
echo "✅ Repo bereits vorhanden unter $clone_target"
elif git clone "$ssh_url" "$clone_target" 2>/dev/null; then
echo "✅ Clone via SSH erfolgreich"
elif git clone "$http_url" "$clone_target" 2>/dev/null; then
echo "✅ Clone via HTTP (Fallback) erfolgreich"
else
echo "❌ Git clone fehlgeschlagen — SSH-Key für Gitea (${gitea_host}:${gitea_port}) oder HTTP-Zugang nötig"
exit 1
# M12: Broken Clone erkennen — .git vorhanden aber plugin/ fehlt
if [ ! -d "$clone_target/plugin" ]; then
echo "⚠️ Broken clone detected (no plugin/) — removing and re-cloning..."
rm -rf "$clone_target"
else
echo "✅ Repo bereits vorhanden unter $clone_target"
fi
fi
if [ ! -d "$clone_target/.git" ]; then
if git clone "$ssh_url" "$clone_target" 2>/dev/null; then
echo "✅ Clone via SSH erfolgreich"
elif git clone "$http_url" "$clone_target" 2>/dev/null; then
echo "✅ Clone via HTTP (Fallback) erfolgreich"
else
echo "❌ Git clone fehlgeschlagen — SSH-Key für Gitea (${gitea_host}:${gitea_port}) oder HTTP-Zugang nötig"
exit 1
fi
fi
# Guard: .git vorhanden aber plugin/ fehlt → unvollständiger Clone → fatal (verhindert Endlosschleife)
@@ -220,6 +229,29 @@ load_lang() {
}
# ─── Helper ──────────────────────────────────────────────
# M11: Install a package in the Hermes venv.
# Hermes v0.18.0+ uses uv; older versions use pip.
# Priority: uv pip > pip > python -m pip (for both venv/ and .venv/).
_venv_install() {
local hermes_dir="$1" pkg="$2"
if [ -f "$hermes_dir/venv/bin/uv" ]; then
"$hermes_dir/venv/bin/uv" pip install "$pkg" 2>&1 | tail -1
elif [ -f "$hermes_dir/venv/bin/pip" ]; then
"$hermes_dir/venv/bin/pip" install "$pkg" 2>&1 | tail -1
elif [ -f "$hermes_dir/venv/bin/python" ]; then
"$hermes_dir/venv/bin/python" -m pip install "$pkg" 2>&1 | tail -1
elif [ -f "$hermes_dir/.venv/bin/uv" ]; then
"$hermes_dir/.venv/bin/uv" pip install "$pkg" 2>&1 | tail -1
elif [ -f "$hermes_dir/.venv/bin/pip" ]; then
"$hermes_dir/.venv/bin/pip" install "$pkg" 2>&1 | tail -1
elif [ -f "$hermes_dir/.venv/bin/python" ]; then
"$hermes_dir/.venv/bin/python" -m pip install "$pkg" 2>&1 | tail -1
else
echo "⚠️ Cannot install $pkg — no venv found in $hermes_dir"
return 1
fi
}
confirm_or_edit() {
# $1 = env-var name (RC_URL, RC_BOT_USER, …)
# $2 = message key (enter_url, enter_botuser, …)
@@ -456,14 +488,10 @@ perform_update() {
# Archivar braucht numpy + faiss für FAISS Phase-1 RoomIndex.
# Nur im Multi-Room-Agent-Modus nötig; Single-Room-Bot bleibt schlank.
# M9: numpy ist Pflicht, faiss-cpu best-effort (kann auf ARM fehlen).
# M11: _venv_install nutzt uv pip (Hermes v0.18.0+) mit pip-Fallback.
if [ "$RC_MULTIROOM" = "true" ]; then
if [ -f "$hermes_dir/venv/bin/pip" ]; then
"$hermes_dir/venv/bin/pip" install numpy 2>&1 | tail -1
"$hermes_dir/venv/bin/pip" install faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
elif [ -f "$hermes_dir/.venv/bin/pip" ]; then
"$hermes_dir/.venv/bin/pip" install numpy 2>&1 | tail -1
"$hermes_dir/.venv/bin/pip" install faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
fi
_venv_install "$hermes_dir" numpy
_venv_install "$hermes_dir" faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
fi
# ─── FIX: room-map.json bereitstellen (nur Multi-Room) ─────────
@@ -690,14 +718,10 @@ perform_update_only() {
# Archivar braucht numpy + faiss für FAISS Phase-1 RoomIndex.
# Nur im Multi-Room-Agent-Modus nötig; Single-Room-Bot bleibt schlank.
# M9: numpy ist Pflicht, faiss-cpu best-effort (kann auf ARM fehlen).
# M11: _venv_install nutzt uv pip (Hermes v0.18.0+) mit pip-Fallback.
if [ "$RC_MULTIROOM" = "true" ]; then
if [ -f "$hermes_dir/venv/bin/pip" ]; then
"$hermes_dir/venv/bin/pip" install numpy 2>&1 | tail -1
"$hermes_dir/venv/bin/pip" install faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
elif [ -f "$hermes_dir/.venv/bin/pip" ]; then
"$hermes_dir/.venv/bin/pip" install numpy 2>&1 | tail -1
"$hermes_dir/.venv/bin/pip" install faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
fi
_venv_install "$hermes_dir" numpy
_venv_install "$hermes_dir" faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
fi
# ─── FIX: room-map.json bereitstellen (nur Multi-Room) ─────────
@@ -1087,14 +1111,10 @@ msg cache_cleared
# Archivar braucht numpy + faiss für FAISS Phase-1 RoomIndex.
# Nur im Multi-Room-Agent-Modus nötig; Single-Room-Bot bleibt schlank.
# M9: numpy ist Pflicht, faiss-cpu best-effort (kann auf ARM fehlen).
# M11: _venv_install nutzt uv pip (Hermes v0.18.0+) mit pip-Fallback.
if [ "$RC_MULTIROOM" = "true" ]; then
if [ -f "$HERMES_DIR/venv/bin/pip" ]; then
"$HERMES_DIR/venv/bin/pip" install numpy 2>&1 | tail -1
"$HERMES_DIR/venv/bin/pip" install faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
elif [ -f "$HERMES_DIR/.venv/bin/pip" ]; then
"$HERMES_DIR/.venv/bin/pip" install numpy 2>&1 | tail -1
"$HERMES_DIR/.venv/bin/pip" install faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
fi
_venv_install "$HERMES_DIR" numpy
_venv_install "$HERMES_DIR" faiss-cpu 2>/dev/null || echo "⚠️ faiss-cpu not available (ARM?) — Archivar uses fallback"
fi
# ─── FIX: room-map.json bereitstellen ────────────────────────