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