feat(F072,F544): Welle 3 — Prozess-Isolation POC + Context-Curator im multiroom=false @implements: [F-072] [F-544]
This commit is contained in:
@@ -1489,6 +1489,11 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
# HOTFIX 2: Muss VOR dem Archivar-Handler-Block initialisiert werden,
|
||||
# da set_recent_auto_routes() das Dict bereits dort bindet.
|
||||
self._recent_auto_routes: Dict[str, Dict[str, Any]] = {}
|
||||
# F544: Archivar als Context-Curator — sammelt Raum-Kontext in JEDEM
|
||||
# Modus (multiroom true/false). Eigenständig, unabhängig von den
|
||||
# Multi-Room-Komponenten und dem ArchivarMessageHandler.
|
||||
from archivar.context_curator import ContextCurator
|
||||
self._context_curator = ContextCurator()
|
||||
# Archivar: Embedding-basierte Nachrichten-Klassifikation
|
||||
if _MULTIROOM():
|
||||
self._conversation_history = ConversationHistory(max_size=10)
|
||||
@@ -3290,6 +3295,17 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
if topic:
|
||||
await self._multiroom_context.add(room_id, room_name, topic)
|
||||
|
||||
# ── F544: Context-Curator — Raum-Kontext in JEDEM Modus sammeln ──
|
||||
# Auch im Single-Room-Modus (multiroom=false) sammelt der Archivar
|
||||
# als Context-Curator: letzte Themen, aktive User, häufige Keywords.
|
||||
# (Eigenständig, unabhängig von _conversation_history/_multiroom_context.)
|
||||
cc = getattr(self, "_context_curator", None)
|
||||
if cc is not None:
|
||||
try:
|
||||
cc.record(room_id, room_name, username, display_text)
|
||||
except Exception: # noqa: BLE001 — Context-Sampling nie crashen
|
||||
logger.debug("[rocketchat] F544 ContextCurator.record skipped (exc)", exc_info=True)
|
||||
|
||||
# ── Kontext-Reset: _THEMATIC_TARGET_ROOM pro Nachricht zurücksetzen ──
|
||||
# Verhindert dass der Zielraum der VORHERIGEN Nachricht an der
|
||||
# aktuellen klebt (z.B. DM nach Projektraum-Turn → Antwort im Projektraum).
|
||||
@@ -5360,6 +5376,17 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
category="Plugin",
|
||||
)
|
||||
|
||||
# F544: Context-Curator — Raum-Kontext abrufen (Archivar als
|
||||
# Context-Curator, funktioniert auch in multiroom=false).
|
||||
self._inline_commands.register(
|
||||
"context", self._cmd_context,
|
||||
help_text="Zeigt gesammelten Raum-Kontext (F544)",
|
||||
description="Zeigt den vom Archivar als Context-Curator gesammelten "
|
||||
"Raum-Kontext: letzte Themen, aktive User, häufige "
|
||||
"Keywords. Funktioniert in multiroom=true UND -false.",
|
||||
category="Plugin",
|
||||
)
|
||||
|
||||
async def _cmd_stability_test(self, room_id: str, args: str) -> str:
|
||||
"""::stability-test — Startet den 7-Tage-Stabilitätstest (F068)."""
|
||||
monitor = getattr(self, "_stability_monitor", None)
|
||||
@@ -5376,6 +5403,17 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
return "Kein Test aktiv. Start mit `::stability-test`."
|
||||
return monitor.generate_report_snapshot()
|
||||
|
||||
async def _cmd_context(self, room_id: str, args: str) -> str:
|
||||
"""::context — Zeigt gesammelten Raum-Kontext (F544 Context-Curator).
|
||||
|
||||
Wird vom Archivar als Context-Curator befüllt (letzte Themen, aktive
|
||||
User, häufige Keywords). Funktioniert in multiroom=true UND -false.
|
||||
"""
|
||||
cc = getattr(self, "_context_curator", None)
|
||||
if cc is None:
|
||||
return "⚠️ Context-Curator nicht verfügbar (Init-Fehler)."
|
||||
return cc.build_context_report(room_id)
|
||||
|
||||
async def _handle_inline_command(
|
||||
self, text: str, room_id: str, room_name: str, username: str
|
||||
) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user