""" Notification tools — proactively send messages to user channels. nc_talk_send routes through notification.py → channels.json. Requires notification_channel and notification_room set in the user's channels.json. """ import logging from persona import get_user logger = logging.getLogger(__name__) async def nc_talk_send(message: str) -> str: """Send a message to the user via their configured notification channel. Channel is resolved from the user's channels.json (notification_channel key). Falls back to Nextcloud Talk if configured. No-op if no channel is set. """ from notification import notify username = get_user() try: await notify(username, message) return f"Message sent to {username}'s notification channel." except Exception as e: logger.warning("nc_talk_send error for %s: %s", username, e) return f"Failed to send notification: {e}"