fix(hilfe): HTTP 400 — Hilfe-Seite überschreitet Payload-Limit
P1b-Fix: Der bestehende P1-Fix (room_map_summary-Kürzung) griff nur, wenn room_map_summary gesetzt war. Durch Subcommand-Ergänzungen (mode proactive, mode silent_collector, Routing-Modi-Hinweis) ist die Hilfe-Seite auch OHNE room_map_summary über das ~5000-Zeichen-Limit gewachsen → HTTP 400 Bad Request. build_help_text() baut Sektionen jetzt als separate Listen und kürzt progressiv, wenn result > 4500 Zeichen: Stufe 1: Natürliche Sprach-Befehle auf eine Zeile Stufe 2: Standard-Hermes-Befehle auf kompakte Liste (ohne Subcommands) Stufe 3: RC-Plugin-Subcommand-Details weglassen (Befehle bleiben) Core-Befehle, RC-Plugin-Befehle, Status-Farben und Plugin-Status bleiben erhalten. P1-Fix ersetzt room_map_summary jetzt direkt in status_lines, damit die Kürzung auch bei Stufe 1-3 erhalten bleibt. Test: test_build_help_text_length_with_all_commands registriert alle realen Befehle inkl. Subcommands und prüft < 4500 Zeichen (mit und ohne room_map_summary).
This commit is contained in:
@@ -255,7 +255,7 @@ def build_help_text(
|
|||||||
Returns:
|
Returns:
|
||||||
Formatierte Hilfeseite als Markdown-String.
|
Formatierte Hilfeseite als Markdown-String.
|
||||||
"""
|
"""
|
||||||
lines = [
|
header = [
|
||||||
"## 🤖 Rocket.Chat Plugin — Hilfe",
|
"## 🤖 Rocket.Chat Plugin — Hilfe",
|
||||||
"",
|
"",
|
||||||
"👋 Ich bin Bernd, dein Hermes-Agent im Rocket.Chat. Hier sind meine Befehle:",
|
"👋 Ich bin Bernd, dein Hermes-Agent im Rocket.Chat. Hier sind meine Befehle:",
|
||||||
@@ -264,38 +264,30 @@ def build_help_text(
|
|||||||
|
|
||||||
# V9.2: Plugin-Version anzeigen
|
# V9.2: Plugin-Version anzeigen
|
||||||
if plugin_version:
|
if plugin_version:
|
||||||
lines.append(f"**Plugin-Version:** {plugin_version}")
|
header.append(f"**Plugin-Version:** {plugin_version}")
|
||||||
lines.append("")
|
header.append("")
|
||||||
|
|
||||||
lines.append(
|
header.append("Diese Befehle erkennst du am `::` am Satzanfang:")
|
||||||
"Diese Befehle erkennst du am `::` am Satzanfang:"
|
header.append("")
|
||||||
)
|
|
||||||
lines.append("")
|
|
||||||
|
|
||||||
# ── Sektion 0: Core-Befehle (Hermes Core, immer verfügbar) ────────
|
# ── Sektion 0: Core-Befehle (Hermes Core, immer verfügbar) ────────
|
||||||
lines.append("### ⚙️ Core-Befehle")
|
core_lines = [
|
||||||
lines.append("")
|
"### ⚙️ Core-Befehle",
|
||||||
lines.append(
|
"",
|
||||||
"Diese Befehle werden direkt vom Hermes-Agenten verarbeitet "
|
"Diese Befehle werden direkt vom Hermes-Agenten verarbeitet "
|
||||||
"und sind immer verfügbar — unabhängig vom Plugin:"
|
"und sind immer verfügbar — unabhängig vom Plugin:",
|
||||||
)
|
"",
|
||||||
lines.append("")
|
|
||||||
lines.append(
|
|
||||||
"- **continue** — Agent fortsetzen nach leerer Antwort / Stream-Drop. "
|
"- **continue** — Agent fortsetzen nach leerer Antwort / Stream-Drop. "
|
||||||
"Einfach `continue` in den Chat schreiben, der Agent macht weiter."
|
"Einfach `continue` in den Chat schreiben, der Agent macht weiter.",
|
||||||
)
|
|
||||||
lines.append(
|
|
||||||
"- **/reset** — Session zurücksetzen. "
|
"- **/reset** — Session zurücksetzen. "
|
||||||
"Löscht den gesamten Chat-Kontext und startet eine frische Session. "
|
"Löscht den gesamten Chat-Kontext und startet eine frische Session. "
|
||||||
"In Rocket.Chat als `::reset` nutzbar."
|
"In Rocket.Chat als `::reset` nutzbar.",
|
||||||
)
|
|
||||||
lines.append(
|
|
||||||
"- **/compress** — Kontext manuell komprimieren. "
|
"- **/compress** — Kontext manuell komprimieren. "
|
||||||
"Verdichtet den Chat-Verlauf, um Token zu sparen und die "
|
"Verdichtet den Chat-Verlauf, um Token zu sparen und die "
|
||||||
"Antwortqualität bei langen Sessions zu erhalten. "
|
"Antwortqualität bei langen Sessions zu erhalten. "
|
||||||
"In Rocket.Chat als `::compress` nutzbar."
|
"In Rocket.Chat als `::compress` nutzbar.",
|
||||||
)
|
"",
|
||||||
lines.append("")
|
]
|
||||||
|
|
||||||
# ::-Befehle nach Kategorie gruppieren
|
# ::-Befehle nach Kategorie gruppieren
|
||||||
by_category: Dict[str, List[Dict[str, Any]]] = {}
|
by_category: Dict[str, List[Dict[str, Any]]] = {}
|
||||||
@@ -310,19 +302,20 @@ def build_help_text(
|
|||||||
if cat in standard_categories:
|
if cat in standard_categories:
|
||||||
standard_cmds.extend(by_category[cat])
|
standard_cmds.extend(by_category[cat])
|
||||||
|
|
||||||
|
standard_lines: List[str] = []
|
||||||
if standard_cmds:
|
if standard_cmds:
|
||||||
lines.append("### 🔷 Standard-Hermes-Befehle (:: als Variante)")
|
standard_lines.append("### 🔷 Standard-Hermes-Befehle (:: als Variante)")
|
||||||
lines.append("")
|
standard_lines.append("")
|
||||||
lines.append("Diese Befehle sind die ::-Entsprechungen der Hermes-Slash-Commands")
|
standard_lines.append("Diese Befehle sind die ::-Entsprechungen der Hermes-Slash-Commands")
|
||||||
lines.append("(`/sethome`, `/reset`, `/busy`, …). Da Rocket.Chat kein `/` unterstützt,")
|
standard_lines.append("(`/sethome`, `/reset`, `/busy`, …). Da Rocket.Chat kein `/` unterstützt,")
|
||||||
lines.append("wurden sie auf `::` umgestellt:")
|
standard_lines.append("wurden sie auf `::` umgestellt:")
|
||||||
lines.append("")
|
standard_lines.append("")
|
||||||
for cmd in standard_cmds:
|
for cmd in standard_cmds:
|
||||||
lines.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
|
standard_lines.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
|
||||||
subcmds = cmd.get('subcommands', {})
|
subcmds = cmd.get('subcommands', {})
|
||||||
for sub_name, sub_desc in subcmds.items():
|
for sub_name, sub_desc in subcmds.items():
|
||||||
lines.append(f" - `::{cmd['name']} {sub_name}` — {sub_desc}")
|
standard_lines.append(f" - `::{cmd['name']} {sub_name}` — {sub_desc}")
|
||||||
lines.append("")
|
standard_lines.append("")
|
||||||
|
|
||||||
# ── Sektion 2: RC-Plugin-spezifische Befehle ──────────────────────
|
# ── Sektion 2: RC-Plugin-spezifische Befehle ──────────────────────
|
||||||
rc_categories = {"Raum", "Konfiguration", "Hilfe", "Plugin"}
|
rc_categories = {"Raum", "Konfiguration", "Hilfe", "Plugin"}
|
||||||
@@ -331,38 +324,43 @@ def build_help_text(
|
|||||||
if cat in rc_categories:
|
if cat in rc_categories:
|
||||||
rc_cmds.extend(by_category[cat])
|
rc_cmds.extend(by_category[cat])
|
||||||
|
|
||||||
|
rc_lines: List[str] = []
|
||||||
if rc_cmds:
|
if rc_cmds:
|
||||||
lines.append("### 🔶 RC-Plugin-spezifische Befehle")
|
rc_lines.append("### 🔶 RC-Plugin-spezifische Befehle")
|
||||||
lines.append("")
|
rc_lines.append("")
|
||||||
lines.append("Diese Befehle steuern das Rocket.Chat-Plugin direkt:")
|
rc_lines.append("Diese Befehle steuern das Rocket.Chat-Plugin direkt:")
|
||||||
lines.append("")
|
rc_lines.append("")
|
||||||
for cmd in rc_cmds:
|
for cmd in rc_cmds:
|
||||||
lines.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
|
rc_lines.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
|
||||||
subcmds = cmd.get('subcommands', {})
|
subcmds = cmd.get('subcommands', {})
|
||||||
for sub_name, sub_desc in subcmds.items():
|
for sub_name, sub_desc in subcmds.items():
|
||||||
lines.append(f" - `::{cmd['name']} {sub_name}` — {sub_desc}")
|
rc_lines.append(f" - `::{cmd['name']} {sub_name}` — {sub_desc}")
|
||||||
lines.append("")
|
rc_lines.append("")
|
||||||
lines.append(
|
rc_lines.append(
|
||||||
"**Butler-Routing-Modus:** cognitive (Vorschlag+Bestätigung), "
|
"**Butler-Routing-Modus:** cognitive (Vorschlag+Bestätigung), "
|
||||||
"strict (automatisch), off (deaktiviert) — einstellbar über `::onboarding`"
|
"strict (automatisch), off (deaktiviert) — einstellbar über `::onboarding`"
|
||||||
)
|
)
|
||||||
lines.append("")
|
rc_lines.append("")
|
||||||
|
|
||||||
# ── Sektion 3: Natürliche Sprach-Befehle ──────────────────────────
|
# ── Sektion 3: Natürliche Sprach-Befehle ──────────────────────────
|
||||||
lines.append("### 🗣️ Natürliche Sprach-Befehle")
|
natural_lines = [
|
||||||
lines.append("")
|
"### 🗣️ Natürliche Sprach-Befehle",
|
||||||
lines.append("Du kannst auch in natürlicher Sprache mit mir sprechen:")
|
"",
|
||||||
lines.append("")
|
"Du kannst auch in natürlicher Sprache mit mir sprechen:",
|
||||||
lines.append("- **Raum wechseln:** 'Lass uns in #Projektraum wechseln'")
|
"",
|
||||||
lines.append("- **Thema verschieben:** 'Das gehört in den Plugin-Raum'")
|
"- **Raum wechseln:** 'Lass uns in #Projektraum wechseln'",
|
||||||
lines.append("- **Hilfe anfordern:** 'Ich brauche Hilfe zum Rocketchat Plugin'")
|
"- **Thema verschieben:** 'Das gehört in den Plugin-Raum'",
|
||||||
lines.append("- **Status abfragen:** '::status' oder 'Wie ist der Status?'")
|
"- **Hilfe anfordern:** 'Ich brauche Hilfe zum Rocketchat Plugin'",
|
||||||
lines.append("- **Auftrag erteilen:** 'Mach mal...', 'Teste...', 'Fix...'")
|
"- **Status abfragen:** '::status' oder 'Wie ist der Status?'",
|
||||||
lines.append("")
|
"- **Auftrag erteilen:** 'Mach mal...', 'Teste...', 'Fix...'",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
|
||||||
# ── Sektion 4: Plugin-Status ──────────────────────────────────────
|
# ── Sektion 4: Plugin-Status ──────────────────────────────────────
|
||||||
lines.append("### 📋 Plugin-Status")
|
status_lines = [
|
||||||
lines.append("")
|
"### 📋 Plugin-Status",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
|
||||||
# P1-4: Status-Farben (Flughafen-Prinzip) — nur wenn PresenceEngine aktiv
|
# P1-4: Status-Farben (Flughafen-Prinzip) — nur wenn PresenceEngine aktiv
|
||||||
if presence_enabled:
|
if presence_enabled:
|
||||||
@@ -371,50 +369,116 @@ def build_help_text(
|
|||||||
"away": "🟨 away (Hintergrund-Task aktiv, Heartbeat pulsiert)",
|
"away": "🟨 away (Hintergrund-Task aktiv, Heartbeat pulsiert)",
|
||||||
"busy": "🟥 busy (verarbeitet Nachricht)",
|
"busy": "🟥 busy (verarbeitet Nachricht)",
|
||||||
}
|
}
|
||||||
lines.append("### 🚦 Status-Farben")
|
status_lines.append("### 🚦 Status-Farben")
|
||||||
lines.append("")
|
status_lines.append("")
|
||||||
lines.append(
|
status_lines.append(
|
||||||
"Der Bot zeigt seinen Status nach dem **Flughafen-Prinzip** an: "
|
"Der Bot zeigt seinen Status nach dem **Flughafen-Prinzip** an: "
|
||||||
"wie eine Ampel signalisiert er, ob er bereit (grün), beschäftigt "
|
"wie eine Ampel signalisiert er, ob er bereit (grün), beschäftigt "
|
||||||
"(rot) oder im Hintergrund aktiv (gelb) ist."
|
"(rot) oder im Hintergrund aktiv (gelb) ist."
|
||||||
)
|
)
|
||||||
lines.append("")
|
status_lines.append("")
|
||||||
for status, label in status_emoji.items():
|
for status, label in status_emoji.items():
|
||||||
marker = " ← aktuell" if status == current_status else ""
|
marker = " ← aktuell" if status == current_status else ""
|
||||||
lines.append(f"- {label}{marker}")
|
status_lines.append(f"- {label}{marker}")
|
||||||
lines.append("")
|
status_lines.append("")
|
||||||
|
|
||||||
if room_map_summary:
|
if room_map_summary:
|
||||||
lines.append(room_map_summary)
|
status_lines.append(room_map_summary)
|
||||||
else:
|
else:
|
||||||
lines.append("Keine Raum-Map geladen.")
|
status_lines.append("Keine Raum-Map geladen.")
|
||||||
|
|
||||||
lines.append("")
|
footer = [
|
||||||
lines.append("---")
|
"",
|
||||||
lines.append("💡 **Tipp:** `::hilfe` zeigt diese Seite jederzeit an.")
|
"---",
|
||||||
lines.append("💡 Du kannst auch natürliche Sprache verwenden: 'Ich brauche Hilfe' zeigt diese Seite an.")
|
"💡 **Tipp:** `::hilfe` zeigt diese Seite jederzeit an.",
|
||||||
lines.append("")
|
"💡 Du kannst auch natürliche Sprache verwenden: 'Ich brauche Hilfe' zeigt diese Seite an.",
|
||||||
lines.append(
|
"",
|
||||||
"**Moderatorenrechte:** Im Multi-Room-Modus verschiebt der Agent "
|
"**Moderatorenrechte:** Im Multi-Room-Modus verschiebt der Agent "
|
||||||
"Nachrichten. Damit das sauber funktioniert, sollte der Bot "
|
"Nachrichten. Damit das sauber funktioniert, sollte der Bot "
|
||||||
"Moderatorenrechte in den Themenräumen haben."
|
"Moderatorenrechte in den Themenräumen haben.",
|
||||||
)
|
]
|
||||||
|
|
||||||
|
lines = header + core_lines + standard_lines + rc_lines + natural_lines + status_lines + footer
|
||||||
result = "\n".join(lines)
|
result = "\n".join(lines)
|
||||||
|
|
||||||
# P1-Fix: Rocket.Chat hat ein Payload-Limit von ~5000 Zeichen.
|
# P1-Fix: Rocket.Chat hat ein Payload-Limit von ~5000 Zeichen.
|
||||||
# Wenn der Hilfe-Text > 4000 Zeichen ist, lasse die room_map_summary
|
# Wenn der Hilfe-Text > 4000 Zeichen ist, lasse die room_map_summary
|
||||||
# weg und ersetze sie durch einen kurzen Hinweis.
|
# weg und ersetze sie durch einen kurzen Hinweis. Die Ersetzung erfolgt
|
||||||
|
# direkt in status_lines, damit sie auch bei den P1b-Kürzungen
|
||||||
|
# (Stufe 1/2) erhalten bleibt.
|
||||||
MAX_HELP_LENGTH = 4000
|
MAX_HELP_LENGTH = 4000
|
||||||
if len(result) > MAX_HELP_LENGTH and room_map_summary:
|
if len(result) > MAX_HELP_LENGTH and room_map_summary:
|
||||||
# Finde den Index der room_map_summary in lines und ersetze sie
|
for i, line in enumerate(status_lines):
|
||||||
for i, line in enumerate(lines):
|
|
||||||
if line == room_map_summary:
|
if line == room_map_summary:
|
||||||
lines[i] = (
|
status_lines[i] = (
|
||||||
"Raum-Map-Übersicht aus Platzgründen weggelassen "
|
"Raum-Map-Übersicht aus Platzgründen weggelassen "
|
||||||
"(> 4000 Zeichen). `::status` für Details."
|
"(> 4000 Zeichen). `::status` für Details."
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
lines = header + core_lines + standard_lines + rc_lines + natural_lines + status_lines + footer
|
||||||
|
result = "\n".join(lines)
|
||||||
|
|
||||||
|
# P1b-Fix: Die Hilfe-Seite ist durch Subcommand-Ergänzungen auch OHNE
|
||||||
|
# room_map_summary über das Payload-Limit gewachsen. Der P1-Fix greift
|
||||||
|
# nur, wenn room_map_summary gesetzt ist. Zweiter Check: wenn der Text
|
||||||
|
# IMMER NOCH > 4500 Zeichen ist (nah am ~5000-Limit), kürze die
|
||||||
|
# entbehrlichsten Sektionen progressiv — zuerst die natürlichen
|
||||||
|
# Sprach-Befehle (Sektion 3), dann die Standard-Hermes-Befehle
|
||||||
|
# (Sektion 1) auf eine kompakte Liste. Core-Befehle, RC-Plugin-Befehle,
|
||||||
|
# Status-Farben und Plugin-Status bleiben erhalten.
|
||||||
|
MAX_SAFE_LENGTH = 4500
|
||||||
|
# Kompakte Varianten der entbehrlichsten Sektionen — werden nur bei
|
||||||
|
# Überschreitung des Limits verwendet.
|
||||||
|
compact_natural = [
|
||||||
|
"### 🗣️ Natürliche Sprach-Befehle",
|
||||||
|
"",
|
||||||
|
"Du kannst auch natürlich sprechen: 'Lass uns in #Raum wechseln', "
|
||||||
|
"'Das gehört in den Plugin-Raum', 'Ich brauche Hilfe', '::status'.",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
compact_standard = ["### 🔷 Standard-Hermes-Befehle (:: als Variante)", ""]
|
||||||
|
for cmd in standard_cmds:
|
||||||
|
compact_standard.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
|
||||||
|
compact_standard.append("")
|
||||||
|
compact_rc = ["### 🔶 RC-Plugin-spezifische Befehle", ""]
|
||||||
|
compact_rc.append("Diese Befehle steuern das Rocket.Chat-Plugin direkt:")
|
||||||
|
compact_rc.append("")
|
||||||
|
for cmd in rc_cmds:
|
||||||
|
compact_rc.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
|
||||||
|
compact_rc.append("")
|
||||||
|
compact_rc.append(
|
||||||
|
"**Butler-Routing-Modus:** cognitive (Vorschlag+Bestätigung), "
|
||||||
|
"strict (automatisch), off (deaktiviert) — einstellbar über `::onboarding`"
|
||||||
|
)
|
||||||
|
compact_rc.append("")
|
||||||
|
|
||||||
|
if len(result) > MAX_SAFE_LENGTH:
|
||||||
|
# Stufe 1: Natürliche Sprach-Befehle auf eine Zeile kürzen
|
||||||
|
lines = (
|
||||||
|
header + core_lines + standard_lines + rc_lines
|
||||||
|
+ compact_natural + status_lines + footer
|
||||||
|
)
|
||||||
|
result = "\n".join(lines)
|
||||||
|
|
||||||
|
if len(result) > MAX_SAFE_LENGTH:
|
||||||
|
# Stufe 2: Standard-Hermes-Befehle auf kompakte Liste kürzen
|
||||||
|
# (nur Befehlsnamen, keine Subcommands, keine Einleitung)
|
||||||
|
lines = (
|
||||||
|
header + core_lines + compact_standard + rc_lines
|
||||||
|
+ compact_natural + status_lines + footer
|
||||||
|
)
|
||||||
|
result = "\n".join(lines)
|
||||||
|
|
||||||
|
if len(result) > MAX_SAFE_LENGTH:
|
||||||
|
# Stufe 3: RC-Plugin-Befehle behalten, aber Subcommand-Details
|
||||||
|
# weglassen (nur Befehlsname + help_text). Die Befehle selbst
|
||||||
|
# bleiben vollständig erhalten — nur die ausführlichen
|
||||||
|
# Subcommand-Aufzählungen (z.B. ::reasoning mit 9 Einträgen,
|
||||||
|
# ::onboarding mit 6) werden entfernt.
|
||||||
|
lines = (
|
||||||
|
header + core_lines + compact_standard + compact_rc
|
||||||
|
+ compact_natural + status_lines + footer
|
||||||
|
)
|
||||||
result = "\n".join(lines)
|
result = "\n".join(lines)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -318,6 +318,191 @@ class TestBuildHelpText:
|
|||||||
assert "Raum-Map: 1 Raum" in text
|
assert "Raum-Map: 1 Raum" in text
|
||||||
assert len(text) <= 4000
|
assert len(text) <= 4000
|
||||||
|
|
||||||
|
def test_build_help_text_length_with_all_commands(self):
|
||||||
|
"""P1b-Fix: Hilfe-Text bleibt auch OHNE room_map_summary unter 4500 Zeichen.
|
||||||
|
|
||||||
|
Die Hilfe-Seite ist durch Subcommand-Ergänzungen (mode proactive,
|
||||||
|
mode silent_collector, Routing-Modi-Hinweis) über das Payload-Limit
|
||||||
|
gewachsen. Der P1-Fix griff nur bei gesetzter room_map_summary.
|
||||||
|
Dieser Test registriert ALLE realen Befehle (inkl. Subcommands) und
|
||||||
|
prüft, dass der Text auch ohne room_map_summary < 4500 Zeichen bleibt.
|
||||||
|
"""
|
||||||
|
from archivar.inline_commands import (
|
||||||
|
InlineCommandRegistry,
|
||||||
|
build_help_text,
|
||||||
|
)
|
||||||
|
|
||||||
|
registry = InlineCommandRegistry()
|
||||||
|
async def dummy(room_id, args):
|
||||||
|
return "ok"
|
||||||
|
|
||||||
|
# Alle realen Befehle aus adapter.py _register_inline_commands()
|
||||||
|
# inkl. Subcommands — spiegelt den Produktions-Registry-Stand.
|
||||||
|
registry.register(
|
||||||
|
"sethome", dummy,
|
||||||
|
"Setzt den Heimatraum (Alternative zu /sethome)",
|
||||||
|
category="Standard",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"reset", dummy,
|
||||||
|
"Setzt den Plugin-Status zurück (Alternative zu /reset)",
|
||||||
|
category="Standard",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"busy", dummy,
|
||||||
|
"Zeigt/steuert den Busy-Status (::Variante von /busy)",
|
||||||
|
category="Standard",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"allowalways", dummy,
|
||||||
|
"Verwaltet die Allow-Always-Liste (::Variante von /allow-always)",
|
||||||
|
category="Standard",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"commands", dummy,
|
||||||
|
"Listet alle ::-Befehle (::Variante von /commands)",
|
||||||
|
category="Info",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"restart", dummy,
|
||||||
|
"Löst Gateway-Neustart aus (::Variante von /restart)",
|
||||||
|
category="Gateway",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"update", dummy,
|
||||||
|
"Zeigt Update-Informationen (::Variante von /update)",
|
||||||
|
category="Gateway",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"setfakt", dummy,
|
||||||
|
"Ändert den FAKT-Speicherort",
|
||||||
|
category="Konfiguration",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"hilfe", dummy,
|
||||||
|
"Zeigt diese Hilfeseite",
|
||||||
|
category="Hilfe",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"status", dummy,
|
||||||
|
"Zeigt aktuellen Plugin-Status",
|
||||||
|
category="Hilfe",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"multiroom", dummy,
|
||||||
|
"Multi-Room-Agent aktivieren/deaktivieren/Status",
|
||||||
|
category="Plugin",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"onboarding", dummy,
|
||||||
|
"Onboarding steuern: start/status/resume/pause/abort/reset",
|
||||||
|
category="Plugin",
|
||||||
|
subcommands={
|
||||||
|
"start": "Startet das Onboarding neu",
|
||||||
|
"status": "Zeigt den aktuellen Onboarding-Status mit Fortschritt",
|
||||||
|
"resume": "Setzt ein pausiertes Onboarding fort",
|
||||||
|
"pause": "Pausiert das Onboarding",
|
||||||
|
"abort": "Bricht das Onboarding ab (mit Bestätigung)",
|
||||||
|
"reset": "Hart-Reset des Onboarding-State, Backups bleiben",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"curate", dummy,
|
||||||
|
"Kuratiert die Room-Map-Keywords (R10)",
|
||||||
|
category="Plugin",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"keywords", dummy,
|
||||||
|
"Gesammelte Stichworte bewerten (V3 Silent Collector)",
|
||||||
|
category="Plugin",
|
||||||
|
subcommands={
|
||||||
|
"review": "Zeigt gesammelte Stichworte zur Bewertung (✅/❌)",
|
||||||
|
"status": "Zeigt wieviele Stichworte pro Raum gesammelt sind",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"butler", dummy,
|
||||||
|
"Butler-Lern-Modus anzeigen/wechseln (V3)",
|
||||||
|
category="Plugin",
|
||||||
|
subcommands={
|
||||||
|
"mode": "Zeigt den aktuellen Butler-Lern-Modus",
|
||||||
|
"mode proactive": "Wechselt zu proaktiv (4-Button-Rückfrage, V2)",
|
||||||
|
"mode silent_collector": "Wechselt zu stillem Sammeln (V3)",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"approve", dummy,
|
||||||
|
"Bestätigt einen gefährlichen Befehl (einmalig)",
|
||||||
|
category="Standard",
|
||||||
|
subcommands={
|
||||||
|
"session": "Bestätigt für die aktuelle Session",
|
||||||
|
"always": "Bestätigt dauerhaft (Allow-Always)",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"deny", dummy,
|
||||||
|
"Lehnt einen gefährlichen Befehl ab",
|
||||||
|
category="Standard",
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"setstatus", dummy,
|
||||||
|
"Aktivitäts-Indikator an/abschalten (PresenceEngine)",
|
||||||
|
category="Plugin",
|
||||||
|
subcommands={
|
||||||
|
"on": "Aktivitäts-Indikator einschalten",
|
||||||
|
"off": "Aktivitäts-Indikator ausschalten",
|
||||||
|
"status": "Status des Aktivitäts-Indikators anzeigen",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"reasoning", dummy,
|
||||||
|
"Reasoning-Level steuern (::Variante von /reasoning)",
|
||||||
|
category="Konfiguration",
|
||||||
|
subcommands={
|
||||||
|
"none": "Reasoning komplett abschalten",
|
||||||
|
"low": "Kurzes, fokussiertes Reasoning",
|
||||||
|
"medium": "Ausgewogen (Standard)",
|
||||||
|
"high": "Gründliches Reasoning",
|
||||||
|
"xhigh": "Maximales Reasoning (Default bei Qwen3.8)",
|
||||||
|
"show": "Model-Reasoning in Antworten anzeigen",
|
||||||
|
"hide": "Model-Reasoning verbergen",
|
||||||
|
"reset": "Session-Override zurücksetzen",
|
||||||
|
"--global": "Permanent in config.yaml speichern (mit Level kombinierbar)",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
registry.register(
|
||||||
|
"compress", dummy,
|
||||||
|
"Kontext manuell komprimieren (::Variante von /compress)",
|
||||||
|
category="Standard",
|
||||||
|
)
|
||||||
|
|
||||||
|
# OHNE room_map_summary — der P1-Fix greift hier NICHT.
|
||||||
|
text = build_help_text(registry, room_map_summary="")
|
||||||
|
assert len(text) < 4500, (
|
||||||
|
f"Hilfe-Text ist {len(text)} Zeichen lang, "
|
||||||
|
f"maximal erlaubt sind < 4500 (Payload-Limit ~5000)"
|
||||||
|
)
|
||||||
|
|
||||||
|
# MIT room_map_summary — beide Fixes müssen greifen.
|
||||||
|
big_summary = "Rocket.Chat Raum-Map:\n"
|
||||||
|
for i in range(5):
|
||||||
|
big_summary += (
|
||||||
|
f" {i+1}. #Raum{i+1} (room_id_{i+1}...) — "
|
||||||
|
f"Thema: Dies ist ein sehr langer Beschreibungstext für Raum {i+1} "
|
||||||
|
f"um die Länge der Hilfeseite künstlich zu erhöhen\n"
|
||||||
|
)
|
||||||
|
text_with_map = build_help_text(registry, room_map_summary=big_summary)
|
||||||
|
assert len(text_with_map) < 4500, (
|
||||||
|
f"Hilfe-Text mit room_map_summary ist {len(text_with_map)} Zeichen lang, "
|
||||||
|
f"maximal erlaubt sind < 4500"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Core-Befehle, RC-Plugin-Befehle und Plugin-Status müssen erhalten bleiben.
|
||||||
|
assert "Core-Befehle" in text
|
||||||
|
assert "RC-Plugin-spezifische Befehle" in text
|
||||||
|
assert "Plugin-Status" in text
|
||||||
|
assert "::butler" in text
|
||||||
|
|
||||||
|
|
||||||
class TestBuildStatusText:
|
class TestBuildStatusText:
|
||||||
"""Tests für build_status_text."""
|
"""Tests für build_status_text."""
|
||||||
|
|||||||
Reference in New Issue
Block a user