feat: Unified Messaging System — kommunikation plugin, AI/Proactive/System participants, MessageSidebar, Rich Content Renderer

Phase 1: Backend plugin kommunikation (13 files, 10 tables, REST API, WebSocket, RBAC, DMS Bridge, Participant Registry, Mini-App Registry, Search Provider)
Phase 2: AI plugins as participants (ai_assistant + ai_proactive dock as participants, heartbeat job)
Phase 3: system_notif plugin (system events → chat messages, pinned System room)
Phase 4: Frontend MessageSidebar (replaces AISidebar, same design, comm API client, WebSocket hook, commStore)
Phase 5: Rich Content Block Renderer (11 components: Markdown, HTML, Image, Audio, Video, File, ActionCard, ContactCard, MiniApp, BlockRenderer)
BasePlugin: added services property + _container in on_activate
This commit is contained in:
Agent Zero
2026-07-22 01:22:15 +02:00
parent 5980d38c66
commit cc3ac9a43d
45 changed files with 8154 additions and 113 deletions
@@ -42,12 +42,78 @@ class AIAssistantPlugin(BasePlugin):
is_core=True,
)
def __init__(self) -> None:
super().__init__()
self._ai_handler = None
self._msg_handler = None
async def on_install(self, db, service_container) -> None:
"""Seed default provider and agent."""
from app.plugins.builtins.ai_assistant.services import seed_defaults
await seed_defaults(db)
async def on_activate(self, db, service_container, event_bus) -> None:
"""Activate plugin: register context tools and participant handler."""
await super().on_activate(db, service_container, event_bus)
# Register as participant in the kommunikation system
try:
from app.plugins.builtins.ai_assistant.participant_handler import (
AIParticipantHandler,
)
from app.plugins.builtins.kommunikation.participant_registry import (
get_participant_registry,
)
self._ai_handler = AIParticipantHandler(service_container)
get_participant_registry().register("ai", self._ai_handler)
logger.info("AI Assistant registered as participant 'ai'")
except Exception:
logger.exception("Failed to register AI Assistant as participant")
# Subscribe to message.received events
try:
self._msg_handler = self._on_message_received
event_bus.subscribe("message.received", self._msg_handler)
logger.info("AI Assistant subscribed to message.received events")
except Exception:
logger.exception("Failed to subscribe to message.received events")
async def _on_message_received(self, payload: dict[str, Any]) -> None:
"""Handle message.received event by delegating to the AI participant handler."""
if self._ai_handler is None:
return
try:
await self._ai_handler.handle_event(payload)
except Exception:
logger.exception("Error in AI participant handler for message.received")
async def on_deactivate(self, db, service_container, event_bus) -> None:
"""Deactivate plugin: unregister participant and event subscriptions."""
# Unregister from participant registry
try:
from app.plugins.builtins.kommunikation.participant_registry import (
get_participant_registry,
)
get_participant_registry().unregister("ai")
logger.info("AI Assistant unregistered as participant 'ai'")
except Exception:
logger.exception("Failed to unregister AI Assistant as participant")
# Unsubscribe from message.received events
if self._msg_handler:
try:
event_bus.unsubscribe("message.received", self._msg_handler)
except Exception:
logger.exception("Failed to unsubscribe from message.received events")
self._msg_handler = None
self._ai_handler = None
await super().on_deactivate(db, service_container, event_bus)
def get_notification_types(self) -> list[dict[str, Any]]:
return [
{