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
+9 -9
View File
@@ -9,7 +9,7 @@ from app.runtime.config import settings
from app.runtime.extensions.plugin_manager import PluginManager
from app.runtime.state import SystemHelper
from app.runtime.log import logger
from app.schemas import Notification, MessageChannel
from app.schemas import Message, NotificationChannel
from app.adapters.network.http import RequestUtils
from app.adapters.system.host import SystemUtils
from version import FRONTEND_VERSION, APP_VERSION
@@ -22,24 +22,24 @@ class SystemChain(ChainBase):
_restart_file = "__system_restart__"
def remote_clear_cache(self, channel: MessageChannel, userid: Union[int, str], source: Optional[str] = None):
def remote_clear_cache(self, channel: NotificationChannel, userid: Union[int, str], source: Optional[str] = None):
"""
清理系统缓存
"""
self.clear_cache()
self.post_message(Notification(
self.post_message(Message(
channel=channel,
source=source,
title=f"缓存清理完成!",
userid=userid,
save_history=False))
def restart(self, channel: MessageChannel, userid: Union[int, str], source: Optional[str] = None):
def restart(self, channel: NotificationChannel, userid: Union[int, str], source: Optional[str] = None):
"""
重启系统
"""
if channel and userid:
self.post_message(Notification(
self.post_message(Message(
channel=channel,
source=source,
title="系统正在重启,请耐心等候!",
@@ -180,11 +180,11 @@ class SystemChain(ChainBase):
title += f"当前前端版本:{front_local_version},远程版本:{front_release_version}"
return title
def version(self, channel: MessageChannel, userid: Union[int, str], source: Optional[str] = None):
def version(self, channel: NotificationChannel, userid: Union[int, str], source: Optional[str] = None):
"""
查看当前版本、远程版本
"""
self.post_message(Notification(
self.post_message(Message(
channel=channel,
source=source,
title=self.__get_version_message(),
@@ -203,13 +203,13 @@ class SystemChain(ChainBase):
if not isinstance(restart_channel, dict):
restart_channel = json.loads(restart_channel)
channel = next(
(channel for channel in MessageChannel.__members__.values() if
(channel for channel in NotificationChannel.__members__.values() if
channel.value == restart_channel.get('channel')), None)
userid = restart_channel.get('userid')
# 版本号
title = self.__get_version_message()
self.post_message(Notification(
self.post_message(Message(
channel=channel,
title=f"系统已重启完成!\n{title}",
userid=userid,