diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dbf488..da1d24e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ --- +## v5.1.3 (2026-04-28) + +### 新增功能 +- **图像生成插件** (`image_generator`) — 基于 ai.2x.nz 的 ComfyUI 在线服务,自然语言/Tag 双模式,支持中文描述,28 个角色工作流可选,分辨率可调(最大 1344×1344) +- **记忆系统插件** (`memory_plugin`) — 包装 `xcli_core/memory.py` 的完整记忆工具,AI 可写日记、读日记、搜索记忆、管理聊天记录、操作长期记忆 MEMORY.md +- **AI 编程助手横评页面** (`compare.html`) — 7 款工具(Claude Code / Codex CLI / Gemini CLI / Aider / Copilot CLI / 小狸 / TG HELPER)25+ 维度同口径对比 + +### 修复 +- 修复记忆系统插件(`Liugin` 类在 `xcli_core/memory.py` 中定义但未被插件管理器加载)导致 AI 无法调用记忆工具的问题,新增 `plugins/memory_plugin.py` 包装层 + +### 文档 +- 全面更新 README.md 至 v5.1.3 +- 新增记忆系统、Clawli 远程模式、MCP 协议支持、定时任务、系统通知等功能说明 +- 更新插件列表:15 个 → 17 个(+image_generator, +memory_plugin) +- 更新操作数:141 → 141+ +- 补充 MCP 协议支持说明(17 个插件全部实现 MCP 定义) +- 补充插件开发文档中 `Liugin` / `Plugin` 双协议说明 + +### 贡献者 +- 感谢 **艾轮 卧壳** 对本版本的贡献 🖤 + +--- + ## v5.1.2 (2026-04-26) ### 新增功能 diff --git a/README.md b/README.md index 04482b9..fae6ed7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ # 小狸 Pro-CLI

- 智能编程助手 — 代码编辑 · Git 集成 · 浏览器自动化 · 多 Agent 协作 + 智能编程助手 — 代码编辑 · Git 集成 · 浏览器自动化 · 多 Agent 协作 · 图像生成 · 记忆系统

- version + version python license tests + plugins + mcp

--- @@ -21,8 +23,14 @@ - **浏览器自动化** — Playwright 驱动,导航/交互/截图/JS 执行/PDF - **子 Agent 系统** — 多 Agent 并行协作,独立任务分配与结果回收 - **统一安全层** — AI 风险识别 + 三模式切换(普通/人工/无限制) -- **15 个插件 141 个操作** — 代码编辑、Git、浏览器、工程化、文件管理、任务管理等 -- **三模式界面** — TUI 图形化 + 传统命令行 + **Web UI 浏览器界面** +- **图像生成** — 基于 ComfyUI 在线服务,自然语言/Tag 双模式,支持中文描述 +- **记忆系统** — 长期记忆 + 每日日记 + AI 写日记 + 全局搜索 + 自动保存对话 +- **Clawli 远程模式** — PC-手机 WebSocket 双向通信,支持内网穿透代理 +- **定时任务** — 支持相对时间、绝对时间、重复任务,到期自动激活 AI +- **系统通知** — 跨平台任务完成通知(Windows / macOS / Linux) +- **MCP 协议** — 17 个插件全部实现 MCP 定义,支持 Function Calling 原生调用 +- **17 个插件 141+ 个操作** — 代码编辑、Git、浏览器、工程化、文件管理、图像生成、记忆等 +- **三模式界面** — TUI 图形化 + 传统命令行 + **Web UI 浏览器界面** - **113 个自动化测试** — pytest 覆盖全部插件和核心模块 ## 快速开始 @@ -43,6 +51,9 @@ python ai_cli.py # 指定引擎 python ai_cli.py --engine openai + +# Windows 一键启动(无需 Python 环境) +launcher.exe ``` ## AI 引擎 @@ -76,17 +87,17 @@ python ai_cli.py --engine openai } ``` -## 插件列表 (15 个) +## 插件列表 (17 个) ### 核心生产力 | 插件 | 操作数 | 说明 | |------|--------|------| -| `code_editor` | 23 | 代码编辑+搜索。精准替换、批量编辑、find/regex/symbols/imports/callers/todo/structure + 自动语法检查 | -| `git_tools` | 20 | Git 版本控制。status/diff/log/commit/branch + smart-commit/changelog/contributors | +| `code_editor` | 24 | 代码编辑+搜索。精准替换、批量编辑、find/regex/symbols/imports/callers/todo/structure + 自动语法检查 + diff 弹窗 | +| `git_tools` | 17 | Git 版本控制。status/diff/log/commit/branch + smart-commit/changelog/contributors/stale | | `cmd_executor` | 1 | Shell 命令执行。跨平台,超时控制,危险命令拦截 | -| `file_manager` | 11 | 文件系统。list/read/write/copy/move/delete/search/info/mkdir | -| `auto_engineer` | 16 | 工程化。lint/format/test/build/deps + 复杂度/安全扫描/质量指标 | +| `file_manager` | 10 | 文件系统。list/read/write/copy/move/delete/search/info/mkdir/append | +| `auto_engineer` | 12 | 工程化。lint/format/test/build/deps + 复杂度/安全扫描/质量指标/项目初始化 | | `task_manager` | 7 | 任务管理。add/list/complete/delete/clear,JSON 持久化 | ### 高级功能 @@ -94,7 +105,10 @@ python ai_cli.py --engine openai | 插件 | 操作数 | 说明 | |------|--------|------| | `sub_agent` | 8 | 子 Agent 系统。spawn/list/status/result/send/kill,多 Agent 并行协作 | -| `browser_auto` | 31 | 浏览器自动化。导航/点击/填写/截图/JS执行/PDF/cookies(基于 Playwright) | +| `browser_auto` | 28 | 浏览器自动化。导航/点击/填写/截图/JS执行/PDF/cookies(基于 Playwright) | +| `image_generator` | 7 | **图像生成**。基于 ComfyUI 在线服务,自然语言/Tag 双模式,28 个角色工作流 | +| `memory_plugin` | 11 | **记忆系统**。AI 写日记/搜索记忆/管理聊天记录/长期记忆 MEMORY.md | +| `scheduler` | 4 | **定时任务**。支持相对时间/绝对时间/重复任务,到期自动激活 AI | | `tool_search` | — | 工具搜索。按关键词发现可用插件(供 AI 按需调用) | ### 辅助工具 @@ -104,10 +118,43 @@ python ai_cli.py --engine openai | `network_tools` | 网络工具。ping/get/status/headers/ip | | `ai_search` | AI 搜索。jina.ai 智能搜索 + 网页内容提取 | | `frontend_tester` | 前端测试。HTML/CSS/JS 语法检查、响应式验证 | -| `speech_recognition` | 语音识别。录音 + 语音转文字 | +| `speech_recognition` | 语音识别。录音 + 语音转文字(Whisper) | | `audio_player` | 音频播放 | | `send_image` | Clawli 模式下发图片到手机 | +## 记忆系统 + +内置持久化记忆系统,AI 可以记住之前的工作: + +| 功能 | 说明 | +|------|------| +| 长期记忆 | `MEMORY.md` — AI 自己维护的精华记忆 | +| 每日日记 | `memory/YYYY-MM-DD.md` — 带时间戳和标签 | +| AI 写日记 | `memory_plugin diary_ai` — 自动标记 [AI观察] | +| 自动保存对话 | 每轮对话后自动存 JSON | +| 上下文压缩 | 超过 50 条自动 AI 总结,保留最近 10 条 | +| 全局搜索 | 搜索 MEMORY + 日记 + 聊天记录 | + +``` +memory_plugin diary 今天完成了API对接 +memory_plugin search 定时任务 +memory_plugin remember 用户偏好深色主题 +memory_plugin chat_search 图像生成 +``` + +## Clawli 远程模式 + +通过 WebSocket 实现 PC-手机双向通信: + +```bash +/remote start 9079 mypassword # 启动本地服务 +/remote proxy relay.example.com # 通过中继服务器穿透内网 +/remote stop # 停止服务 +/remote status # 查看状态 +``` + +功能:手机发消息给 AI、AI 回复推到手机、文件传输、图片识别。 + ## 安全机制 ### 三模式切换 (`/safe`) @@ -137,19 +184,33 @@ python ai_cli.py --engine openai - 子进程隔离执行 - 内存限制 +## MCP 协议支持 + +所有 17 个插件均实现 MCP (Model Context Protocol) 定义,支持三种工具调用协议: + +| 协议 | 说明 | +|------|------| +| **MCP** | Model Context Protocol 标准定义 | +| **FC** | OpenAI Function Calling 原生调用 | +| **JSON** | 传统 `{"action": "use_tool", ...}` 格式 | + +`fc_tools.py` 自动将 MCP 定义转换为 OpenAI FC 格式,支持混合响应解析。 + ## 命令列表 | 命令 | 说明 | |------|------| | `/help` | 显示帮助 | | `/safe` | 切换安全模式(普通→人工→无限制) | -| `/safe off` | 直接切换到无限制模式 | -| `/safe manual` | 直接切换到人工确认模式 | | `/engine list` | 列出可用引擎 | | `/engine switch <引擎>` | 切换引擎 | | `/engine.openai models` | 列出 OpenAI 引擎模型 | | `/chat save/list/open` | 聊天记录管理 | | `/file.read <路径>` | 读取文件 | +| `/remote` | Clawli 远程连接帮助 | +| `/notify` | 切换任务完成通知 | +| `/scheduler` / `/remind` | 管理定时任务 | +| `/memory` | 管理记忆系统 | | `/tui` | 切换 TUI 模式 | | `/quit` | 退出 | @@ -158,70 +219,64 @@ python ai_cli.py --engine openai 纯静态 HTML 界面,无需后端,浏览器直接打开。 ```bash -# 直接用浏览器打开 open webui.html # macOS xdg-open webui.html # Linux start webui.html # Windows ``` -### 功能 - -| 功能 | 说明 | -|------|------| -| 对话界面 | 聊天气泡、快捷指令、打字动画 | -| 代码编辑器 | 行号显示、Tab 缩进、Ctrl+S 保存、语法高亮 | -| 文件浏览 | 侧栏项目文件树,点击查看 | -| ️ 系统状态 | 插件/操作/引擎/测试统计 | -| 引擎面板 | Ollama / OpenAI 引擎一览 | -| 工具面板 | 15 个插件及操作数一览 | -| 日志面板 | 系统操作实时记录 | - ## 项目结构 ``` xiaoli-cli/ ├── ai_cli.py # 主入口 ├── webui.html # Web UI 界面 (纯静态 HTML) -├── launcher.py # 智能启动器 +├── launcher.py # 智能启动器(自动检测环境/安装依赖) ├── config.json.example # 配置模板 +├── easter_egg.py # 彩蛋 │ ├── xcli_core/ # 核心模块 │ ├── cli_core.py # 主循环 + 提示词构建 │ ├── cli_base.py # 初始化 + 引擎/插件加载 -│ ├── cli_tools.py # 工具调用执行 +│ ├── cli_tools.py # 工具调用执行(支持 MCP/FC/JSON) +│ ├── cli_clawli.py # Clawli 远程模式 +│ ├── cli_code_exec.py # 代码沙箱执行 │ ├── cli_display.py # 显示输出 │ ├── cli_history.py # 聊天记录 -│ ├── cli_code_exec.py # 代码执行 │ ├── config.py # 配置管理 │ ├── constants.py # 常量定义 -│ ├── safety.py # 统一安全层 -│ ├── sandbox.py # 代码安全沙箱 -│ ├── plugin_manager.py # 插件管理器 -│ └── tui.py # TUI 界面 +│ ├── fc_tools.py # MCP → FC 格式转换 +│ ├── memory.py # 记忆系统(长期记忆+日记+搜索+压缩) +│ ├── notification.py # 跨平台系统通知 +│ ├── plugin_manager.py # 插件管理器(Liugin/Plugin 双协议) +│ ├── safety.py # 统一安全层(AI 风险分析) +│ ├── sandbox.py # 代码安全沙箱(AST 级检测) +│ └── tui.py # TUI 界面(Textual + 动画) │ ├── ai_engines/ # AI 引擎 │ ├── ollama_engine.py # Ollama 本地模型 │ └── openai_engine.py # OpenAI 兼容格式 │ -├── plugins/ # 插件 (15 个) -│ ├── code_editor.py # 代码编辑+搜索 -│ ├── git_tools.py # Git 版本控制 +├── plugins/ # 插件 (17 个) +│ ├── code_editor.py # 代码编辑+搜索 (24 操作) +│ ├── git_tools.py # Git 版本控制 (17 操作) │ ├── cmd_executor.py # Shell 命令执行 -│ ├── file_manager.py # 文件管理 -│ ├── auto_engineer.py # 工程化自动化 +│ ├── file_manager.py # 文件管理 (10 操作) +│ ├── auto_engineer.py # 工程化自动化 (12 操作) │ ├── task_manager.py # 任务管理 -│ ├── sub_agent.py # 子 Agent 系统 -│ ├── browser_auto.py # 浏览器自动化 +│ ├── sub_agent.py # 子 Agent 系统 (8 操作) +│ ├── browser_auto.py # 浏览器自动化 (28 操作) +│ ├── image_generator.py # 图像生成 (7 操作) ⭐ NEW +│ ├── memory_plugin.py # 记忆系统 (11 操作) ⭐ NEW +│ ├── scheduler.py # 定时任务 │ ├── tool_search.py # 工具搜索 │ ├── network_tools.py # 网络工具 │ ├── ai_search.py # AI 搜索 │ ├── frontend_tester.py # 前端测试 │ ├── speech_recognition.py # 语音识别 -│ ├── audio_player.py # 音频播放 │ └── send_image.py # 图片发送 │ ├── skills/ # 技能 (Skill 协议) -├── image_engine/ # 图像识别引擎 +├── image_engine/ # 图像识别引擎(Ollama 视觉模型) ├── tests/ # 测试套件 (113 用例) ├── love.txt # 彩蛋情话 └── about.txt # 关于信息 @@ -239,8 +294,10 @@ python -c "import py_compile; py_compile.compile('ai_cli.py', doraise=True)" ## 插件开发 +小狸支持 `Liugin`(自研协议)和 `Plugin`(通用协议)两种类名,均可被插件管理器自动识别: + ```python -class Plugin: +class Plugin: # 或 class Liugin """我的插件""" def __init__(self): @@ -258,6 +315,18 @@ class Plugin: "usage": self.usage } + def get_mcp_definition(self): + return { + "name": "my_tool", + "description": "工具描述", + "inputSchema": { + "type": "object", + "properties": { + "args": {"type": "string", "description": "参数"} + } + } + } + def handle(self, args: str) -> str: return "处理结果" ``` @@ -271,3 +340,4 @@ class Plugin: - Gitee: https://gitee.com/shuiyu1123/xiaoli-cli - [更新日志](CHANGELOG.md) - [使用指南](HELP.md) +- [AI 编程助手横评](compare.html) diff --git a/about.txt b/about.txt index 260e9f5..e8cd47d 100644 --- a/about.txt +++ b/about.txt @@ -1,7 +1,7 @@ **产品标识** - **产品名称**:小狸智能体 增强-终端(Xiaoli Pro-CLI) -- **内部版本号**:20260426 -- **发布版本**:发行版5.1.1 +- **内部版本号**:20260428 +- **发布版本**:发行版5.1.3 **技术规格** - **主要语言**:简体中文(UTF-8)