Files
nanobot/nanobot/channels/_setup.py
T

23 lines
616 B
Python
Raw Normal View History

"""Resolve channel-owned setup contracts for settings consumers."""
2026-07-13 13:11:46 +08:00
from __future__ import annotations
from typing import TYPE_CHECKING
2026-07-13 13:11:46 +08:00
from nanobot.channels.contracts import ChannelSetupSpec
if TYPE_CHECKING:
from nanobot.channels.plugin import ChannelPlugin
2026-07-13 13:11:46 +08:00
def channel_setup_spec(
name: str,
2026-07-13 13:11:46 +08:00
*,
plugin: ChannelPlugin | None = None,
) -> ChannelSetupSpec | None:
"""Return the setup contract declared by one channel descriptor."""
if plugin is None:
from nanobot.channels.registry import load_channel_plugin
2026-07-13 13:11:46 +08:00
plugin = load_channel_plugin(name)
return plugin.setup