fr-cli 2.2.7__tar.gz → 2.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. fr_cli-2.2.8/PKG-INFO +304 -0
  2. fr_cli-2.2.8/README.md +233 -0
  3. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/WEAPON.MD +77 -0
  4. fr_cli-2.2.8/fr_cli/agent/a2a.py +567 -0
  5. fr_cli-2.2.8/fr_cli/agent/builtins/powerful_agent_template.py +916 -0
  6. fr_cli-2.2.8/fr_cli/agent/coding_helper.py +811 -0
  7. fr_cli-2.2.8/fr_cli/agent/image_and_parallel.py +1020 -0
  8. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/master_prompt.py +3 -3
  9. fr_cli-2.2.8/fr_cli/agent/workflow_system.py +1058 -0
  10. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/llm.py +184 -1
  11. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/lang/i18n.py +2 -2
  12. fr_cli-2.2.8/fr_cli.egg-info/PKG-INFO +304 -0
  13. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli.egg-info/SOURCES.txt +11 -1
  14. {fr_cli-2.2.7 → fr_cli-2.2.8}/pyproject.toml +1 -1
  15. fr_cli-2.2.8/tests/test_a2a_and_providers.py +421 -0
  16. fr_cli-2.2.8/tests/test_coding_helper.py +205 -0
  17. fr_cli-2.2.8/tests/test_master_prompt_fix.py +193 -0
  18. fr_cli-2.2.8/tests/test_new_features.py +449 -0
  19. fr_cli-2.2.8/tests/test_new_providers.py +285 -0
  20. fr_cli-2.2.7/PKG-INFO +0 -228
  21. fr_cli-2.2.7/README.md +0 -157
  22. fr_cli-2.2.7/fr_cli.egg-info/PKG-INFO +0 -228
  23. {fr_cli-2.2.7 → fr_cli-2.2.8}/LICENSE +0 -0
  24. {fr_cli-2.2.7 → fr_cli-2.2.8}/MANIFEST.in +0 -0
  25. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/README.md +0 -0
  26. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/__init__.py +0 -0
  27. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/addon/plugin.py +0 -0
  28. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/__init__.py +0 -0
  29. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/__init__.py +0 -0
  30. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/_utils.py +0 -0
  31. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/db.py +0 -0
  32. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/local.py +0 -0
  33. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/rag.py +0 -0
  34. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/rag_watcher_daemon.py +0 -0
  35. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/remote.py +0 -0
  36. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/builtins/spider.py +0 -0
  37. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/client.py +0 -0
  38. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/executor.py +0 -0
  39. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/generator.py +0 -0
  40. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/manager.py +0 -0
  41. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/master.py +0 -0
  42. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/remote.py +0 -0
  43. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/server.py +0 -0
  44. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/agent/workflow.py +0 -0
  45. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/breakthrough/update.py +0 -0
  46. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/command/__init__.py +0 -0
  47. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/command/executor.py +0 -0
  48. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/command/registry.py +0 -0
  49. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/command/security.py +0 -0
  50. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/conf/config.py +0 -0
  51. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/conf/wizard.py +0 -0
  52. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/chat.py +0 -0
  53. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/core.py +0 -0
  54. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/intent.py +0 -0
  55. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/recommender.py +0 -0
  56. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/stream.py +0 -0
  57. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/sysmon.py +0 -0
  58. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/core/thinking.py +0 -0
  59. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/gatekeeper/__init__.py +0 -0
  60. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/gatekeeper/daemon.py +0 -0
  61. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/gatekeeper/manager.py +0 -0
  62. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/main.py +0 -0
  63. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/memory/context.py +0 -0
  64. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/memory/history.py +0 -0
  65. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/memory/session.py +0 -0
  66. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/repl/__init__.py +0 -0
  67. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/repl/commands.py +0 -0
  68. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/security/security.py +0 -0
  69. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/ui/ui.py +0 -0
  70. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/cron.py +0 -0
  71. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/dataframe.py +0 -0
  72. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/disk.py +0 -0
  73. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/fs.py +0 -0
  74. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/launcher.py +0 -0
  75. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/loader.py +0 -0
  76. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/mail.py +0 -0
  77. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/mcp.py +0 -0
  78. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/vision.py +0 -0
  79. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli/weapon/web.py +0 -0
  80. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli.egg-info/dependency_links.txt +0 -0
  81. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli.egg-info/entry_points.txt +0 -0
  82. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli.egg-info/requires.txt +0 -0
  83. {fr_cli-2.2.7 → fr_cli-2.2.8}/fr_cli.egg-info/top_level.txt +0 -0
  84. {fr_cli-2.2.7 → fr_cli-2.2.8}/setup.cfg +0 -0
  85. {fr_cli-2.2.7 → fr_cli-2.2.8}/tests/test_integration_real.py +0 -0
  86. {fr_cli-2.2.7 → fr_cli-2.2.8}/tests/test_model_config.py +0 -0
fr_cli-2.2.8/PKG-INFO ADDED
@@ -0,0 +1,304 @@
1
+ Metadata-Version: 2.4
2
+ Name: fr-cli
3
+ Version: 2.2.8
4
+ Summary: 凡人打字机 - 支持多模型(Zhipu/DeepSeek/Kimi/Qwen/StepFun/MiniMax/Spark/Doubao/MiMo)的终极全能终端工具
5
+ Author: FANREN CLI Author
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/yourname/fr-cli
8
+ Project-URL: Issues, https://github.com/yourname/fr-cli/issues
9
+ Keywords: zhipuai,deepseek,kimi,qwen,cli,ai,terminal,chatbot
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Utilities
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: zhipuai>=2.0.0
27
+ Requires-Dist: openai>=1.0.0
28
+ Requires-Dist: requests>=2.28.0
29
+ Requires-Dist: mcp>=1.6.0
30
+ Provides-Extra: data
31
+ Requires-Dist: pandas>=1.5.0; extra == "data"
32
+ Requires-Dist: openpyxl>=3.0.0; extra == "data"
33
+ Provides-Extra: db
34
+ Requires-Dist: pymysql>=1.0.0; extra == "db"
35
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == "db"
36
+ Requires-Dist: pyodbc>=4.0.0; extra == "db"
37
+ Requires-Dist: oracledb>=1.3.0; extra == "db"
38
+ Provides-Extra: rag
39
+ Requires-Dist: chromadb>=0.4.0; extra == "rag"
40
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "rag"
41
+ Provides-Extra: remote
42
+ Requires-Dist: paramiko>=3.0.0; extra == "remote"
43
+ Provides-Extra: spider
44
+ Requires-Dist: selenium>=4.10.0; extra == "spider"
45
+ Provides-Extra: cloud
46
+ Requires-Dist: bypy; extra == "cloud"
47
+ Requires-Dist: aligo; extra == "cloud"
48
+ Requires-Dist: msal; extra == "cloud"
49
+ Provides-Extra: monitor
50
+ Requires-Dist: watchdog>=3.0.0; extra == "monitor"
51
+ Provides-Extra: all
52
+ Requires-Dist: pandas>=1.5.0; extra == "all"
53
+ Requires-Dist: openpyxl>=3.0.0; extra == "all"
54
+ Requires-Dist: pymysql>=1.0.0; extra == "all"
55
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == "all"
56
+ Requires-Dist: pyodbc>=4.0.0; extra == "all"
57
+ Requires-Dist: oracledb>=1.3.0; extra == "all"
58
+ Requires-Dist: chromadb>=0.4.0; extra == "all"
59
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "all"
60
+ Requires-Dist: paramiko>=3.0.0; extra == "all"
61
+ Requires-Dist: selenium>=4.10.0; extra == "all"
62
+ Requires-Dist: bypy; extra == "all"
63
+ Requires-Dist: aligo; extra == "all"
64
+ Requires-Dist: msal; extra == "all"
65
+ Requires-Dist: watchdog>=3.0.0; extra == "all"
66
+ Provides-Extra: dev
67
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
68
+ Requires-Dist: build; extra == "dev"
69
+ Requires-Dist: twine; extra == "dev"
70
+ Dynamic: license-file
71
+
72
+ # 凡人打字机 (fr-cli)
73
+
74
+ **支持 27+ 种 AI 模型(智谱/智谱Coding/DeepSeek/Kimi/Kimi K2/Kimi Code/StepFun/Step-3/MiniMax/M2.7/讯飞星火/豆包/MiMo/LongCat)的终极全能终端工具。**
75
+
76
+ ## ✨ 功能特性
77
+
78
+ ### 🤖 多模型支持
79
+ 支持以下 AI 模型提供商:
80
+ - **智谱 AI**: GLM-4-Flash 等
81
+ - **智谱 Coding Plan**: GLM-4.7 等 (https://docs.bigmodel.cn/cn/coding-plan/quick-start)
82
+ - **DeepSeek**: DeepSeek-Chat 等
83
+ - **Kimi (Moonshot)**: moonshot-v1-8k 等
84
+ - **Kimi K2**: 代码优化版 kimi-k2-0905-preview
85
+ - **Kimi Code**: 代码平台 kimi-cache-test (Kimi 会员)
86
+ - **通义千问 (Qwen)**: qwen-turbo 等
87
+ - **阶跃星辰 (StepFun)**: step-1-8k, step-2-16k, step-3-auto 等
88
+ - **Step-Audio**: 实时语音交互
89
+ - **MiniMax**: MiniMax-Text-01 等
90
+ - **MiniMax M2.7**: Token Plan 订阅模型
91
+ - **讯飞星火 (Spark)**: generalv3.5 等
92
+ - **豆包 (Doubao)**: doubao-1-5-pro-32k 等
93
+ - **小米 MiMo**: mimo-v2-flash 等
94
+ - **LongCat (龙猫)**: LongCat-Flash-Chat 等 (https://longcat.chat/platform/docs/zh/)
95
+
96
+ ### 🧠 核心功能
97
+ - **MasterAgent 主控**:自我进化的 ReAct 主控 Agent,自动规划、调用工具、反思进化
98
+ - **Agent2Agent Protocol (A2A)**:Agent 互操作协议,支持 Agent 发现、注册、任务委托
99
+ - **思维模式**:direct / CoT / ToT / ReAct 四种推理模式切换
100
+ - **文件沙盒**:安全的虚拟文件系统,支持读写/目录操作
101
+ - **联网搜索**:内置 Web 搜索与网页内容提取(SSRF 防护)
102
+
103
+ ### 🎯 特色功能
104
+ - **视觉能力**:图片生成 (CogView) 与多模态识别 (GLM-4V)
105
+ - **邮件收发**:支持 IMAP/SMTP(防头注入)
106
+ - **定时任务**:后台定时执行命令(shlex 安全解析)
107
+ - **云盘集成**:百度/阿里/OneDrive 网盘
108
+ - **插件系统**:AI 生成代码自动保存为插件(子进程隔离)
109
+ - **会话记忆**:自动保留最近 5 轮对话摘要 + 按日期自动存档
110
+ - **Agent 分身系统**:AI 自动生成 Agent,支持工作流编排
111
+ - **Agent HTTP API**:将 Agent 发布为 REST API 供外部调用
112
+ - **本机应用启动**:一键调用浏览器、微信、Word、WPS 等本地程序
113
+ - **内置 Agent**:`@local` `@remote` `@spider` `@db` `@RAG`
114
+ - **数据卷轴**:Excel / CSV 读取与智能分析
115
+ - **数据库助手**:MySQL / PostgreSQL / SQL Server / Oracle 智能 SQL 生成
116
+ - **本地 RAG**:ChromaDB 向量库 + 自动文件监控与向量化
117
+ - **MCP 外部神通**:支持 Model Context Protocol
118
+ - **多源信息融合**:大模型 + 工具结果统一汇总
119
+ - **中英文切换**:完整国际化支持
120
+
121
+ ## 🚀 快速开始
122
+
123
+ ```bash
124
+ # 安装
125
+ pip install fr-cli
126
+
127
+ # 启动
128
+ fr-cli
129
+
130
+ # 或从源码运行
131
+ cd fr-cli
132
+ pip install -e .
133
+ python3 main.py
134
+ ```
135
+
136
+ 首次运行会引导输入当前道统的 API Key。
137
+
138
+ ## 📝 使用方法
139
+
140
+ ### 📋 常用命令
141
+
142
+ ```
143
+ /ls 列出当前目录文件
144
+ /cat <file> 查看文件内容
145
+ /cd <dir> 切换工作目录
146
+ /write <file> 写入文件(多行输入,Ctrl+D 结束)
147
+ /delete <file> 删除文件
148
+ /search <query> 联网搜索
149
+ /save <name> 保存会话
150
+ /load 加载历史会话
151
+ /export 导出会话为 Markdown
152
+
153
+ /model <模型名> 切换AI模型
154
+ /model <道统>:<模型名> 同时切换道统和模型
155
+ /key <key> 修改当前道统 API Key
156
+ /key <道统> <key> 为指定道统设置 Key
157
+ /providers 查看所有道统配置
158
+ /providers add <p> <k> [m] 添加/更新道统配置
159
+ /providers use <p> 切换到指定道统
160
+
161
+ /mode direct|cot|tot|react 切换思维模式
162
+ /master on|off|status MasterAgent 主控
163
+ /mcp_list 列出 MCP 服务器及工具
164
+ /mcp_add <名> <命令> [参数] 添加 MCP 服务器
165
+ /mcp_del <名> 删除 MCP 服务器
166
+
167
+ /help 查看帮助
168
+ /exit 退出
169
+ ```
170
+
171
+ ### 🤖 AI 模型切换示例
172
+
173
+ ```
174
+ # 使用 Kimi K2(代码优化版)
175
+ /model kimi-k2
176
+
177
+ # 使用 MiniMax M2.7(Token Plan)
178
+ /model minimax-m27
179
+
180
+ # 使用 Step-3(阶跃星辰)
181
+ /model step-3
182
+
183
+ # 使用 Kimi Code
184
+ /model kimi-code
185
+
186
+ # 配置新的 API Key
187
+ /providers add step-3 <your-api-key>
188
+ ```
189
+
190
+ ### 🔧 Agent 管理
191
+
192
+ ```
193
+ /agent_create coder "编写Python代码的助手" # 创建 Agent
194
+ /agent_list # 列出所有 Agent
195
+ /agent_show myagent # 查看 Agent 详情
196
+ /agent_edit myagent persona # 编辑 Agent 人设
197
+ /agent_run myagent "帮我写个排序算法" # 运行 Agent
198
+ /agent_delete oldagent # 删除 Agent
199
+ /agent_server start 8080 # 启动 HTTP API
200
+ ```
201
+
202
+ ### 🔗 MCP 外部神通
203
+
204
+ ```
205
+ /mcp_list # 列出已配置的 MCP 服务器
206
+ /mcp_add fs npx -y @modelcontextprotocol/server-filesystem /tmp
207
+ /mcp_del fs # 删除 MCP 服务器
208
+ /mcp_refresh # 刷新工具列表
209
+ ```
210
+
211
+ ### 📊 数据处理
212
+
213
+ ```
214
+ /read_excel report.xlsx # 读取 Excel
215
+ /read_csv data.csv # 读取 CSV
216
+ ```
217
+
218
+ ### 🧑‍💻 内置 Agent
219
+
220
+ ```
221
+ @local 查看当前目录最大的5个文件 # 本地系统操作
222
+ @spider https://example.com 2 # 智能爬虫
223
+ @db mydb 查询最近7天注册用户 # 数据库助手
224
+ @RAG 什么是向量数据库 # 本地知识库问答
225
+ ```
226
+
227
+ ### 🛡️ 安全命令
228
+
229
+ ```
230
+ /limit <n> 设置 Token 上限 (最小1000)
231
+ /dir <path> 添加允许访问的目录
232
+ /dirs 列出已挂载的工作目录
233
+ /rmdir <索引> 删除已挂载的目录
234
+ /security 查看安全设置
235
+ ```
236
+
237
+ ## 📦 支持的模型提供商(25+)
238
+
239
+ | 道统 | 默认模型 | API 地址 |
240
+ |------|---------|----------|
241
+ | zhipu | glm-4-flash | - |
242
+ | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 |
243
+ | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic |
244
+ | deepseek | deepseek-chat | api.deepseek.com |
245
+ | kimi | moonshot-v1-8k | api.moonshot.cn |
246
+ | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn |
247
+ | kimi-code | kimi-cache-test | api.kimi.com/coding/v1 |
248
+ | qwen | qwen-turbo | dashscope.aliyuncs.com |
249
+ | stepfun | step-1-8k | api.stepfun.com |
250
+ | step-1 | step-1-8k | api.stepfun.com |
251
+ | step-2 | step-2-16k | api.stepfun.com |
252
+ | step-3 | step-3-auto | api.stepfun.com |
253
+ | step-audio | step-audio-2 | api.stepfun.com |
254
+ | minimax | MiniMax-Text-01 | api.minimax.chat |
255
+ | minimax-m27 | MiniMax-M2.7 | api.minimax.chat |
256
+ | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat |
257
+ | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat |
258
+ | spark | generalv3.5 | spark-api-open.xf-yun.com |
259
+ | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com |
260
+ | mimo | mimo-v2-flash | api.xiaomimimo.com |
261
+ | longcat | LongCat-Flash-Chat | api.longcat.chat/openai |
262
+ | longcat-anthropic | LongCat | api.longcat.chat/anthropic |
263
+
264
+ ## 🔧 开发
265
+
266
+ ```bash
267
+ # 克隆项目
268
+ git clone https://github.com/yourname/fr-cli.git
269
+ cd fr-cli
270
+
271
+ # 安装开发依赖
272
+ pip install -e ".[all]"
273
+
274
+ # 运行测试
275
+ python3 -m pytest tests/ -v
276
+
277
+ # 运行程序
278
+ python3 main.py
279
+ ```
280
+
281
+ ## 📂 项目结构
282
+
283
+ ```
284
+ fr_cli/
285
+ ├── main.py # 核心入口
286
+ ├── agent/ # Agent 系统
287
+ │ ├── a2a.py # Agent2Agent 协议
288
+ │ ├── master.py # MasterAgent 主控
289
+ │ └── ...
290
+ ├── core/ # 核心模块
291
+ │ └── llm.py # LLM 客户端(20+ 提供商)
292
+ ├── weapon/ # 武器库
293
+ ├── memory/ # 记忆系统
294
+ └── lang/ # 国际化
295
+ ```
296
+
297
+ ## 📚 文档
298
+
299
+ - [NEW_PROVIDERS_GUIDE.md](NEW_PROVIDERS_GUIDE.md) - 新增模型使用指南
300
+ - [A2A_AND_PROVIDERS_GUIDE.md](A2A_AND_PROVIDERS_GUIDE.md) - A2A 协议文档
301
+
302
+ ## 📄 License
303
+
304
+ MIT
fr_cli-2.2.8/README.md ADDED
@@ -0,0 +1,233 @@
1
+ # 凡人打字机 (fr-cli)
2
+
3
+ **支持 27+ 种 AI 模型(智谱/智谱Coding/DeepSeek/Kimi/Kimi K2/Kimi Code/StepFun/Step-3/MiniMax/M2.7/讯飞星火/豆包/MiMo/LongCat)的终极全能终端工具。**
4
+
5
+ ## ✨ 功能特性
6
+
7
+ ### 🤖 多模型支持
8
+ 支持以下 AI 模型提供商:
9
+ - **智谱 AI**: GLM-4-Flash 等
10
+ - **智谱 Coding Plan**: GLM-4.7 等 (https://docs.bigmodel.cn/cn/coding-plan/quick-start)
11
+ - **DeepSeek**: DeepSeek-Chat 等
12
+ - **Kimi (Moonshot)**: moonshot-v1-8k 等
13
+ - **Kimi K2**: 代码优化版 kimi-k2-0905-preview
14
+ - **Kimi Code**: 代码平台 kimi-cache-test (Kimi 会员)
15
+ - **通义千问 (Qwen)**: qwen-turbo 等
16
+ - **阶跃星辰 (StepFun)**: step-1-8k, step-2-16k, step-3-auto 等
17
+ - **Step-Audio**: 实时语音交互
18
+ - **MiniMax**: MiniMax-Text-01 等
19
+ - **MiniMax M2.7**: Token Plan 订阅模型
20
+ - **讯飞星火 (Spark)**: generalv3.5 等
21
+ - **豆包 (Doubao)**: doubao-1-5-pro-32k 等
22
+ - **小米 MiMo**: mimo-v2-flash 等
23
+ - **LongCat (龙猫)**: LongCat-Flash-Chat 等 (https://longcat.chat/platform/docs/zh/)
24
+
25
+ ### 🧠 核心功能
26
+ - **MasterAgent 主控**:自我进化的 ReAct 主控 Agent,自动规划、调用工具、反思进化
27
+ - **Agent2Agent Protocol (A2A)**:Agent 互操作协议,支持 Agent 发现、注册、任务委托
28
+ - **思维模式**:direct / CoT / ToT / ReAct 四种推理模式切换
29
+ - **文件沙盒**:安全的虚拟文件系统,支持读写/目录操作
30
+ - **联网搜索**:内置 Web 搜索与网页内容提取(SSRF 防护)
31
+
32
+ ### 🎯 特色功能
33
+ - **视觉能力**:图片生成 (CogView) 与多模态识别 (GLM-4V)
34
+ - **邮件收发**:支持 IMAP/SMTP(防头注入)
35
+ - **定时任务**:后台定时执行命令(shlex 安全解析)
36
+ - **云盘集成**:百度/阿里/OneDrive 网盘
37
+ - **插件系统**:AI 生成代码自动保存为插件(子进程隔离)
38
+ - **会话记忆**:自动保留最近 5 轮对话摘要 + 按日期自动存档
39
+ - **Agent 分身系统**:AI 自动生成 Agent,支持工作流编排
40
+ - **Agent HTTP API**:将 Agent 发布为 REST API 供外部调用
41
+ - **本机应用启动**:一键调用浏览器、微信、Word、WPS 等本地程序
42
+ - **内置 Agent**:`@local` `@remote` `@spider` `@db` `@RAG`
43
+ - **数据卷轴**:Excel / CSV 读取与智能分析
44
+ - **数据库助手**:MySQL / PostgreSQL / SQL Server / Oracle 智能 SQL 生成
45
+ - **本地 RAG**:ChromaDB 向量库 + 自动文件监控与向量化
46
+ - **MCP 外部神通**:支持 Model Context Protocol
47
+ - **多源信息融合**:大模型 + 工具结果统一汇总
48
+ - **中英文切换**:完整国际化支持
49
+
50
+ ## 🚀 快速开始
51
+
52
+ ```bash
53
+ # 安装
54
+ pip install fr-cli
55
+
56
+ # 启动
57
+ fr-cli
58
+
59
+ # 或从源码运行
60
+ cd fr-cli
61
+ pip install -e .
62
+ python3 main.py
63
+ ```
64
+
65
+ 首次运行会引导输入当前道统的 API Key。
66
+
67
+ ## 📝 使用方法
68
+
69
+ ### 📋 常用命令
70
+
71
+ ```
72
+ /ls 列出当前目录文件
73
+ /cat <file> 查看文件内容
74
+ /cd <dir> 切换工作目录
75
+ /write <file> 写入文件(多行输入,Ctrl+D 结束)
76
+ /delete <file> 删除文件
77
+ /search <query> 联网搜索
78
+ /save <name> 保存会话
79
+ /load 加载历史会话
80
+ /export 导出会话为 Markdown
81
+
82
+ /model <模型名> 切换AI模型
83
+ /model <道统>:<模型名> 同时切换道统和模型
84
+ /key <key> 修改当前道统 API Key
85
+ /key <道统> <key> 为指定道统设置 Key
86
+ /providers 查看所有道统配置
87
+ /providers add <p> <k> [m] 添加/更新道统配置
88
+ /providers use <p> 切换到指定道统
89
+
90
+ /mode direct|cot|tot|react 切换思维模式
91
+ /master on|off|status MasterAgent 主控
92
+ /mcp_list 列出 MCP 服务器及工具
93
+ /mcp_add <名> <命令> [参数] 添加 MCP 服务器
94
+ /mcp_del <名> 删除 MCP 服务器
95
+
96
+ /help 查看帮助
97
+ /exit 退出
98
+ ```
99
+
100
+ ### 🤖 AI 模型切换示例
101
+
102
+ ```
103
+ # 使用 Kimi K2(代码优化版)
104
+ /model kimi-k2
105
+
106
+ # 使用 MiniMax M2.7(Token Plan)
107
+ /model minimax-m27
108
+
109
+ # 使用 Step-3(阶跃星辰)
110
+ /model step-3
111
+
112
+ # 使用 Kimi Code
113
+ /model kimi-code
114
+
115
+ # 配置新的 API Key
116
+ /providers add step-3 <your-api-key>
117
+ ```
118
+
119
+ ### 🔧 Agent 管理
120
+
121
+ ```
122
+ /agent_create coder "编写Python代码的助手" # 创建 Agent
123
+ /agent_list # 列出所有 Agent
124
+ /agent_show myagent # 查看 Agent 详情
125
+ /agent_edit myagent persona # 编辑 Agent 人设
126
+ /agent_run myagent "帮我写个排序算法" # 运行 Agent
127
+ /agent_delete oldagent # 删除 Agent
128
+ /agent_server start 8080 # 启动 HTTP API
129
+ ```
130
+
131
+ ### 🔗 MCP 外部神通
132
+
133
+ ```
134
+ /mcp_list # 列出已配置的 MCP 服务器
135
+ /mcp_add fs npx -y @modelcontextprotocol/server-filesystem /tmp
136
+ /mcp_del fs # 删除 MCP 服务器
137
+ /mcp_refresh # 刷新工具列表
138
+ ```
139
+
140
+ ### 📊 数据处理
141
+
142
+ ```
143
+ /read_excel report.xlsx # 读取 Excel
144
+ /read_csv data.csv # 读取 CSV
145
+ ```
146
+
147
+ ### 🧑‍💻 内置 Agent
148
+
149
+ ```
150
+ @local 查看当前目录最大的5个文件 # 本地系统操作
151
+ @spider https://example.com 2 # 智能爬虫
152
+ @db mydb 查询最近7天注册用户 # 数据库助手
153
+ @RAG 什么是向量数据库 # 本地知识库问答
154
+ ```
155
+
156
+ ### 🛡️ 安全命令
157
+
158
+ ```
159
+ /limit <n> 设置 Token 上限 (最小1000)
160
+ /dir <path> 添加允许访问的目录
161
+ /dirs 列出已挂载的工作目录
162
+ /rmdir <索引> 删除已挂载的目录
163
+ /security 查看安全设置
164
+ ```
165
+
166
+ ## 📦 支持的模型提供商(25+)
167
+
168
+ | 道统 | 默认模型 | API 地址 |
169
+ |------|---------|----------|
170
+ | zhipu | glm-4-flash | - |
171
+ | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 |
172
+ | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic |
173
+ | deepseek | deepseek-chat | api.deepseek.com |
174
+ | kimi | moonshot-v1-8k | api.moonshot.cn |
175
+ | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn |
176
+ | kimi-code | kimi-cache-test | api.kimi.com/coding/v1 |
177
+ | qwen | qwen-turbo | dashscope.aliyuncs.com |
178
+ | stepfun | step-1-8k | api.stepfun.com |
179
+ | step-1 | step-1-8k | api.stepfun.com |
180
+ | step-2 | step-2-16k | api.stepfun.com |
181
+ | step-3 | step-3-auto | api.stepfun.com |
182
+ | step-audio | step-audio-2 | api.stepfun.com |
183
+ | minimax | MiniMax-Text-01 | api.minimax.chat |
184
+ | minimax-m27 | MiniMax-M2.7 | api.minimax.chat |
185
+ | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat |
186
+ | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat |
187
+ | spark | generalv3.5 | spark-api-open.xf-yun.com |
188
+ | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com |
189
+ | mimo | mimo-v2-flash | api.xiaomimimo.com |
190
+ | longcat | LongCat-Flash-Chat | api.longcat.chat/openai |
191
+ | longcat-anthropic | LongCat | api.longcat.chat/anthropic |
192
+
193
+ ## 🔧 开发
194
+
195
+ ```bash
196
+ # 克隆项目
197
+ git clone https://github.com/yourname/fr-cli.git
198
+ cd fr-cli
199
+
200
+ # 安装开发依赖
201
+ pip install -e ".[all]"
202
+
203
+ # 运行测试
204
+ python3 -m pytest tests/ -v
205
+
206
+ # 运行程序
207
+ python3 main.py
208
+ ```
209
+
210
+ ## 📂 项目结构
211
+
212
+ ```
213
+ fr_cli/
214
+ ├── main.py # 核心入口
215
+ ├── agent/ # Agent 系统
216
+ │ ├── a2a.py # Agent2Agent 协议
217
+ │ ├── master.py # MasterAgent 主控
218
+ │ └── ...
219
+ ├── core/ # 核心模块
220
+ │ └── llm.py # LLM 客户端(20+ 提供商)
221
+ ├── weapon/ # 武器库
222
+ ├── memory/ # 记忆系统
223
+ └── lang/ # 国际化
224
+ ```
225
+
226
+ ## 📚 文档
227
+
228
+ - [NEW_PROVIDERS_GUIDE.md](NEW_PROVIDERS_GUIDE.md) - 新增模型使用指南
229
+ - [A2A_AND_PROVIDERS_GUIDE.md](A2A_AND_PROVIDERS_GUIDE.md) - A2A 协议文档
230
+
231
+ ## 📄 License
232
+
233
+ MIT
@@ -184,3 +184,80 @@
184
184
  >>> 用 MCP 工具读取 /tmp/hello.txt
185
185
  🧙 仙人 【调用:mcp_call({"server": "fs", "tool": "read_file", "arguments": {"path": "/tmp/hello.txt"}})】
186
186
  ```
187
+
188
+ ---
189
+
190
+ ## a2a_protocol
191
+ - **名称**: Agent2Agent Protocol (A2A) - Agent 互操作协议
192
+ - **功能**: 支持 Agent 之间的互操作,实现 Agent 发现、注册、能力匹配、任务委托和结果返回
193
+ - **程序路径**: fr_cli/agent/a2a.py
194
+ - **调用方式**:
195
+ - AI 调用: `agent_call({"name": "Agent名", "user_input": "任务描述"})`
196
+ - 发现: `discover_all_agents()` 获取所有可用 Agent
197
+ - 注册: `AgentRegistry.register(agent_info)`
198
+ - **触发关键词**: agent, agent_call, A2A, agent互操作, 委托任务, 多agent协作
199
+
200
+ 核心组件:
201
+ - AgentRegistry: Agent 注册表(单例模式),管理所有 Agent 的注册与发现
202
+ - AgentInfo: Agent 信息,包含名称、类型、描述、能力列表、端点等
203
+ - A2AClient: A2A 客户端,用于调用其他 Agent
204
+ - A2AServer: A2A 服务器,提供 HTTP 接口供远程调用
205
+ - TaskRequest/TaskResult: 任务请求和结果数据结构
206
+
207
+ 使用示例:
208
+ ```
209
+ # MasterAgent 可自动发现并调用其他 Agent
210
+ >>> 帮我调用 code-agent 生成一个快速排序算法
211
+ 🧙 仙人 【调用:agent_call({"name": "code-agent", "user_input": "生成快速排序算法"})】
212
+ ```
213
+
214
+ Agent 能力类型:
215
+ - code_generation: 代码生成
216
+ - code_review: 代码审查
217
+ - data_analysis: 数据分析
218
+ - web_search: 网络搜索
219
+ - file_operation: 文件操作
220
+ - database: 数据库操作
221
+ - image_processing: 图像处理
222
+ - text_generation: 文本生成
223
+ - translation: 翻译
224
+ - general: 通用能力
225
+
226
+ ---
227
+
228
+ ## provider_management
229
+ - **名称**: 模型提供商管理
230
+ - **功能**: 管理多个 AI 模型提供商(道统),支持配置、切换、查看
231
+ - **程序路径**: fr_cli/core/llm.py, fr_cli/repl/commands.py
232
+ - **调用方式**:
233
+ - `/providers` - 查看所有道统配置
234
+ - `/providers add <provider> <key> [model]` - 添加/更新道统
235
+ - `/providers use <provider>` - 切换到指定道统
236
+ - `/model <provider>:<model>` - 切换道统和模型
237
+ - **触发关键词**: 道统, provider, 提供商, 配置模型
238
+
239
+ 支持的模型提供商(25+):
240
+ - 智谱: zhipu (glm-4-flash)
241
+ - 智谱 Coding Plan: zhipu-coding (GLM-4.7)
242
+ - 智谱 Anthropic: zhipu-anthropic (glm-4.6)
243
+ - DeepSeek: deepseek (deepseek-chat)
244
+ - Kimi: kimi (moonshot-v1-8k)
245
+ - Kimi K2: kimi-k2 (kimi-k2-0905-preview) - 代码优化版
246
+ - Kimi Code: kimi-code (kimi-cache-test) - 代码平台
247
+ - 通义千问: qwen (qwen-turbo)
248
+ - 阶跃星辰: stepfun (step-1-8k), step-1, step-2, step-3, step-audio
249
+ - MiniMax: minimax (MiniMax-Text-01)
250
+ - MiniMax M2.7: minimax-m27, minimax-m27-fast, minimax-token-plan
251
+ - 讯飞星火: spark (generalv3.5)
252
+ - 豆包: doubao (doubao-1-5-pro-32k-250115)
253
+ - 小米: mimo (mimo-v2-flash)
254
+ - LongCat (龙猫): longcat (LongCat-Flash-Chat)
255
+ - LongCat Anthropic: longcat-anthropic (LongCat)
256
+
257
+ 使用示例:
258
+ ```
259
+ /providers add zhipu-coding <your-coding-plan-key>
260
+ /providers add longcat <your-longcat-api-key>
261
+ /providers use kimi-k2
262
+ /model step-3
263
+ ```