P2-Fix: UI-Polish — Ampelsymbole vereinheitlicht + Room-Map-Summary in ::status

FIX 1: 🔴/🟢/🟡 durch 🟥/🟩/🟨 ersetzt (Geometric Shapes Extended)
- Rocket.Chat rendert 🔴 etwa doppelt so groß wie 🟢/🟡
- 🟥/🟩/🟨 sind alle aus demselben Unicode-Block → konsistente Größe
- Betrifft build_help_text (Status-Farben-Sektion) und build_status_text (PresenceEngine-Info)

FIX 2: build_status_text erhält Längen-Guard (~5000 Zeichen)
- Bei Überschreitung wird die room_map_summary durch kompakte Version ersetzt
- Kompakt: nur Raum-Name + Catch-All-Marker, keine Keywords/Themes
- ::status zeigt jetzt immer die Raum-Map (vorher nur in ::hilfe, dort oft gekürzt)

Tests: 87/87 passed, build_help_text < 4000 chars, build_status_text < 5000 chars
This commit is contained in:
Bernd (Hermes)
2026-07-25 20:26:27 +02:00
parent 5d5a361993
commit bf42ba056e
+44 -7
View File
@@ -325,9 +325,9 @@ def build_help_text(
# 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:
status_emoji = { status_emoji = {
"online": "🟢 online (idle, verfügbar)", "online": "🟩 online (idle, verfügbar)",
"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") lines.append("### 🚦 Status-Farben")
lines.append("") lines.append("")
@@ -420,9 +420,9 @@ def build_status_text(
# P1-4: PresenceEngine-Info (nur wenn presence_enabled explizit gesetzt) # P1-4: PresenceEngine-Info (nur wenn presence_enabled explizit gesetzt)
if presence_enabled is not None: if presence_enabled is not None:
status_labels = { status_labels = {
"online": "🟢 online (idle, verfügbar)", "online": "🟩 online (idle, verfügbar)",
"away": "🟡 away (Hintergrund-Task aktiv)", "away": "🟨 away (Hintergrund-Task aktiv)",
"busy": "🔴 busy (verarbeitet Nachricht)", "busy": "🟥 busy (verarbeitet Nachricht)",
} }
pulse_label = "💓 aktiv" if pulse_active else "⏸️ inaktiv" pulse_label = "💓 aktiv" if pulse_active else "⏸️ inaktiv"
if presence_enabled: if presence_enabled:
@@ -439,7 +439,44 @@ def build_status_text(
lines.append("") lines.append("")
lines.append("💡 `::hilfe` für alle Befehle | `::status` für Aktualisierung") lines.append("💡 `::hilfe` für alle Befehle | `::status` für Aktualisierung")
return "\n".join(lines) result = "\n".join(lines)
# P2-Fix: Rocket.Chat Payload-Limit ~5000 Zeichen.
# Wenn der Status-Text > 5000 Zeichen ist, ersetze die room_map_summary
# durch eine kompakte Version (nur Raum-Name + Catch-All-Status).
MAX_STATUS_LENGTH = 5000
if len(result) > MAX_STATUS_LENGTH and room_map_summary:
# Baue kompakte Summary: nur Raum-Name + Catch-All-Marker
compact_lines = ["**Raum-Map (kompakt):**"]
for line in room_map_summary.splitlines():
stripped = line.strip()
if stripped.startswith(("Rocket.Chat", "Keywords", "Thema:")):
continue
# Zeilen wie " 1. Raumname (roomId) ★ CATCH-ALL — Thema: ..."
if stripped and stripped[0].isdigit():
# Extrahiere nur den Teil bis zum Catch-All-Marker
# Format: "1. Name (id) ★ CATCH-ALL — Thema: ..."
# oder: "1. Name (id) — Thema: ..."
if "★ CATCH-ALL" in stripped:
idx = stripped.index("★ CATCH-ALL") + len("★ CATCH-ALL")
compact_lines.append(stripped[:idx])
else:
# Nimm nur "1. Name (id)" — schneide bei " — " ab
dash_idx = stripped.find(" — ")
if dash_idx > 0:
compact_lines.append(stripped[:dash_idx])
else:
compact_lines.append(stripped)
compact_summary = "\n".join(compact_lines)
# Ersetze die room_map_summary in lines
for i, line in enumerate(lines):
if line == room_map_summary:
lines[i] = compact_summary
break
result = "\n".join(lines)
return result
# ── Inline-Command-Parser ─────────────────────────────────────────────── # ── Inline-Command-Parser ───────────────────────────────────────────────