From 6f47885b1ce8270b05b6a2bb4882fd997af7e944 Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Mon, 22 Jun 2026 12:47:50 +0200 Subject: [PATCH] fix(install.sh): numpy, circular import, room-map.json, archivar symlink in hermes root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FIX 1: numpy/faiss-cpu pip install in venv nach Plugin-Deployment in allen drei Pfaden (perform_update, perform_update_only, main interactive). Archivar braucht diese Packages für FAISS Phase-1 RoomIndex — ohne sie crasht der Import. FIX 2: Zirkelimport adapter.py ↔ archivar/adapter_integration.py gebrochen. _room_context/_room_context_lock werden jetzt lazy innerhalb handle_feedback_response() importiert. FIX 3: Minimale room-map.json (version=1, rooms={}) wird als Template bereitgestellt und bei Clean-Install ins Datenverzeichnis kopiert. RC-Skill-Onboarding erstellt die vollständige, maschinen-spezifische Version. FIX 4: Archivar-Symlink liegt bereits korrekt im HERMES_DIR (Commit 5c8026c). Keine Änderung nötig. --- install.sh | 38 ++++++++++++++++++++++++++ plugin/archivar/adapter_integration.py | 13 ++++----- templates/room-map.json | 6 ++++ 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 templates/room-map.json diff --git a/install.sh b/install.sh index c331545..f5166fc 100755 --- a/install.sh +++ b/install.sh @@ -377,6 +377,15 @@ perform_update() { # by the installer. It is created by the RC-Skill onboarding # flow after gateway start. See RC-Skill: "Room Topic Discipline" fi + + # ── FIX: numpy/faiss im venv installieren ────────────────────── + # Archivar braucht numpy + faiss für FAISS Phase-1 RoomIndex. + # Ohne diese Packages crasht der Import beim Gateway-Start. + if [ -f "$hermes_dir/venv/bin/pip" ]; then + "$hermes_dir/venv/bin/pip" install numpy faiss-cpu 2>&1 | tail -1 + elif [ -f "$hermes_dir/.venv/bin/pip" ]; then + "$hermes_dir/.venv/bin/pip" install numpy faiss-cpu 2>&1 | tail -1 + fi # Execute backend checks directly (Ollama check from lines 429-446) msg ollama_check @@ -543,6 +552,15 @@ perform_update_only() { find "$PLUGIN_DST" -name '*.pyc' -delete 2>/dev/null || true msg cache_cleared + # ── FIX: numpy/faiss im venv installieren ────────────────────── + # Archivar braucht numpy + faiss für FAISS Phase-1 RoomIndex. + # Ohne diese Packages crasht der Import beim Gateway-Start. + if [ -f "$hermes_dir/venv/bin/pip" ]; then + "$hermes_dir/venv/bin/pip" install numpy faiss-cpu 2>&1 | tail -1 + elif [ -f "$hermes_dir/.venv/bin/pip" ]; then + "$hermes_dir/.venv/bin/pip" install numpy faiss-cpu 2>&1 | tail -1 + fi + # NOTE: room-map.json is MACHINE-SPECIFIC — never deployed # by --update-only. It is created by the RC-Skill onboarding # flow after gateway start. See RC-Skill: "Room Topic Discipline" @@ -842,6 +860,26 @@ find "$PLUGIN_DST" -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || find "$PLUGIN_DST" -name '*.pyc' -delete 2>/dev/null || true msg cache_cleared +# ── FIX: numpy/faiss im venv installieren ────────────────────── +# Archivar braucht numpy + faiss für FAISS Phase-1 RoomIndex. +# Ohne diese Packages crasht der Import beim Gateway-Start. +if [ -f "$HERMES_DIR/venv/bin/pip" ]; then + "$HERMES_DIR/venv/bin/pip" install numpy faiss-cpu 2>&1 | tail -1 +elif [ -f "$HERMES_DIR/.venv/bin/pip" ]; then + "$HERMES_DIR/.venv/bin/pip" install numpy faiss-cpu 2>&1 | tail -1 +fi + +# ─── FIX: room-map.json bereitstellen ──────────────────────── +# Der Installer stellt eine minimale room-map.json ins Datenverzeichnis. +# Die vollständige, maschinen-spezifische Version wird vom RC-Skill- +# Onboarding-Flow nach dem Gateway-Start erstellt. +ROOM_MAP_DATA_DIR="$HOME/.hermes/hermes-agent/data" +mkdir -p "$ROOM_MAP_DATA_DIR" +if [ ! -f "$ROOM_MAP_DATA_DIR/room-map.json" ] && [ -f "$SCRIPT_DIR/templates/room-map.json" ]; then + cp "$SCRIPT_DIR/templates/room-map.json" "$ROOM_MAP_DATA_DIR/room-map.json" + msg room_map_deployed "$ROOM_MAP_DATA_DIR/room-map.json" +fi + # ─── Fix #9: Provision minimal config.yaml + .env ────────── # Only when hermes has NO config yet (fresh install, no setup run) HERMES_HOME="$HOME/.hermes" diff --git a/plugin/archivar/adapter_integration.py b/plugin/archivar/adapter_integration.py index 67fb6d0..90be73f 100644 --- a/plugin/archivar/adapter_integration.py +++ b/plugin/archivar/adapter_integration.py @@ -93,13 +93,6 @@ except ImportError: from .seed_data import SEED_DATA from .feedback_detector import RoutingWiderspruchDetector, ContradictionResult -# ── _room_context import from adapter.py ───────────────────────────── -# Needed by handle_feedback_response to clear thematic_target on 'stay'. -try: - from adapter import _room_context, _room_context_lock -except ImportError: - from ..adapter import _room_context, _room_context_lock - logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) # Ensure adapter_integration logs are visible by adding a stderr handler @@ -898,6 +891,12 @@ class ArchivarMessageHandler: # geleert werden, damit der nächste Send nicht auf den falschen # (Archivar-vorgeschlagenen) Zielraum fällt. if feedback_type == "stay" and username: + # Lazy import to break circular dependency with adapter.py + try: + from adapter import _room_context, _room_context_lock + except ImportError: + from ..adapter import _room_context, _room_context_lock + virtual_chat_id = f"user:{username}" with _room_context_lock: ctx = _room_context.setdefault(virtual_chat_id, {}) diff --git a/templates/room-map.json b/templates/room-map.json new file mode 100644 index 0000000..bf3d991 --- /dev/null +++ b/templates/room-map.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "rooms": {}, + "excluded_rooms": [], + "fact_store_path": "/data/Wissensdatenbank/0100 Inbox" +}