fr-cli 2.1.0__py3-none-any.whl

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 (64) hide show
  1. fr_cli/README.md +148 -0
  2. fr_cli/WEAPON.MD +186 -0
  3. fr_cli/__init__.py +4 -0
  4. fr_cli/addon/plugin.py +69 -0
  5. fr_cli/agent/__init__.py +9 -0
  6. fr_cli/agent/builtins/__init__.py +4 -0
  7. fr_cli/agent/builtins/_utils.py +48 -0
  8. fr_cli/agent/builtins/db.py +269 -0
  9. fr_cli/agent/builtins/local.py +105 -0
  10. fr_cli/agent/builtins/rag.py +652 -0
  11. fr_cli/agent/builtins/rag_watcher_daemon.py +156 -0
  12. fr_cli/agent/builtins/remote.py +214 -0
  13. fr_cli/agent/builtins/spider.py +247 -0
  14. fr_cli/agent/client.py +164 -0
  15. fr_cli/agent/executor.py +86 -0
  16. fr_cli/agent/generator.py +104 -0
  17. fr_cli/agent/manager.py +193 -0
  18. fr_cli/agent/master.py +604 -0
  19. fr_cli/agent/master_prompt.py +118 -0
  20. fr_cli/agent/remote.py +70 -0
  21. fr_cli/agent/server.py +279 -0
  22. fr_cli/agent/workflow.py +164 -0
  23. fr_cli/breakthrough/update.py +154 -0
  24. fr_cli/command/__init__.py +4 -0
  25. fr_cli/command/executor.py +276 -0
  26. fr_cli/command/registry.py +1034 -0
  27. fr_cli/command/security.py +30 -0
  28. fr_cli/conf/config.py +126 -0
  29. fr_cli/conf/wizard.py +172 -0
  30. fr_cli/core/chat.py +280 -0
  31. fr_cli/core/core.py +111 -0
  32. fr_cli/core/intent.py +129 -0
  33. fr_cli/core/recommender.py +71 -0
  34. fr_cli/core/stream.py +83 -0
  35. fr_cli/core/sysmon.py +117 -0
  36. fr_cli/core/thinking.py +215 -0
  37. fr_cli/gatekeeper/__init__.py +7 -0
  38. fr_cli/gatekeeper/daemon.py +216 -0
  39. fr_cli/gatekeeper/manager.py +218 -0
  40. fr_cli/lang/i18n.py +827 -0
  41. fr_cli/main.py +329 -0
  42. fr_cli/memory/context.py +119 -0
  43. fr_cli/memory/history.py +96 -0
  44. fr_cli/memory/session.py +134 -0
  45. fr_cli/repl/__init__.py +0 -0
  46. fr_cli/repl/commands.py +1098 -0
  47. fr_cli/security/security.py +46 -0
  48. fr_cli/ui/ui.py +116 -0
  49. fr_cli/weapon/cron.py +217 -0
  50. fr_cli/weapon/dataframe.py +97 -0
  51. fr_cli/weapon/disk.py +141 -0
  52. fr_cli/weapon/fs.py +206 -0
  53. fr_cli/weapon/launcher.py +249 -0
  54. fr_cli/weapon/loader.py +98 -0
  55. fr_cli/weapon/mail.py +227 -0
  56. fr_cli/weapon/mcp.py +204 -0
  57. fr_cli/weapon/vision.py +74 -0
  58. fr_cli/weapon/web.py +88 -0
  59. fr_cli-2.1.0.dist-info/METADATA +227 -0
  60. fr_cli-2.1.0.dist-info/RECORD +64 -0
  61. fr_cli-2.1.0.dist-info/WHEEL +5 -0
  62. fr_cli-2.1.0.dist-info/entry_points.txt +2 -0
  63. fr_cli-2.1.0.dist-info/licenses/LICENSE +21 -0
  64. fr_cli-2.1.0.dist-info/top_level.txt +1 -0
fr_cli/lang/i18n.py ADDED
@@ -0,0 +1,827 @@
1
+ """
2
+ 国际化文本引擎
3
+ """
4
+
5
+ I18N = {
6
+ "zh": {
7
+ "sys_prompt": """你是一个智能AI助手,可以帮助用户解答问题、编写代码、分析文件等。\n直接回答用户的问题。只有当系统提示中提供了可用工具时,才按以下规则调用:\n\n1. 内置工具(文件/搜索/画图/邮件/定时任务/云盘/会话/配置)使用【调用:tool_name({\"参数\": \"值\"})】格式,参数为标准 JSON。常用示例:\n - 写文件: 【调用:write_file({\"path\": \"file.md\", \"content\": \"# 标题\\n\\n正文\"})】\n - 读文件: 【调用:read_file({\"path\": \"file.md\"})】\n - 列出文件: 【调用:list_files({})】\n - 搜索: 【调用:search_web({\"query\": \"搜索词\"})】\n - 画图: 【调用:generate_image({\"prompt\": \"描述\"})】\n - 保存会话: 【调用:save_session({'name': '会话名'})】
8
+
9
+ 特别说明:当用户询问本程序的功能说明、使用帮助,或要求发送/分享本程序的说明文档时,请优先使用 read_file 读取当前工作空间中的 MANUAL.md 文件获取完整说明,而不是进行网络搜索。
10
+
11
+ 2. 自定义插件(skills)使用【命令:/插件名 参数】格式。\n\n如果系统提示中没有提供工具列表,直接回答即可,不要包含任何【调用:...】或【命令:...】标记。\n\n当用户明确要求创建插件/工具时,请生成包含 def run(args='') 的 Python 代码,并放在 ```python 代码块中。""",
12
+ "prompt_user": "🧑 凡人", "prompt_ai": "🧙 仙人", "prompt_skill": "⚔️",
13
+
14
+ "banner_title": [" 凡 人 打 字 机 ", "──────────────────────────────────", " 【 修 仙 者 的 编 码 引 擎 】 "],
15
+ "bye_title": ["欢 迎 下 次", "继 续 修 仙"], "bye_msg": "道友,保重。👋",
16
+ "status_model": "🔮 模型", "status_limit": "🛡️ 上限", "status_dir": "📂 洞府", "status_sess": "⏳ 轮回",
17
+ "no_dir": "未开放洞府", "new_sess": "全新轮回", "cur_dir": "当前",
18
+ "conn_ok": "✅ 天道连通。", "conn_fail": "❌ 天道拒绝:", "err_posix": "❌ 走火入魔:",
19
+ "err_bound": "⚠️ 禁止穿越结界", "err_no_file": "⚠️ 卷轴不存在",
20
+ "ok_dir_add": "✅ 洞府 [{}] 已开辟", "err_dir_no": "❌ 目录不存在", "ok_cd": "✅ 穿梭至: {}",
21
+ "ok_dir_remove": "✅ 洞府 [{}] 已关闭", "err_dir_idx": "❌ 索引无效", "err_dir_not_mounted": "❌ 未挂载的洞府: {}",
22
+ "ok_write": "✅ 卷轴已刻录: {}", "err_write_perm": "❌ 权限不足,无法刻录", "ok_delete": "✅ 卷轴已销毁: {}",
23
+ "ok_model": "✅ 法器更替: {}", "err_model": "❌ 碎裂:", "ok_key": "✅ 重铸。",
24
+ "ok_limit": "✅ 上限: {}", "err_limit": "❌ 最小1000", "ok_forged": "✅ 法宝铸造: /{}",
25
+ "ok_sess_save": "✅ 刻录: [{}]", "ok_sess_load": "✅ 穿梭至: [{}]", "ok_sess_del": "✅ 斩断",
26
+ "ok_undo": "✅ 时光倒流。", "err_undo": "❌ 无法倒流。", "ok_export": "✅ 导出: {}",
27
+ "ok_alias_set": "✅ 烙印: {} = {}", "no_alias": "无烙印。",
28
+ "sec_title": "⚠️ 检测到高危神通,请选择因果:", "sec_opt_y": "[Y]仅此", "sec_opt_a": "[A]本轮", "sec_opt_f": "[F]永世", "sec_opt_n": "[N]拒绝", "sec_denied": "🛑 终止。",
29
+ "sec_read": "读取卷轴", "sec_write": "写入法宝", "sec_exec": "执行法宝", "sec_mount": "开辟洞府", "sec_gen_img": "祭炼画卷", "sec_send_mail": "发送邮件", "sec_fetch_web": "抓取互联网", "sec_upload_disk": "上传至云端", "sec_download_disk": "下载自云端", "sec_shell": "执行系统命令",
30
+ "gen_ing": "🎨 祭炼…", "gen_ok": "✅ 画卷成: {}", "gen_fail": "❌ 破碎: ", "see_warn": "⚠️ 需法器 glm-4v-plus", "see_ing": "👁️ 天眼…",
31
+ "help_title": "📜 修仙指南:", "help_cfg": "【配置】", "help_fs": "【洞府】", "help_sess": "【轮回】", "help_plugin": "【法宝】", "help_extra": "【神通】", "help_shell": "【破壁】",
32
+ "help_usage": "💡 用法: /help [主题] 可用主题: config, fs, session, plugin, mail, cron, web, disk, vision, shell, tools, security, app, agent, builtin, dataframe, gatekeeper, mcp, all",
33
+ "help_not_found": "❌ 未知主题: {} 可用: config, fs, session, plugin, mail, cron, web, disk, vision, shell, tools, security, app, agent, builtin, dataframe, gatekeeper, mcp, all",
34
+ "empty": "空空如也…", "none": "无", "no_sess": "无记忆。", "no_plugins": "无技能。",
35
+ "ctx_dir": "\n[系统:凡人在 {}。]",
36
+ "menu_mail": "【邮差】", "menu_cron": "【结界】", "menu_web": "【游侠】", "menu_disk": "【腾云】",
37
+ "mail_setup": "/mail_setup", "mail_inbox": "/mail_inbox", "mail_read": "/mail_read <ID>", "mail_send": "/mail_send <To> <Sub> <Body>",
38
+ "mail_ok": "✅ 已发送", "mail_err": "❌ 邮件:", "mail_no_cfg": "❌ 未配邮", "mail_sub": "主题: {}", "mail_from": "来自: {}", "mail_date": "时间: {}",
39
+ "cron_add": "/cron_add <秒> <命>", "cron_list": "/cron_list", "cron_del": "/cron_del <ID>",
40
+ "cron_ok": "✅ 布阵 (ID:{}, {}秒)", "cron_killed": "✅ 破阵: {}", "cron_running": "🏃 运行",
41
+ "web_search": "/web <词> 搜索", "web_fetch": "/fetch <URL> 抓取",
42
+ "web_err": "❌ 迷路:", "web_no_res": "无果。", "web_title": "📜 搜魂:",
43
+ "disk_setup": "/disk_setup", "disk_ls": "/disk_ls <盘>", "disk_up": "/disk_up <盘> <路>", "disk_down": "/disk_down <盘> <云> [本]",
44
+ "disk_ok_up": "✅ 飞升: {}", "disk_ok_down": "✅ 降落: {}", "disk_err": "❌ 御剑: ", "disk_no_cfg": "❌ 未配盘", "disk_miss_dep": "❌ 缺库: {} (pip install {})",
45
+ "shell_tip": "!命令 执行本地Shell(如 !ls)",
46
+ "pipe_tip": "!命令 | 提示 管道喂给AI(如 !ps aux | 找出占用CPU最高的进程)",
47
+ "pipe_prefix": "[系统管道数据]:\n",
48
+ "artifact_detect": "⚡ 检测到法宝结构,赐名 (回车放弃): ",
49
+ "recommend_title": "💡 推荐功能:",
50
+ "rec_ls": "列出当前目录文件",
51
+ "rec_cat": "查看文件内容",
52
+ "rec_cd": "切换目录",
53
+ "rec_see": "查看并分析图片",
54
+ "rec_mail_inbox": "查看收件箱",
55
+ "rec_mail_send": "发送邮件",
56
+ "rec_web": "网络搜索",
57
+ "rec_fetch": "获取网页内容",
58
+ "rec_cron_add": "添加定时任务",
59
+ "rec_cron_list": "列出定时任务",
60
+ "rec_disk_ls": "列出云盘文件",
61
+ "rec_disk_up": "上传到云盘",
62
+ "rec_disk_down": "从云盘下载",
63
+ "rec_save": "保存当前会话",
64
+ "rec_load": "加载历史会话",
65
+ "rec_model": "切换AI模型",
66
+ "rec_key": "设置API密钥",
67
+ "rec_lang": "切换语言",
68
+ "rec_skills": "查看可用插件",
69
+ "rec_export": "导出会话为Markdown",
70
+ "rec_exec": "执行系统命令",
71
+ "rec_pipe": "命令输出管道到AI",
72
+ # ---- 详细帮助文本 ----
73
+ "help_detail_config": """📜 【配置】
74
+
75
+ /model <name> 切换AI模型 (glm-4-flash, glm-4-plus, glm-4v-plus)
76
+ /key <key> 修改智谱AI API Key
77
+ /limit <n> 设置Token上限 (最小1000)
78
+ /lang <zh/en> 切换界面语言
79
+ /mode <direct|cot|tot|react> 切换AI思维模式(直接/思维链/思维树/ReAct)
80
+ /alias <k> [v] 查看/设置命令别名
81
+ /dir <path> 添加允许访问的目录到沙盒
82
+ /dirs 列出所有已挂载的工作目录
83
+ /rmdir <索引/路径> 删除指定的工作目录
84
+ /export 导出当前会话为Markdown文件
85
+ /update check 检查更新
86
+ /update run 执行更新并重启
87
+
88
+ 配置文件: ~/.zhipu_cli_config.json
89
+ """,
90
+ "help_detail_fs": """📜 【洞府 - 文件操作】
91
+
92
+ /ls 列出当前目录文件
93
+ /cat <file> 查看文件内容 (支持UTF-8/GBK/Latin-1)
94
+ /cd <dir> 切换工作目录
95
+ /dirs 列出所有已挂载的工作目录
96
+ /rmdir <idx/path> 删除指定的工作目录
97
+ /write <f> <c> 写入/覆盖文件
98
+ /append <f> <c> 追加内容到文件
99
+ /delete <f> 删除文件
100
+
101
+ 使用示例:
102
+ /cd data 切换至 data 目录
103
+ /ls 列出文件
104
+ /cat README.md 查看文件内容
105
+ /write a.md 内容 写入文件
106
+ /append a.md 追加 追加内容
107
+ /delete a.md 删除文件(需安全确认)
108
+
109
+ 安全机制:
110
+ • 限制在 allowed_dirs 目录内, 禁止 ../ 穿越
111
+ • /write 自动创建父目录
112
+ • 危险操作触发四阶安全确认
113
+ """,
114
+ "help_detail_session": """📜 【轮回 - 会话管理】
115
+
116
+ /save <name> 保存当前对话历史
117
+ /load 加载历史会话 (交互式选择)
118
+ /del 删除历史会话 (交互式选择)
119
+ /undo 撤销最近一轮对话
120
+ /export 导出当前会话为Markdown
121
+
122
+ 自动按日期存档:
123
+ /session_list 列出所有按日期自动保存的会话
124
+ /session_load <N> 加载指定编号的会话并继续对话
125
+ /session_del <N> 删除指定编号的自动会话
126
+
127
+ 使用示例:
128
+ /save 项目讨论 保存当前会话
129
+ /load 交互式选择并加载
130
+ /del 交互式选择并删除
131
+ /undo 撤销最近一轮
132
+ /export 导出为 Markdown
133
+ /session_list 查看自动存档列表
134
+ /session_load 1 加载今天的第一个会话继续聊
135
+
136
+ 上下文记忆:
137
+ • 自动保留最近5轮对话摘要
138
+ • 按 session_name 持久化到 ~/.zhipu_cli_context.json
139
+ • 加载会话时自动恢复上下文摘要
140
+ • 每次启动自动创建日期编号会话文件(~/.fr_cli_sessions/)
141
+ """,
142
+ "help_detail_plugin": """📜 【法宝 - 插件系统】
143
+
144
+ /skills 查看已安装插件列表
145
+ /<plugin> [args] 运行指定插件
146
+
147
+ 自动进化:
148
+ • AI回复中包含 def run(args='') 和 ```python 代码块时
149
+ • 程序提示"检测到法宝结构", 输入名称即可保存
150
+
151
+ 插件目录: ~/.zhipu_cli_plugins/
152
+ 插件约定: def run(args='') 返回字符串结果
153
+ 安全: 独立子进程执行, 15秒超时
154
+ """,
155
+ "help_detail_mail": """📜 【邮差 - 邮件功能】
156
+
157
+ 配置方式:
158
+ 1. 获取邮箱授权码(QQ邮箱: 设置→账户→开启IMAP/SMTP)
159
+ 2. /mail_setup 启动配置向导
160
+
161
+ /mail_setup 邮件配置向导
162
+ /mail_inbox 列出收件箱最近10封邮件
163
+ /mail_read <id> 读取指定邮件完整内容
164
+ /mail_send <to> <sub> <body> 发送邮件
165
+
166
+ 使用示例:
167
+ /mail_setup
168
+ /mail_inbox
169
+ /mail_read 1
170
+ /mail_send friend@qq.com 主题 正文
171
+
172
+ 支持邮箱: QQ/163/Gmail/Outlook/阿里云
173
+ 注意: QQ/163 需使用「授权码」而非登录密码
174
+ """,
175
+ "help_detail_cron": """📜 【结界 - 定时任务】
176
+
177
+ /cron_add <秒> <命令> 添加循环定时任务 (Shell命令)
178
+ /cron_list 列出运行中的定时任务
179
+ /cron_del <id> 删除指定任务
180
+
181
+ 使用示例:
182
+ /cron_add 300 ls -la /project 每5分钟列出项目目录
183
+ /cron_add 60 df -h 每分钟检查磁盘
184
+ /cron_list
185
+ /cron_del 1
186
+
187
+ 注意:
188
+ • 基于 threading.Timer, 程序退出后任务消失
189
+ • 如需持久化, 使用 /gatekeeper start 启动守护进程
190
+ • Shell命令执行30秒超时, 输出截断100字符
191
+ • 危险操作触发安全确认
192
+ """,
193
+ "help_detail_web": """📜 【游侠 - 网络搜索】
194
+
195
+ /web <query> 百度搜索 (返回最多5条结果)
196
+ /fetch <url> 抓取网页并提取纯文本 (截断3000字符)
197
+
198
+ 使用示例:
199
+ /web Python asyncio 教程
200
+ /fetch https://docs.python.org/3/library/asyncio.html
201
+
202
+ AI自动调用:
203
+ 【调用:search_web({"query": "搜索词"})】
204
+ 【调用:fetch_web({"url": "https://..."})】
205
+ """,
206
+ "help_detail_disk": """📜 【腾云 - 云盘功能】
207
+
208
+ 当前支持阿里云盘(个人网盘)。
209
+ 首次使用需运行 /disk_setup 完成扫码登录。
210
+
211
+ /disk_setup 启动云盘配置向导(扫码登录)
212
+ /disk_ls 列出当前云盘目录的文件和文件夹
213
+ /disk_cd <目录名> 切换云盘目录(支持 .. 返回上级)
214
+ /disk_up <本地路径> <云端名称> 上传文件到当前目录
215
+ /disk_down <云端名称> [本地路径] 从当前目录下载文件
216
+
217
+ 使用示例:
218
+ /disk_setup 首次扫码登录
219
+ /disk_ls 列出云盘文件
220
+ /disk_cd 文档 进入文档目录
221
+ /disk_up /local/report.pdf report.pdf
222
+ /disk_down report.pdf /local/
223
+
224
+ 依赖: pip install aligo
225
+ """,
226
+ "help_detail_vision": """📜 【天眼 - 图像功能】
227
+
228
+ /see <图片路径> [问题] 用GLM-4V分析图片内容
229
+
230
+ 使用步骤:
231
+ 1. /model glm-4v-plus 切换至视觉模型
232
+ 2. /see photo.jpg 描述这张图片 分析图片
233
+
234
+ AI自动调用:
235
+ 【调用:generate_image({"prompt": "描述"})】
236
+ 图片生成使用 CogView-3-plus, 保存到当前目录
237
+ """,
238
+ "help_detail_shell": """📜 【破壁 - 系统命令】
239
+
240
+ !<cmd> 执行本地Shell命令 (如 !ls -la)
241
+ !<cmd> | <prompt> 将命令输出管道给AI分析
242
+
243
+ 使用示例:
244
+ !ls -la /Users/me/project
245
+ !ps aux | 找出占用CPU最高的进程
246
+ !cat log.txt | 分析这段日志有什么问题
247
+
248
+ 注意:
249
+ • 命令执行15秒超时
250
+ • 触发安全确认 sec_shell
251
+ • 管道模式下AI基于命令输出生成分析
252
+ """,
253
+ "help_detail_tools": """📜 【AI工具调用 - 结构化调用】
254
+
255
+ AI自动输出调用标记, 程序解析并执行:
256
+ 【调用:tool_name({"参数": "值"})】
257
+
258
+ 常用工具:
259
+ write_file {"path", "content"}
260
+ read_file {"path"}
261
+ list_files {}
262
+ search_web {"query"}
263
+ fetch_web {"url"}
264
+ generate_image {"prompt"}
265
+ mail_inbox {}
266
+ mail_send {"to", "subject", "body"}
267
+ cron_add {"command", "interval"}
268
+ save_session {"name"}
269
+ set_model {"name"}
270
+
271
+ 插件调用 (命令方式):
272
+ 【命令:/插件名 参数】
273
+
274
+ 旧格式兼容:
275
+ file_operations\n/write file.md "内容"
276
+ """,
277
+ "help_detail_app": """📜 【驭器 - 本机应用启动】
278
+
279
+ /open <路径/URL> 用系统默认程序打开文件或网址
280
+ /launch <应用> [目标] 启动指定应用,可带文件或URL参数
281
+ /apps 列出本机可用的应用别名
282
+
283
+ 使用示例:
284
+ /open https://example.com
285
+ /open /Users/me/doc.pdf
286
+ /launch chrome https://github.com
287
+ /launch 微信
288
+ /launch word /Users/me/report.docx
289
+
290
+ 常用应用别名:
291
+ 浏览器: chrome, safari, firefox, edge, 浏览器
292
+ 办公: word, excel, powerpoint, ppt, wps
293
+ 通讯: wechat, 微信, qq, 钉钉, 飞书
294
+ 工具: vscode, terminal, 终端, 计算器, 记事本
295
+ 媒体: music, 播放器, spotify, vlc
296
+ """,
297
+ "help_detail_agent": """📜 【分身 - Agent 系统】
298
+
299
+ /master on|off|status 主控 Agent — 自我进化型全能助手(接管所有对话)
300
+
301
+ /agent_create <名称> <描述> AI 自动生成完整 Agent(人设/技能/代码)
302
+ /agent_forge <名称> 从最近一次 AI 回复中提取代码,铸造为 Agent
303
+ /agent_list 列出所有 Agent 分身
304
+ /agent_show <名称> 查看 Agent 详情(人设/记忆/技能/代码/工作流)
305
+ /agent_edit <名称> <类型> 编辑 Agent 设定(persona/memory/skills/agent/workflow)
306
+ /agent_run <名称> [参数] 运行指定 Agent
307
+ /agent_delete <名称> 删除 Agent
308
+
309
+ Agent 目录: ~/.fr_cli_agents/<名称>/
310
+ • persona.md — 角色设定
311
+ • memory.md — 长期记忆
312
+ • skills.md — 技能说明
313
+ • agent.py — 可选自定义执行逻辑(必须包含 run(context, **kwargs))
314
+ • workflow.md — 可选工作流定义
315
+
316
+ 将已有代码转为 Agent 的方法:
317
+ 1. 在对话中让 AI 生成包含 def run(context, **kwargs) 的代码
318
+ 2. 程序会自动检测到 Agent 结构并提示保存
319
+ 3. 或手动执行 /agent_forge <名称> 从最近回复中提取代码
320
+ """,
321
+ "help_detail_builtin": """📜 【神通 - 内置 Agent 前缀】
322
+
323
+ 在对话中直接使用 @ 前缀触发内置 Agent:
324
+
325
+ @local <需求> 本地系统操作助手,AI 生成系统命令并执行
326
+ @remote [别名] <需求> 远程 SSH 操作助手,通过 SSH 在远程主机执行命令
327
+ @spider <URL> [深度] 智能网页爬虫,模拟真人行为获取网页内容
328
+ @db [别名] <需求> 数据库智能助手,自动分析 Schema 并生成 SQL
329
+ @RAG <问题> 本地知识库问答,向量检索 + 大模型生成
330
+
331
+ RAG 知识库管理:
332
+ /rag_dir <路径> — 设置知识库目录并首次同步
333
+ /rag_sync [路径] — 手动同步知识库(向量化新文件)
334
+ /rag_watch start [目录] [--interval N] — 启动独立守护进程(持久化后台监控)
335
+ /rag_watch stop — 停止独立守护进程
336
+ /rag_watch status — 查看守护进程状态
337
+ /rag_watch log [--lines N] — 查看守护进程日志
338
+
339
+ 说明:
340
+ • ChromaDB 以嵌入式 PersistentClient 自动启动,无需单独服务
341
+ • 内置模式(/rag_dir 后自动启动)为 daemon 线程,退出 fr-cli 后终止
342
+ • 独立模式(/rag_watch start)为系统级进程,退出终端后仍继续运行
343
+ • 守护进程通过 PID 文件管理,日志写入 ~/.fr_cli_rag_watcher.log
344
+
345
+ 配置向导:
346
+ /remote_setup — 远程主机配置向导(配置文件: ~/.fr_cli_remotes.json)
347
+ /db_setup — 数据库配置向导(配置文件: ~/.fr_cli_databases.json)
348
+ """,
349
+ "help_detail_dataframe": """📜 【数据卷轴 - Excel / CSV】
350
+
351
+ /read_excel <文件> 读取 Excel 文件并输出数据摘要
352
+ /read_csv <文件> 读取 CSV 文件并输出数据摘要
353
+
354
+ 说明:
355
+ • 支持 .xlsx, .xls, .csv 格式
356
+ • 自动输出列名、数据类型、非空统计、数值统计、前10行预览
357
+ • 数据摘要可提交给 AI 进行深度分析
358
+ """,
359
+ "help_detail_gatekeeper": """📜 【结界守护 - Gatekeeper 守护进程】
360
+
361
+ /gatekeeper start 启动守护进程(持久化 Agent HTTP 服务、全局定时任务、Agent 定时任务)
362
+ /gatekeeper stop 停止守护进程
363
+ /gatekeeper status 查看守护进程状态
364
+
365
+ Agent 分身定时任务:
366
+ /agent_cron_add <agent名称> <间隔秒> [输入] 为 Agent 添加定时执行计划
367
+ /agent_cron_list 列出所有 Agent 定时任务
368
+ /agent_cron_del <ID> 删除 Agent 定时任务
369
+
370
+ 说明:
371
+ • 守护进程独立于 fr-cli 主程序运行,退出终端后仍继续工作
372
+ • 启动时自动保存当前的 Agent HTTP 服务端口和定时任务配置
373
+ • 程序退出后守护进程仍可维持 Agent API、全局定时任务、Agent 定时任务
374
+ • 守护进程每30秒热重载配置,主进程新增/删除任务后自动同步
375
+ • 全局定时任务(/cron_add)修改后自动同步到守护进程配置
376
+ • 守护进程配置存储在 ~/.fr_cli_gatekeeper.json 中
377
+ """,
378
+ "help_detail_mcp": """📜 【MCP 外部神通】
379
+
380
+ MCP (Model Context Protocol) 允许连接外部服务器,将其工具纳入 AI 调用范围。
381
+
382
+ 管理命令:
383
+ /mcp_list 列出所有服务器及其可用法宝
384
+ /mcp_add <名> <命令> [参数...] 添加 stdio 服务器
385
+ /mcp_del <名> 删除服务器
386
+ /mcp_enable <名> 启用服务器
387
+ /mcp_disable <名> 禁用服务器
388
+ /mcp_refresh 刷新法宝列表
389
+
390
+ AI 调用格式:
391
+ 【调用:mcp_call({"server": "服务器名", "tool": "工具名", "arguments": {...}})】
392
+
393
+ 示例:
394
+ /mcp_add fs npx -y @modelcontextprotocol/server-filesystem /tmp
395
+ /mcp_refresh
396
+ """,
397
+ "help_detail_security": """📜 【安全机制】
398
+
399
+ 四阶安全确认 (Y/A/F/N):
400
+ [Y]仅此 仅允许本次操作
401
+ [A]本轮 本次会话内允许同类操作
402
+ [F]永世 永久允许同类操作 (写入配置)
403
+ [N]拒绝 拒绝本次操作
404
+
405
+ 受保护操作:
406
+ sec_read(读文件) sec_write(写文件) sec_exec(执行)
407
+ sec_mount(加目录) sec_gen_img(画图) sec_send_mail(发邮件)
408
+ sec_fetch_web(抓取) sec_upload_disk(上传) sec_download_disk(下载)
409
+ sec_shell(Shell命令)
410
+
411
+ 目录穿越防护:
412
+ VFS通过Path.resolve()检查路径, 禁止 ../ 逃逸出 allowed_dirs
413
+
414
+ 非交互环境:
415
+ • 设置 FR_CLI_NON_INTERACTIVE=1 时,安全确认默认拒绝(用于脚本/CI环境)
416
+ """,
417
+ },
418
+ "en": {
419
+ "sys_prompt": "You are an AI assistant. Answer questions directly. Use tools only when they are explicitly provided in the system prompt. If no tools are provided, respond normally without any 【命令:...】 markers.\n\nSpecial note: When the user asks about this program's features, usage help, or requests to send/share the program's documentation, please prioritize using read_file to read the MANUAL.md file in the current workspace, rather than performing a web search.\n\nWhen the user explicitly asks to create a plugin/tool, generate Python code containing def run(args='') inside a ```python block.",
420
+ "prompt_user": "🧑 You", "prompt_ai": "🤖 AI", "prompt_skill": "⚡",
421
+ "banner_title": [" F A N R E N C L I T O O L ", "──────────────────────────────────", " [ Advanced Code Engine v1.0 ] "],
422
+ "bye_title": ["S E E Y O U", "N E X T T I M E"], "bye_msg": "Happy chatting. 👋",
423
+ "status_model": "🔮 Model", "status_limit": "🛡️ Limit", "status_dir": "📂 Dir", "status_sess": "⏳ Sess",
424
+ "no_dir": "No dir", "new_sess": "New", "cur_dir": "Active",
425
+ "conn_ok": "✅ Connected.", "conn_fail": "❌ Failed:", "err_posix": "❌ Error:",
426
+ "err_bound": "⚠️ Denied", "err_no_file": "⚠️ Not found",
427
+ "ok_dir_add": "✅ Dir [{}] added", "err_dir_no": "❌ Not exists", "ok_cd": "✅ Dir: {}",
428
+ "ok_dir_remove": "✅ Dir [{}] removed", "err_dir_idx": "❌ Invalid index", "err_dir_not_mounted": "❌ Not mounted: {}",
429
+ "ok_model": "✅ Model: {}", "err_model": "❌ Fail:", "ok_key": "✅ Updated.",
430
+ "ok_limit": "✅ Limit: {}", "err_limit": "❌ Min 1000", "ok_forged": "✅ Skill: /{}",
431
+ "ok_sess_save": "✅ Saved: [{}]", "ok_sess_load": "✅ Loaded: [{}]", "ok_sess_del": "✅ Deleted",
432
+ "ok_undo": "✅ Undone.", "err_undo": "❌ None.", "ok_export": "✅ Export: {}",
433
+ "ok_alias_set": "✅ Alias: {} = {}", "no_alias": "None.",
434
+ "sec_title": "⚠️ Security Check:", "sec_opt_y": "[Y]Once", "sec_opt_a": "[A]Session", "sec_opt_f": "[F]Forever", "sec_opt_n": "[N]Deny", "sec_denied": "🛑 Abort.",
435
+ "sec_read": "Read file", "sec_write": "Write plugin", "sec_exec": "Run plugin", "sec_mount": "Mount dir", "sec_gen_img": "GenImg", "sec_send_mail": "Mail", "sec_fetch_web": "Fetch", "sec_upload_disk": "Upload", "sec_download_disk": "Download", "sec_shell": "Shell Exec",
436
+ "gen_ing": "🎨 Gen…", "gen_ok": "✅ Saved: {}", "gen_fail": "❌ Fail: ", "see_warn": "⚠️ Need glm-4v-plus", "see_ing": "👁️ See…",
437
+ "help_title": "📜 Help:", "help_cfg": "[Config]", "help_fs": "[FS]", "help_sess": "[Sess]", "help_plugin": "[Plugins]", "help_extra": "[Adv]", "help_shell": "[Matrix]",
438
+ "help_usage": "💡 Usage: /help [topic] Topics: config, fs, session, plugin, mail, cron, web, disk, vision, shell, tools, security, app, agent, builtin, dataframe, gatekeeper, mcp, all",
439
+ "help_detail_mcp": """📜 [MCP External Tools]
440
+
441
+ MCP (Model Context Protocol) connects external servers and makes their tools available to AI.
442
+
443
+ Management:
444
+ /mcp_list List all servers and their tools
445
+ /mcp_add <name> <cmd> [args...] Add a stdio server
446
+ /mcp_del <name> Remove server
447
+ /mcp_enable <name> Enable server
448
+ /mcp_disable <name> Disable server
449
+ /mcp_refresh Refresh tool list
450
+
451
+ AI call format:
452
+ 【调用:mcp_call({"server": "server_name", "tool": "tool_name", "arguments": {...}})】
453
+
454
+ Example:
455
+ /mcp_add fs npx -y @modelcontextprotocol/server-filesystem /tmp
456
+ /mcp_refresh
457
+ """,
458
+ "help_not_found": "❌ Unknown topic: {} Available: config, fs, session, plugin, mail, cron, web, disk, vision, shell, tools, security, app, agent, builtin, dataframe, gatekeeper, mcp, all",
459
+ "empty": "(Empty)", "none": "None", "no_sess": "No sess.", "no_plugins": "No plug.",
460
+ "ctx_dir": "\n[System: User in {}.]",
461
+ "menu_mail": "[Mail]", "menu_cron": "[Cron]", "menu_web": "[Web]", "menu_disk": "[Disk]",
462
+ "mail_setup": "/mail_setup", "mail_inbox": "/mail_inbox", "mail_read": "/mail_read <ID>", "mail_send": "/mail_send <To> <Sub> <Body>",
463
+ "mail_ok": "✅ Sent", "mail_err": "❌ Err:", "mail_no_cfg": "❌ No Mail", "mail_sub": "Sub: {}", "mail_from": "From: {}", "mail_date": "Date: {}",
464
+ "cron_add": "/cron_add <S> <C>", "cron_list": "/cron_list", "cron_del": "/cron_del <ID>",
465
+ "cron_ok": "✅ Added (ID:{}, {}s)", "cron_killed": "✅ Killed: {}", "cron_running": "🏃 Run",
466
+ "web_search": "/web <Q> Search", "web_fetch": "/fetch <URL>",
467
+ "web_err": "❌ Err:", "web_no_res": "None.", "web_title": "📜 Search:",
468
+ "disk_setup": "/disk_setup", "disk_ls": "/disk_ls <N>", "disk_up": "/disk_up <N> <L>", "disk_down": "/disk_down <N> <R> [L]",
469
+ "disk_ok_up": "✅ Up: {}", "disk_ok_down": "✅ Down: {}", "disk_err": "❌ Err: ", "disk_no_cfg": "❌ No Disk", "disk_miss_dep": "❌ Miss: {} (pip install {})",
470
+ "shell_tip": "!cmd Run shell (e.g. !ls)",
471
+ "pipe_tip": "!cmd | msg Pipe to AI (e.g. !ps aux | find high CPU)",
472
+ "pipe_prefix": "[Piped Data]:\n",
473
+ "artifact_detect": "⚡ Artifact detected, name (Enter to skip): ",
474
+ "recommend_title": "💡 Recommended Features:",
475
+ "rec_ls": "List files in current directory",
476
+ "rec_cat": "View file content",
477
+ "rec_cd": "Change directory",
478
+ "rec_see": "View and analyze image",
479
+ "rec_mail_inbox": "View inbox",
480
+ "rec_mail_send": "Send email",
481
+ "rec_web": "Web search",
482
+ "rec_fetch": "Fetch web content",
483
+ "rec_cron_add": "Add scheduled task",
484
+ "rec_cron_list": "List scheduled tasks",
485
+ "rec_disk_ls": "List cloud files",
486
+ "rec_disk_up": "Upload to cloud",
487
+ "rec_disk_down": "Download from cloud",
488
+ "rec_save": "Save current session",
489
+ "rec_load": "Load historical session",
490
+ "rec_model": "Switch AI model",
491
+ "rec_key": "Set API key",
492
+ "rec_lang": "Switch language",
493
+ "rec_skills": "View available plugins",
494
+ "rec_export": "Export session as Markdown",
495
+ "rec_exec": "Execute system command",
496
+ "rec_pipe": "Pipe command output to AI",
497
+ "help_detail_config": """📜 [Config]
498
+
499
+ /model <name> Switch AI model (glm-4-flash, glm-4-plus, glm-4v-plus)
500
+ /key <key> Change ZhipuAI API Key
501
+ /limit <n> Set token limit (min 1000)
502
+ /lang <zh/en> Switch UI language
503
+ /mode <direct|cot|tot|react> Switch AI thinking mode (direct/CoT/ToT/ReAct)
504
+ /alias <k> [v] View/set command alias
505
+ /dir <path> Add allowed directory to sandbox
506
+ /dirs List all mounted directories
507
+ /rmdir <idx/path> Remove specified directory
508
+ /export Export current session to Markdown
509
+ /update check Check for updates
510
+ /update run Apply update and restart
511
+
512
+ Config file: ~/.zhipu_cli_config.json
513
+ """,
514
+ "help_detail_fs": """📜 [FS - File Operations]
515
+
516
+ /ls List files in current directory
517
+ /cat <file> View file content (UTF-8/GBK/Latin-1)
518
+ /cd <dir> Change working directory
519
+ /dirs List all mounted directories
520
+ /rmdir <idx/path> Remove specified directory
521
+ /write <f> <c> Write/overwrite file
522
+ /append <f> <c> Append content to file
523
+ /delete <f> Delete file
524
+
525
+ Examples:
526
+ /cd data Change to data directory
527
+ /ls List files
528
+ /cat README.md View file content
529
+ /write a.md text Write file
530
+ /append a.md more Append content
531
+ /delete a.md Delete file (needs confirmation)
532
+
533
+ Security:
534
+ • Restricted to allowed_dirs, ../ traversal blocked
535
+ • /write auto-creates parent directories
536
+ • Dangerous ops trigger 4-level security confirmation
537
+ """,
538
+ "help_detail_session": """📜 [Session]
539
+
540
+ /save <name> Save current conversation
541
+ /load Load historical session (interactive)
542
+ /del Delete historical session (interactive)
543
+ /undo Undo last conversation turn
544
+ /export Export session as Markdown
545
+
546
+ Auto-save by date:
547
+ /session_list List all auto-saved sessions
548
+ /session_load <N> Load session by index and continue
549
+ /session_del <N> Delete auto-saved session by index
550
+
551
+ Examples:
552
+ /save project Save current session
553
+ /load Interactive load
554
+ /del Interactive delete
555
+ /undo Undo last turn
556
+ /export Export to Markdown
557
+ /session_list View auto-saved sessions
558
+ /session_load 1 Load today's first session
559
+
560
+ Context Memory:
561
+ • Auto-summarize last 5 turns
562
+ • Persisted to ~/.zhipu_cli_context.json by session_name
563
+ • Context restored when loading session
564
+ • Auto-created date-indexed session file on each launch (~/.fr_cli_sessions/)
565
+ """,
566
+ "help_detail_plugin": """📜 [Plugins]
567
+
568
+ /skills List installed plugins
569
+ /<plugin> [args] Run specified plugin
570
+
571
+ Auto-evolution:
572
+ • When AI reply contains def run(args='') and ```python block
573
+ • Prompts to save as plugin, enter name to forge
574
+
575
+ Plugin dir: ~/.zhipu_cli_plugins/
576
+ Convention: def run(args='') returning a string
577
+ Safety: Runs in isolated subprocess with 15s timeout
578
+ """,
579
+ "help_detail_mail": """📜 [Mail]
580
+
581
+ Setup:
582
+ 1. Get auth code (QQ Mail: Settings→Account→Enable IMAP/SMTP)
583
+ 2. /mail_setup to run config wizard
584
+
585
+ /mail_setup Mail config wizard
586
+ /mail_inbox List last 10 emails
587
+ /mail_read <id> Read full content of specified email
588
+ /mail_send <to> <sub> <body> Send email
589
+
590
+ Examples:
591
+ /mail_setup
592
+ /mail_inbox
593
+ /mail_read 1
594
+ /mail_send friend@qq.com Subject Body
595
+
596
+ Supported: QQ/163/Gmail/Outlook/Aliyun
597
+ Note: QQ/163 require "auth code" instead of login password
598
+ """,
599
+ "help_detail_cron": """📜 [Cron - Scheduled Tasks]
600
+
601
+ /cron_add <sec> <cmd> Add recurring task (shell command)
602
+ /cron_list List running scheduled tasks
603
+ /cron_del <id> Delete specified task
604
+
605
+ Examples:
606
+ /cron_add 300 ls -la /project Every 5 minutes
607
+ /cron_add 60 df -h Every minute
608
+ /cron_list
609
+ /cron_del 1
610
+
611
+ Notes:
612
+ • Based on threading.Timer, tasks vanish on program exit
613
+ • Use /gatekeeper start for persistence
614
+ • Shell commands timeout at 30s, output truncated to 100 chars
615
+ • Dangerous operations trigger security confirmation
616
+ """,
617
+ "help_detail_web": """📜 [Web]
618
+
619
+ /web <query> Baidu search (returns up to 5 results)
620
+ /fetch <url> Fetch webpage and extract plain text (truncated to 3000 chars)
621
+
622
+ Examples:
623
+ /web Python asyncio tutorial
624
+ /fetch https://docs.python.org/3/library/asyncio.html
625
+
626
+ AI auto-invoke:
627
+ 【调用:search_web({"query": "..."})】
628
+ 【调用:fetch_web({"url": "https://..."})】
629
+ """,
630
+ "help_detail_disk": """📜 [Cloud Disk]
631
+
632
+ Currently supports Aliyun Drive (personal cloud).
633
+ Run /disk_setup for first-time QR code login.
634
+
635
+ /disk_setup Launch cloud disk setup wizard
636
+ /disk_ls List files and folders in current cloud dir
637
+ /disk_cd <dir> Change cloud directory (supports ..)
638
+ /disk_up <local> <remote> Upload file to current dir
639
+ /disk_down <remote> [local] Download file from current dir
640
+
641
+ Examples:
642
+ /disk_setup First-time QR login
643
+ /disk_ls List cloud files
644
+ /disk_cd docs Enter docs folder
645
+ /disk_up /local/report.pdf report.pdf
646
+ /disk_down report.pdf /local/
647
+
648
+ Deps: pip install aligo
649
+ """,
650
+ "help_detail_vision": """📜 [Vision]
651
+
652
+ /see <img_path> [question] Analyze image with GLM-4V
653
+
654
+ Steps:
655
+ 1. /model glm-4v-plus Switch to vision model
656
+ 2. /see photo.jpg Describe this Analyze image
657
+
658
+ AI auto-invoke:
659
+ 【调用:generate_image({"prompt": "..."})】
660
+ Image generation uses CogView-3-plus, saved to current dir
661
+ """,
662
+ "help_detail_shell": """📜 [Matrix - Shell Commands]
663
+
664
+ !<cmd> Run local shell command (e.g. !ls -la)
665
+ !<cmd> | <prompt> Pipe command output to AI for analysis
666
+
667
+ Examples:
668
+ !ls -la /Users/me/project
669
+ !ps aux | find the highest CPU process
670
+ !cat log.txt | analyze this log for issues
671
+
672
+ Notes:
673
+ • 15s timeout for commands
674
+ • Triggers sec_shell security confirmation
675
+ • In pipe mode AI generates analysis based on output
676
+ """,
677
+ "help_detail_tools": """📜 [AI Tool Calls]
678
+
679
+ AI outputs invocation markers, program parses and executes:
680
+ 【调用:tool_name({"param": "value"})】
681
+
682
+ Common tools:
683
+ write_file {"path", "content"}
684
+ read_file {"path"}
685
+ list_files {}
686
+ search_web {"query"}
687
+ fetch_web {"url"}
688
+ generate_image {"prompt"}
689
+ mail_inbox {}
690
+ mail_send {"to", "subject", "body"}
691
+ cron_add {"command", "interval"}
692
+ save_session {"name"}
693
+ set_model {"name"}
694
+
695
+ Plugin calls (command style):
696
+ 【命令:/plugin_name args】
697
+
698
+ Legacy format compatible:
699
+ file_operations\n/write file.md "content"
700
+ """,
701
+ "help_detail_app": """📜 [Launcher - Local Apps]
702
+
703
+ /open <path/URL> Open file or URL with default app
704
+ /launch <app> [target] Launch specific app, optionally with file/URL
705
+ /apps List available app aliases on this machine
706
+
707
+ Examples:
708
+ /open https://example.com
709
+ /open /Users/me/doc.pdf
710
+ /launch chrome https://github.com
711
+ /launch wechat
712
+ /launch word /Users/me/report.docx
713
+
714
+ Common app aliases:
715
+ Browser: chrome, safari, firefox, edge, browser
716
+ Office: word, excel, powerpoint, ppt, wps
717
+ Chat: wechat, qq, dingtalk, lark
718
+ Tools: vscode, terminal, calculator, notepad
719
+ Media: music, spotify, vlc
720
+ """,
721
+ "help_detail_agent": """📜 [Agent System]
722
+
723
+ /master on|off|status Master Agent — self-evolving universal assistant (takes over all chat)
724
+
725
+ /agent_create <name> <desc> Auto-generate a complete Agent (persona/skills/code)
726
+ /agent_forge <name> Extract code from the latest AI reply and forge as Agent
727
+ /agent_list List all Agent instances
728
+ /agent_show <name> View Agent details (persona/memory/skills/code/workflow)
729
+ /agent_edit <name> <type> Edit Agent settings (persona/memory/skills/agent/workflow)
730
+ /agent_run <name> [args] Run specified Agent
731
+ /agent_delete <name> Delete Agent
732
+
733
+ Agent directory: ~/.fr_cli_agents/<name>/
734
+ • persona.md — Character setting
735
+ • memory.md — Long-term memory
736
+ • skills.md — Skill descriptions
737
+ • agent.py — Optional custom execution logic (must contain run(context, **kwargs))
738
+ • workflow.md — Optional workflow definition
739
+
740
+ How to turn existing code into an Agent:
741
+ 1. Ask AI to generate code containing def run(context, **kwargs)
742
+ 2. The program auto-detects Agent structure and prompts to save
743
+ 3. Or manually run /agent_forge <name> to extract code from the latest reply
744
+ """,
745
+ "help_detail_builtin": """📜 [Built-in Agents — @ Prefix]
746
+
747
+ Use @ prefix in chat to trigger built-in Agents:
748
+
749
+ @local <requirement> Local system assistant, AI generates and executes shell commands
750
+ @remote [alias] <requirement> Remote SSH assistant, executes commands on remote hosts
751
+ @spider <URL> [depth] Smart web crawler with anti-bot adaptation
752
+ @db [alias] <requirement> Database assistant, auto-analyzes schema and generates SQL
753
+ @RAG <question> Local knowledge base Q&A with vector search
754
+
755
+ RAG Knowledge Base Management:
756
+ /rag_dir <path> — Set KB directory and sync for the first time
757
+ /rag_sync [path] — Manually sync KB (vectorize new files)
758
+ /rag_watch start [dir] [--interval N] — Start standalone daemon (persistent background watcher)
759
+ /rag_watch stop — Stop the standalone daemon
760
+ /rag_watch status — Show daemon status
761
+ /rag_watch log [--lines N] — View daemon log
762
+
763
+ Notes:
764
+ • ChromaDB runs in embedded mode (PersistentClient), no separate service needed
765
+ • Built-in mode (auto-started after /rag_dir) uses a daemon thread, stops when fr-cli exits
766
+ • Standalone mode (/rag_watch start) is a system-level process, survives terminal exit
767
+ • Daemon managed via PID file, logs written to ~/.fr_cli_rag_watcher.log
768
+
769
+ Setup wizards:
770
+ /remote_setup — Remote host configuration wizard
771
+ /db_setup — Database configuration wizard
772
+ """,
773
+ "help_detail_dataframe": """📜 [Data Scroll — Excel / CSV]
774
+
775
+ /read_excel <file> Read Excel file and output data summary
776
+ /read_csv <file> Read CSV file and output data summary
777
+
778
+ Notes:
779
+ • Supports .xlsx, .xls, .csv formats
780
+ • Auto-outputs columns, dtypes, null stats, numeric stats, top-10 preview
781
+ • Summary can be fed to AI for deep analysis
782
+ """,
783
+ "help_detail_gatekeeper": """📜 [Gatekeeper Daemon]
784
+
785
+ /gatekeeper start Start the daemon (persists Agent HTTP server, global cron, agent cron)
786
+ /gatekeeper stop Stop the daemon
787
+ /gatekeeper status Show daemon status
788
+
789
+ Agent Cron Jobs:
790
+ /agent_cron_add <agent> <seconds> [input] Add a scheduled execution for an Agent
791
+ /agent_cron_list List all Agent cron jobs
792
+ /agent_cron_del <ID> Delete an Agent cron job
793
+
794
+ Notes:
795
+ • Daemon runs independently of the main fr-cli process, survives terminal exit
796
+ • On start, auto-saves current Agent HTTP port and cron job configs
797
+ • Agent API, global cron jobs, and agent cron jobs survive after fr-cli exits
798
+ • Daemon reloads config every 30 seconds; changes from main process auto-sync
799
+ • Global cron jobs (/cron_add) are auto-synced to daemon config after change
800
+ • Daemon config stored in ~/.fr_cli_gatekeeper.json
801
+ """,
802
+ "help_detail_security": """📜 [Security]
803
+
804
+ 4-level confirmation (Y/A/F/N):
805
+ [Y]Once Allow this operation only
806
+ [A]Session Allow this session
807
+ [F]Forever Allow forever (saved to config)
808
+ [N]Deny Deny this operation
809
+
810
+ Protected operations:
811
+ sec_read sec_write sec_exec sec_mount sec_gen_img
812
+ sec_send_mail sec_fetch_web sec_upload_disk sec_download_disk
813
+ sec_shell
814
+
815
+ Path traversal protection:
816
+ VFS checks via Path.resolve(), blocks ../ escaping allowed_dirs
817
+
818
+ Non-interactive mode:
819
+ • Set FR_CLI_NON_INTERACTIVE=1 to default-deny (for scripts/CI)
820
+ """,
821
+ }
822
+ }
823
+
824
+ def T(k, l="zh", *a):
825
+ """根据键名和语言获取国际化文本,支持格式化参数"""
826
+ t = I18N.get(l, I18N["zh"]).get(k, "")
827
+ return t.format(*a) if a else t