"""Normalised conversation identity shared across platforms and storage.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True, slots=True) class ThreadKey: """Normalised identity of a conversation scope across platforms. ``platform`` is ``"telegram"`` or ``"matrix"``. ``scope`` is the chat/room/user identifier as a string. ``thread`` is an optional sub-thread identifier. """ platform: str scope: str thread: str | None = None def __str__(self) -> str: parts = [self.platform, self.scope] if self.thread: parts.append(self.thread) return ":".join(parts)