refactor(schemas): 统一 message/notification 命名边界,旧名收敛至兼容映射表

- notification 域:渠道能力(MessageChannel→NotificationChannel、ChannelCapability* 迁入 notification.py)
- message 域:消息收发(Notification→Message、NotificationType→MessageType、CommingMessage→IncomingMessage、NotificationHistoryItem→MessageHistoryItem、NotificationClear*→MessageClear*)
- Agent 工具契约:send_notification_message→send_message、notification_callback→message_callback
- 源码不保留旧名物理别名,旧导入经 app/runtime/compat/manifest.py SYMBOL_ALIASES 惰性解析
- API 路径与持久化键冻结不变,前端零改动
- 新增兼容守护测试与 docs/rules/07 命名边界规范
This commit is contained in:
jxxghp
2026-08-16 19:32:20 +08:00
parent 98276a68a8
commit 240a4dffe6
96 changed files with 1975 additions and 1751 deletions
+7 -7
View File
@@ -774,20 +774,20 @@ class AgentCapabilityManager:
if not channel:
return None
from app.schemas.types import MessageChannel
from app.schemas.types import NotificationChannel
if isinstance(channel, MessageChannel):
if isinstance(channel, NotificationChannel):
return channel
channel_text = str(channel).strip()
if not channel_text:
return None
lowered_channel = channel_text.lower()
for channel_item in MessageChannel:
for channel_item in NotificationChannel:
aliases = {
channel_item.value.lower(),
channel_item.name.lower(),
f"{MessageChannel.__name__}.{channel_item.name}".lower(),
f"{NotificationChannel.__name__}.{channel_item.name}".lower(),
}
if lowered_channel in aliases:
return channel_item
@@ -812,8 +812,8 @@ class AgentCapabilityManager:
cls, channel: Optional[str], source: Optional[str]
) -> bool:
"""判断当前渠道是否支持原生语音消息发送。"""
from app.schemas.message import ChannelCapability, ChannelCapabilityManager
from app.schemas.types import MessageChannel
from app.schemas.notification import ChannelCapability, ChannelCapabilityManager
from app.schemas.types import NotificationChannel
channel_enum = cls._parse_message_channel(channel)
if not channel_enum:
@@ -824,6 +824,6 @@ class AgentCapabilityManager:
):
return False
if channel_enum == MessageChannel.Wechat:
if channel_enum == NotificationChannel.Wechat:
return cls._is_wechat_app_mode(source)
return True