feat(plugin_system): 引入组件局部状态管理并重构插件API

引入了基于 `stream_id` 的组件局部状态管理机制。这允许在不修改全局配置的情况下,为特定会话临时启用或禁用组件,提供了更高的灵活性。

全面重构了 `plugin_manage_api`,提供了更强大和稳定的插件管理功能:
- 新增 `reload_all_plugins` 和 `get_system_report` API,方便进行批量重载和系统状态诊断。
- 增强了组件卸载逻辑,确保在插件移除时能更彻底地清理资源,特别是对 `EventHandler` 的订阅。
- 重写了内置的 `/system plugin` 命令,以利用新的API,并为相关操作添加了权限控制。

组件注册中心(ComponentRegistry)中的多个 `get_enabled_*` 方法现在可以接受 `stream_id`,以正确反映局部状态。

BREAKING CHANGE: `plugin_manage_api` 中的多个函数已被移除或替换。例如 `list_loaded_plugins` 和 `remove_plugin` 已被移除,加载插件的逻辑已整合到 `register_plugin_from_file` 中。内置的 `/system plugin` 命令的子命令也已更改。
This commit is contained in:
minecraft1024a
2025-11-21 21:05:02 +08:00
parent ccfe17c986
commit a0618fb3c4
5 changed files with 390 additions and 143 deletions

View File

@@ -296,7 +296,7 @@ class ChatBot:
response_data = None
if request_id and response_data:
logger.info(f"[DEBUG bot.py] 收到适配器响应request_id={request_id}")
logger.debug(f"[DEBUG bot.py] 收到适配器响应request_id={request_id}")
put_adapter_response(request_id, response_data)
else:
logger.warning(f"适配器响应消息格式不正确: request_id={request_id}, response_data={response_data}")