ForcePilot/backend/package/yuxi/channels/protocols/lifecycle.py

20 lines
600 B
Python
Raw Normal View History

from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import Any, Protocol, runtime_checkable
from yuxi.channels.models import ChannelMessage
@runtime_checkable
class ChannelLifecycleProtocol(Protocol):
def on_message(self, handler: Callable[[ChannelMessage], Awaitable[None]]) -> None: ...
def normalize_inbound(self, raw: Any) -> ChannelMessage: ...
def format_outbound(self, response: Any) -> Any: ...
def on_config_changed(self, prev_cfg: dict, next_cfg: dict) -> None: ...
async def run_startup_maintenance(self) -> None: ...