From 7bcab47a239a7ca92cd85a4cf22b2510907feeb4 Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Wed, 26 Aug 2026 19:56:12 +0200 Subject: [PATCH] =?UTF-8?q?fix(install):=20ensure=5Ftoolset()=20YAML-Struk?= =?UTF-8?q?tur=20nicht=20brechen=20=E2=80=94=20platform=5Ftoolsets-Check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index d7674cb..d6c8d1c 100755 --- a/install.sh +++ b/install.sh @@ -1131,9 +1131,25 @@ ensure_toolset() { local config="$HOME/.hermes/config.yaml" [ -f "$config" ] || { warn "config.yaml nicht gefunden — Toolset-Registrierung übersprungen"; return 0; } - # Idempotenz: Nur handeln wenn rocketchat NICHT bereits registriert ist + # Idempotenz 1: Top-Level toolsets:-Sektion enthält rocketchat bereits if grep -q '^ - rocketchat$' "$config" 2>/dev/null; then - log "Toolset 'rocketchat' bereits in config.yaml registriert" + log "Toolset 'rocketchat' bereits in config.yaml registriert (top-level toolsets:)" + return 0 + fi + + # Idempotenz 2: rocketchat ist unter platform_toolsets.rocketchat registriert. + # Das ist der KORREKTE Ort für das RC-Plugin — es registriert sein Toolset + # selbst via ctx.register_tool(toolset="rocketchat") im Gateway-Kontext. + # Eine Top-Level toolsets:-Sektion ist für das RC-Plugin NICHT nötig. + if awk ' + /^platform_toolsets:/ { in_pt = 1; next } + in_pt && /^[^ ]/ { in_pt = 0 } + in_pt && /^ rocketchat:/ { in_rc = 1; next } + in_rc && /^[^ ]/ { in_rc = 0 } + in_rc && /^ - rocketchat$/ { found = 1; exit } + END { exit !found } + ' "$config"; then + log "Toolset 'rocketchat' bereits unter platform_toolsets.rocketchat registriert" return 0 fi @@ -1149,8 +1165,11 @@ ensure_toolset() { # Suche die Zeile 'toolsets:' und füge danach ' - rocketchat' ein sed -i '/^toolsets:/a\ - rocketchat' "$config" else - # Keine toolsets:-Sektion — füge sie nach providers: ein - sed -i '/^providers:/a\\ntoolsets:\n - rocketchat' "$config" + # Keine toolsets:-Sektion — füge sie am ENDE der Datei ein. + # NICHT nach providers: einfügen: providers: wird direkt von + # ollama-cloud: gefolgt, ein Insert dazwischen splittet den Block + # und erzeugt einen YAML-Parse-Fehler (Mapping nach Listen-Item). + printf '\ntoolsets:\n - rocketchat\n' >> "$config" fi # Verifikation