from __future__ import annotations from yuxi.channels.models import ChatType def resolve_chat_type(chat_guid: str) -> ChatType: if ";-;" in chat_guid: return ChatType.GROUP return ChatType.DIRECT def extract_chat_display_name(chat_data: dict) -> str: return chat_data.get("displayName", "") def build_thread_key(agent_id: str, chat_guid: str) -> str: chat_type = "group" if ";-;" in chat_guid else "direct" return f"agent:{agent_id}:bluebubbles:{chat_type}:{chat_guid}"