2026-07-22 01:22:15 +02:00
|
|
|
"""System participant handler — passive participant that only reads."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
from typing import Any
|
|
|
|
|
|
2026-07-25 21:03:46 +02:00
|
|
|
from app.plugins.builtins.kommunikation.contracts import ParticipantHandler
|
2026-07-22 01:22:15 +02:00
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SystemParticipantHandler(ParticipantHandler):
|
|
|
|
|
"""System participant — passive, does not respond to messages.
|
|
|
|
|
|
|
|
|
|
The system participant only sends messages triggered by system events
|
|
|
|
|
(handled in the plugin's event handlers). It does not respond to
|
|
|
|
|
user messages in the chat.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def __init__(self, container: Any) -> None:
|
|
|
|
|
self._container = container
|
|
|
|
|
|
|
|
|
|
async def on_message_received(
|
|
|
|
|
self,
|
|
|
|
|
conversation_id: Any,
|
|
|
|
|
message: dict[str, Any],
|
|
|
|
|
conversation: dict[str, Any],
|
|
|
|
|
mentions: list[str],
|
|
|
|
|
context: dict[str, Any],
|
|
|
|
|
) -> list[dict[str, Any]] | None:
|
|
|
|
|
"""System is passive — does not respond to messages.
|
|
|
|
|
|
|
|
|
|
Users can interact with action_card buttons (open, archive) which
|
|
|
|
|
are handled via the frontend, not via new messages.
|
|
|
|
|
"""
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def get_participant_info(self) -> dict[str, Any]:
|
|
|
|
|
"""Return participant metadata."""
|
|
|
|
|
return {
|
|
|
|
|
"display_name": "System",
|
|
|
|
|
"avatar_url": None,
|
|
|
|
|
"capabilities": ["notifications", "action_cards"],
|
|
|
|
|
"description": "System-Benachrichtigungen",
|
|
|
|
|
}
|