refactor: 移除插件内存管理系统 + 新增工作流引擎

移除内容:
- 删除 plugin_memory_manager.py (TTL淘汰 + 懒加载系统)
- unified_tool_manager.py 精简为直接加载,去掉内存管理器集成
- tui.py 移除内存管理状态显示

新增内容:
- plugins/workflow.py: YAML 工作流引擎
  - 顺序执行多步骤 (tool/shell/echo/wait/set/if)
  - 步骤间变量传递 ({{steps.name.output}})
  - 条件分支 (if/then/else)
  - 错误处理 (continue_on_error / on_fail)
  - 断点续跑 (状态持久化)
  - 调用其他插件作为步骤
- workflows/example.yaml: 示例工作流

修复:
- unified_tool_manager.shutdown() 增加 graceful cleanup
- unregister_tool() 增加实例清理
This commit is contained in:
xiaoli-cli bot committed 2026-05-08 18:07:55 +08:00
1 parent 115ce38370
commit a7f64cd797
5 files changed
+982 -1014

No files matched your search

+4 -11
View File
@@ -562,13 +562,9 @@ if TEXTUAL_AVAILABLE:
status_container.mount(Static(f" 工具: {len(self.bridge.tools())} 个", classes="tool-item"))
status_container.mount(Static(f" 引擎: {len(self.bridge.engines())} 个", classes="tool-item"))
# 内存管理状态
if hasattr(self.cli, 'liugin_manager') and hasattr(self.cli.liugin_manager, 'memory_manager'):
mgr = self.cli.liugin_manager.memory_manager
s = mgr.get_status()
status_container.mount(Static(f" 已加载: {s['loaded']}", classes="tool-item"))
if s['unloaded'] > 0:
status_container.mount(Static(f" 已卸载: {s['unloaded']}", classes="tool-item"))
# 工具数
if hasattr(self.cli, 'liugin_manager'):
status_container.mount(Static(f" 工具: {len(self.cli.liugin_manager.tools)} 个", classes="tool-item"))
def _update_status(self, text: str):
bar = self.query_one("#status-bar")
@@ -822,10 +818,7 @@ if TEXTUAL_AVAILABLE:
f" 工具数: {len(self.bridge.tools())}",
f" 对话数: {len(self.bridge.history())}",
]
# 内存管理状态
if hasattr(self.cli, 'liugin_manager') and hasattr(self.cli.liugin_manager, 'memory_manager'):
mgr = self.cli.liugin_manager.memory_manager
status_lines.append(mgr.format_status())
self._system('\n'.join(status_lines))
# ── AI 生成 ──