2026-07-19 23:30:49 +08:00
|
|
|
"""Resolve channel-owned setup contracts for settings consumers."""
|
2026-07-13 13:11:46 +08:00
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2026-07-19 23:30:49 +08:00
|
|
|
from typing import TYPE_CHECKING
|
2026-07-13 13:11:46 +08:00
|
|
|
|
2026-07-19 23:30:49 +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
|
|
|
|
|
|
|
|
|
2026-07-19 23:30:49 +08:00
|
|
|
def channel_setup_spec(
|
|
|
|
|
name: str,
|
2026-07-13 13:11:46 +08:00
|
|
|
*,
|
2026-07-19 23:30:49 +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
|
|
|
|
2026-07-19 23:30:49 +08:00
|
|
|
plugin = load_channel_plugin(name)
|
|
|
|
|
return plugin.setup
|