fix(install.sh): numpy, circular import, room-map.json, archivar symlink in hermes root

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.
This commit is contained in:
Bernd (Hermes)
2026-06-22 12:47:50 +02:00
parent 572bc89205
commit 6f47885b1c
3 changed files with 50 additions and 7 deletions
+38
View File
@@ -378,6 +378,15 @@ perform_update() {
# 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
if command -v ollama >/dev/null 2>&1; then
@@ -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"
+6 -7
View File
@@ -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, {})
+6
View File
@@ -0,0 +1,6 @@
{
"version": 1,
"rooms": {},
"excluded_rooms": [],
"fact_store_path": "/data/Wissensdatenbank/0100 Inbox"
}