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
+13 -13
View File
@@ -6,8 +6,8 @@ from types import SimpleNamespace
from unittest.mock import Mock, patch
from app.runtime.config import settings
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
from app.agent.llm import capability as capability_module
from app.agent.llm.capability import (
@@ -171,12 +171,12 @@ class AgentCapabilityManagerTest(unittest.TestCase):
)
self.assertTrue(
AgentCapabilityManager.supports_native_voice_reply(
MessageChannel.Telegram.value, None
NotificationChannel.Telegram.value, None
)
)
self.assertTrue(
AgentCapabilityManager.supports_native_voice_reply(
MessageChannel.Feishu.value, None
NotificationChannel.Feishu.value, None
)
)
self.assertTrue(
@@ -184,7 +184,7 @@ class AgentCapabilityManagerTest(unittest.TestCase):
)
self.assertTrue(
AgentCapabilityManager.supports_native_voice_reply(
MessageChannel.WebAgent.value, None
NotificationChannel.WebAgent.value, None
)
)
self.assertFalse(
@@ -204,27 +204,27 @@ class AgentCapabilityManagerTest(unittest.TestCase):
):
self.assertTrue(
AgentCapabilityManager.supports_native_voice_reply(
MessageChannel.Wechat.value, "wechat-app"
NotificationChannel.Wechat.value, "wechat-app"
)
)
self.assertFalse(
AgentCapabilityManager.supports_native_voice_reply(
MessageChannel.Wechat.value, "wechat-bot"
NotificationChannel.Wechat.value, "wechat-bot"
)
)
self.assertFalse(
AgentCapabilityManager.supports_native_voice_reply(
MessageChannel.Wechat.value, "missing"
NotificationChannel.Wechat.value, "missing"
)
)
def test_channel_capability_marks_voice_output_channels(self):
"""校验消息渠道能力显式声明原生语音输出支持。"""
for channel in (
MessageChannel.Telegram,
MessageChannel.Feishu,
MessageChannel.Wechat,
MessageChannel.WebAgent,
NotificationChannel.Telegram,
NotificationChannel.Feishu,
NotificationChannel.Wechat,
NotificationChannel.WebAgent,
):
self.assertTrue(
ChannelCapabilityManager.supports_capability(
@@ -233,7 +233,7 @@ class AgentCapabilityManagerTest(unittest.TestCase):
)
self.assertFalse(
ChannelCapabilityManager.supports_capability(
MessageChannel.Slack, ChannelCapability.AUDIO_OUTPUT
NotificationChannel.Slack, ChannelCapability.AUDIO_OUTPUT
)
)