# Copyright (c) 2026 Krzysztof Rudnicki. MIT licence. """The seam between the bot and Signal. Everything above this interface is transport-agnostic, which is what lets the same bot code run against the real signal-cli-rest-api container and against the local fake used by the tests and the end-to-end script. """ from __future__ import annotations from typing import TYPE_CHECKING, Protocol, runtime_checkable if TYPE_CHECKING: from collections.abc import AsyncIterator @runtime_checkable class Transport(Protocol): """What the bot needs from a Signal backend.""" def receive(self) -> AsyncIterator[str]: """Yield raw envelope frames until the transport is closed.""" async def send_text(self, text: str, recipient: str) -> None: """Send a plain-text message to a group id or phone number.""" async def send_image(self, image_base64: str, recipient: str) -> None: """Send a base64-encoded image attachment to a recipient.""" async def list_attachments(self) -> list[str]: """Return the ids of attachments stored server-side.""" async def delete_attachment(self, attachment_id: str) -> None: """Delete one stored attachment by id."""