feat(archivar): Vierter Baustein — Agent-Antwortziel via Archivar-Kontext

Option C (Adapter routet Antwort automatisch um):
Priority 0 im Virtual→Real Room Translation: Wenn _THEMATIC_TARGET_ROOM
gesetzt ist und vom Ursprungsraum abweicht, geht die Antwort dorthin.

Null Core-Impact, +8 Zeilen in adapter.py, kein Prompt-Cache-Break.
Der Agent antwortet wie bisher — der Adapter lenkt um.

Flow: Agent sendet Antwort → Adapter prüft _THEMATIC_TARGET_ROOM →
gesetzt? → Zielraum. Sonst → _CURRENT_ORIGIN_ROOM (wie bisher).
This commit is contained in:
Bernd (Hermes)
2026-06-14 19:41:19 +02:00
parent 48fb292fe0
commit b05b1ab1ec
+14
View File
@@ -1328,6 +1328,13 @@ class RocketChatAdapter(BasePlatformAdapter):
# We must resolve it to a real Rocket.Chat room_id for REST API. # We must resolve it to a real Rocket.Chat room_id for REST API.
real_room_id = chat_id real_room_id = chat_id
if chat_id.startswith("user:"): if chat_id.startswith("user:"):
# Priority 0: Archivar-Kontext — wenn der Archivar einen thematischen
# Zielraum gesetzt hat, geht die Antwort dorthin (Agent-Autonomie).
thematic_target = _THEMATIC_TARGET_ROOM.get()
if thematic_target and thematic_target != _CURRENT_ORIGIN_ROOM.get():
real_room_id = thematic_target
logger.debug("[rocketchat] send via Archivar target: %s → %s", chat_id, real_room_id)
else:
# Priority 1: ContextVar from the message that triggered this turn # Priority 1: ContextVar from the message that triggered this turn
origin = _CURRENT_ORIGIN_ROOM.get() origin = _CURRENT_ORIGIN_ROOM.get()
if origin: if origin:
@@ -1528,6 +1535,13 @@ class RocketChatAdapter(BasePlatformAdapter):
# We must resolve it to a real Rocket.Chat room_id for REST API. # We must resolve it to a real Rocket.Chat room_id for REST API.
real_room_id = chat_id real_room_id = chat_id
if chat_id.startswith("user:"): if chat_id.startswith("user:"):
# Priority 0: Archivar-Kontext — wenn der Archivar einen thematischen
# Zielraum gesetzt hat, geht die Antwort dorthin (Agent-Autonomie).
thematic_target = _THEMATIC_TARGET_ROOM.get()
if thematic_target and thematic_target != _CURRENT_ORIGIN_ROOM.get():
real_room_id = thematic_target
logger.debug("[rocketchat] send via Archivar target: %s → %s", chat_id, real_room_id)
else:
# Priority 1: ContextVar from the message that triggered this turn # Priority 1: ContextVar from the message that triggered this turn
origin = _CURRENT_ORIGIN_ROOM.get() origin = _CURRENT_ORIGIN_ROOM.get()
if origin: if origin: