@foxden-app/foxclaw 0.2.5 → 0.2.7
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.
- package/README.md +59 -21
- package/README_EN.md +73 -33
- package/dist/controller/controller.js +1 -1
- package/dist/controller/presentation.js +25 -15
- package/dist/i18n.d.ts +58 -58
- package/dist/i18n.js +58 -58
- package/docs/zh/agent-assisted-install.md +83 -0
- package/docs/zh/foxclaw-skill.md +24 -0
- package/docs/zh/install-for-beginners.md +295 -0
- package/docs/zh/troubleshooting.md +222 -0
- package/package.json +1 -1
package/dist/i18n.js
CHANGED
|
@@ -146,10 +146,10 @@ const MESSAGES = {
|
|
|
146
146
|
auth_add_cancelled: 'New auth login cancelled. Restored previous auth.',
|
|
147
147
|
auth_add_reverted: 'Restored previous auth.',
|
|
148
148
|
auth_add_missing_file: 'Login completed, but the new auth file was not created: {value}',
|
|
149
|
-
button_login_device: 'Login
|
|
150
|
-
button_auth_reload: 'Reload auth',
|
|
151
|
-
button_auth_enable: 'Enable',
|
|
152
|
-
button_auth_disable: 'Disable',
|
|
149
|
+
button_login_device: '🔑 Login',
|
|
150
|
+
button_auth_reload: '🔄 Reload auth',
|
|
151
|
+
button_auth_enable: '✅ Enable',
|
|
152
|
+
button_auth_disable: '⏸️ Disable',
|
|
153
153
|
another_turn_running: 'Another turn is already running. Use /interrupt, /takeover, /queue, or wait.',
|
|
154
154
|
working: 'Working...',
|
|
155
155
|
usage_open: 'Usage: /open <n>',
|
|
@@ -293,16 +293,16 @@ const MESSAGES = {
|
|
|
293
293
|
approval_decision_accept: 'allow',
|
|
294
294
|
approval_decision_session: 'allow for session',
|
|
295
295
|
approval_decision_deny: 'deny',
|
|
296
|
-
button_allow: 'Allow',
|
|
297
|
-
button_allow_session: '
|
|
298
|
-
button_deny: 'Deny',
|
|
299
|
-
button_interrupt: 'Interrupt',
|
|
300
|
-
button_permissions: 'Access',
|
|
301
|
-
button_models: 'Models',
|
|
302
|
-
button_threads: 'Threads',
|
|
303
|
-
button_reveal: 'Reveal',
|
|
304
|
-
button_auto: 'Auto',
|
|
305
|
-
button_new_thread: 'New',
|
|
296
|
+
button_allow: '✅ Allow',
|
|
297
|
+
button_allow_session: '✅ Session',
|
|
298
|
+
button_deny: '🚫 Deny',
|
|
299
|
+
button_interrupt: '⏹️ Interrupt',
|
|
300
|
+
button_permissions: '🛡️ Access',
|
|
301
|
+
button_models: '🤖 Models',
|
|
302
|
+
button_threads: '🧵 Threads',
|
|
303
|
+
button_reveal: '↗️ Reveal',
|
|
304
|
+
button_auto: '⚙️ Auto',
|
|
305
|
+
button_new_thread: '➕ New',
|
|
306
306
|
threads_no_matches: '<b>No threads matched</b>\n<code>{searchTerm}</code>',
|
|
307
307
|
threads_no_recent: '<b>No recent threads.</b>',
|
|
308
308
|
threads_recent_title: '<b>Recent threads</b>',
|
|
@@ -311,15 +311,15 @@ const MESSAGES = {
|
|
|
311
311
|
threads_filter: 'Filter: <code>{searchTerm}</code>',
|
|
312
312
|
threads_range: 'Showing {start}-{end}',
|
|
313
313
|
threads_filter_cleared_short: 'Filter cleared',
|
|
314
|
-
button_prev_page: 'Prev',
|
|
315
|
-
button_next_page: 'Next',
|
|
316
|
-
button_clear_filter: 'Clear
|
|
317
|
-
button_recent_threads: 'Recent',
|
|
318
|
-
button_archived_threads: 'Archived',
|
|
319
|
-
button_thread_rename: 'Rename',
|
|
320
|
-
button_thread_watch: 'Watch',
|
|
321
|
-
button_thread_archive: 'Archive/Delete',
|
|
322
|
-
button_thread_unarchive: 'Unarchive',
|
|
314
|
+
button_prev_page: '⬅️ Prev',
|
|
315
|
+
button_next_page: '➡️ Next',
|
|
316
|
+
button_clear_filter: '🧹 Clear',
|
|
317
|
+
button_recent_threads: '🕘 Recent',
|
|
318
|
+
button_archived_threads: '🗄️ Archived',
|
|
319
|
+
button_thread_rename: '✏️ Rename',
|
|
320
|
+
button_thread_watch: '👀 Watch',
|
|
321
|
+
button_thread_archive: '🗑️ Archive/Delete',
|
|
322
|
+
button_thread_unarchive: '♻️ Unarchive',
|
|
323
323
|
threads_current: 'Current: <b>{title}</b>',
|
|
324
324
|
where_no_thread_bound: 'No thread is currently bound.',
|
|
325
325
|
where_send_message_or_new: 'Send a message or use /new.',
|
|
@@ -368,8 +368,8 @@ const MESSAGES = {
|
|
|
368
368
|
active_turn_message_mode_steer: 'Steer current turn',
|
|
369
369
|
active_turn_message_mode_queue: 'Queue next turn',
|
|
370
370
|
button_fast_on: '⚡ Fast: on',
|
|
371
|
-
button_fast_off: 'Fast: off',
|
|
372
|
-
button_fast_unsupported: 'Fast unsupported',
|
|
371
|
+
button_fast_off: '⚪ Fast: off',
|
|
372
|
+
button_fast_unsupported: '⛔ Fast unsupported',
|
|
373
373
|
access_preset_read_only: 'Read-only',
|
|
374
374
|
access_preset_default: 'Default',
|
|
375
375
|
access_preset_full_access: 'Full access',
|
|
@@ -504,10 +504,10 @@ const MESSAGES = {
|
|
|
504
504
|
permission_read_paths: 'Read paths: {value}',
|
|
505
505
|
permission_write_paths: 'Write paths: {value}',
|
|
506
506
|
permission_entries: 'File entries: {value}',
|
|
507
|
-
button_accept: 'Accept',
|
|
508
|
-
button_decline: 'Decline',
|
|
509
|
-
button_cancel: 'Cancel',
|
|
510
|
-
button_create_dir: 'Create',
|
|
507
|
+
button_accept: '✅ Accept',
|
|
508
|
+
button_decline: '🚫 Decline',
|
|
509
|
+
button_cancel: '✖️ Cancel',
|
|
510
|
+
button_create_dir: '📁 Create',
|
|
511
511
|
thread_name_updated: 'Thread renamed: {name}',
|
|
512
512
|
thread_archived_notification: 'Thread archived: {threadId}',
|
|
513
513
|
thread_unarchived_notification: 'Thread unarchived: {threadId}',
|
|
@@ -694,10 +694,10 @@ const MESSAGES = {
|
|
|
694
694
|
auth_add_cancelled: '新 auth 登录已取消,已恢复之前的 auth。',
|
|
695
695
|
auth_add_reverted: '已恢复之前的 auth。',
|
|
696
696
|
auth_add_missing_file: '登录已完成,但没有创建新的 auth 文件:{value}',
|
|
697
|
-
button_login_device: '设备登录',
|
|
698
|
-
button_auth_reload: '重载 auth',
|
|
699
|
-
button_auth_enable: '启用',
|
|
700
|
-
button_auth_disable: '禁用',
|
|
697
|
+
button_login_device: '🔑 设备登录',
|
|
698
|
+
button_auth_reload: '🔄 重载 auth',
|
|
699
|
+
button_auth_enable: '✅ 启用',
|
|
700
|
+
button_auth_disable: '⏸️ 禁用',
|
|
701
701
|
another_turn_running: '已经有一个回复在进行中。请先等待,或使用 /interrupt、/takeover、/queue。',
|
|
702
702
|
working: '处理中...',
|
|
703
703
|
usage_open: '用法:/open <编号>',
|
|
@@ -841,16 +841,16 @@ const MESSAGES = {
|
|
|
841
841
|
approval_decision_accept: '允许',
|
|
842
842
|
approval_decision_session: '本会话内允许',
|
|
843
843
|
approval_decision_deny: '拒绝',
|
|
844
|
-
button_allow: '允许',
|
|
845
|
-
button_allow_session: '
|
|
846
|
-
button_deny: '拒绝',
|
|
847
|
-
button_interrupt: '中断',
|
|
848
|
-
button_permissions: '权限',
|
|
849
|
-
button_models: '模型',
|
|
850
|
-
button_threads: '线程',
|
|
851
|
-
button_reveal: '打开',
|
|
852
|
-
button_auto: '自动',
|
|
853
|
-
button_new_thread: '新建',
|
|
844
|
+
button_allow: '✅ 允许',
|
|
845
|
+
button_allow_session: '✅ 本会话',
|
|
846
|
+
button_deny: '🚫 拒绝',
|
|
847
|
+
button_interrupt: '⏹️ 中断',
|
|
848
|
+
button_permissions: '🛡️ 权限',
|
|
849
|
+
button_models: '🤖 模型',
|
|
850
|
+
button_threads: '🧵 线程',
|
|
851
|
+
button_reveal: '↗️ 打开',
|
|
852
|
+
button_auto: '⚙️ 自动',
|
|
853
|
+
button_new_thread: '➕ 新建',
|
|
854
854
|
threads_no_matches: '<b>没有匹配的线程</b>\n<code>{searchTerm}</code>',
|
|
855
855
|
threads_no_recent: '<b>暂无最近线程。</b>',
|
|
856
856
|
threads_recent_title: '<b>最近线程</b>',
|
|
@@ -859,15 +859,15 @@ const MESSAGES = {
|
|
|
859
859
|
threads_filter: '筛选:<code>{searchTerm}</code>',
|
|
860
860
|
threads_range: '显示第 {start}-{end} 条',
|
|
861
861
|
threads_filter_cleared_short: '已清除筛选',
|
|
862
|
-
button_prev_page: '上一页',
|
|
863
|
-
button_next_page: '下一页',
|
|
864
|
-
button_clear_filter: '
|
|
865
|
-
button_recent_threads: '最近线程',
|
|
866
|
-
button_archived_threads: '已归档',
|
|
867
|
-
button_thread_rename: '重命名',
|
|
868
|
-
button_thread_watch: '观察',
|
|
869
|
-
button_thread_archive: '归档/删除',
|
|
870
|
-
button_thread_unarchive: '取消归档',
|
|
862
|
+
button_prev_page: '⬅️ 上一页',
|
|
863
|
+
button_next_page: '➡️ 下一页',
|
|
864
|
+
button_clear_filter: '🧹 清除',
|
|
865
|
+
button_recent_threads: '🕘 最近线程',
|
|
866
|
+
button_archived_threads: '🗄️ 已归档',
|
|
867
|
+
button_thread_rename: '✏️ 重命名',
|
|
868
|
+
button_thread_watch: '👀 观察',
|
|
869
|
+
button_thread_archive: '🗑️ 归档/删除',
|
|
870
|
+
button_thread_unarchive: '♻️ 取消归档',
|
|
871
871
|
threads_current: '当前:<b>{title}</b>',
|
|
872
872
|
where_no_thread_bound: '当前没有绑定线程。',
|
|
873
873
|
where_send_message_or_new: '直接发一条消息,或者使用 /new。',
|
|
@@ -916,8 +916,8 @@ const MESSAGES = {
|
|
|
916
916
|
active_turn_message_mode_steer: '引导当前回复',
|
|
917
917
|
active_turn_message_mode_queue: '排队到下一轮',
|
|
918
918
|
button_fast_on: '⚡ Fast:开',
|
|
919
|
-
button_fast_off: 'Fast:关',
|
|
920
|
-
button_fast_unsupported: 'Fast 不支持',
|
|
919
|
+
button_fast_off: '⚪ Fast:关',
|
|
920
|
+
button_fast_unsupported: '⛔ Fast 不支持',
|
|
921
921
|
access_preset_read_only: '只读',
|
|
922
922
|
access_preset_default: '默认',
|
|
923
923
|
access_preset_full_access: '完全访问',
|
|
@@ -1052,10 +1052,10 @@ const MESSAGES = {
|
|
|
1052
1052
|
permission_read_paths: '可读路径:{value}',
|
|
1053
1053
|
permission_write_paths: '可写路径:{value}',
|
|
1054
1054
|
permission_entries: '文件条目:{value}',
|
|
1055
|
-
button_accept: '接受',
|
|
1056
|
-
button_decline: '拒绝',
|
|
1057
|
-
button_cancel: '取消',
|
|
1058
|
-
button_create_dir: '新建',
|
|
1055
|
+
button_accept: '✅ 接受',
|
|
1056
|
+
button_decline: '🚫 拒绝',
|
|
1057
|
+
button_cancel: '✖️ 取消',
|
|
1058
|
+
button_create_dir: '📁 新建',
|
|
1059
1059
|
thread_name_updated: '线程已重命名:{name}',
|
|
1060
1060
|
thread_archived_notification: '线程已归档:{threadId}',
|
|
1061
1061
|
thread_unarchived_notification: '线程已取消归档:{threadId}',
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Agent 辅助安装
|
|
2
|
+
|
|
3
|
+
如果目标电脑上已经有能执行 shell、读写文件、检查服务状态的编码 agent,优先用这条路径。它比手动一步步复制命令更快,也更容易发现本机环境里的阻塞点。
|
|
4
|
+
|
|
5
|
+
适合使用 Codex、OpenClaw、QwenPaw、Hermes、OpenCode、Kimi CLI,或者任何可以在目标机器上运行命令的 agent。
|
|
6
|
+
|
|
7
|
+
## 你需要准备
|
|
8
|
+
|
|
9
|
+
先准备这几个值:
|
|
10
|
+
|
|
11
|
+
- `TG_BOT_TOKEN`:从 `@BotFather` 拿到的 Telegram bot token
|
|
12
|
+
- `TG_ALLOWED_USER_ID`:你的 Telegram 数字用户 ID
|
|
13
|
+
- `DEFAULT_CWD`:希望 Codex 默认工作的目录
|
|
14
|
+
|
|
15
|
+
后续再配置群组或话题时才需要:
|
|
16
|
+
|
|
17
|
+
- `TG_ALLOWED_CHAT_ID`
|
|
18
|
+
- `TG_ALLOWED_TOPIC_ID`
|
|
19
|
+
|
|
20
|
+
第一次请先用 Telegram 私聊跑通。群组和话题模式等私聊稳定后再开。
|
|
21
|
+
|
|
22
|
+
## 复制给 agent 的安装提示词
|
|
23
|
+
|
|
24
|
+
把下面这段发给目标电脑上的 agent:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
请在这台机器上安装 FoxClaw。
|
|
28
|
+
|
|
29
|
+
发布包:
|
|
30
|
+
@foxden-app/foxclaw
|
|
31
|
+
|
|
32
|
+
先使用 Telegram 私聊模式。除非我明确提供 TG_ALLOWED_CHAT_ID 或 TG_ALLOWED_TOPIC_ID,否则不要配置群组/话题模式。
|
|
33
|
+
|
|
34
|
+
必需配置:
|
|
35
|
+
TG_BOT_TOKEN=<把 token 粘贴在这里>
|
|
36
|
+
TG_ALLOWED_USER_ID=<把 Telegram 数字用户 ID 粘贴在这里>
|
|
37
|
+
DEFAULT_CWD=<把绝对工作目录粘贴在这里>
|
|
38
|
+
|
|
39
|
+
任务:
|
|
40
|
+
1. 先检查机器环境。如果已经存在 FoxClaw 或旧的 telegram-codex-app-bridge 服务,先报告再改服务。
|
|
41
|
+
2. 确保 Node.js 24+ 可用;如果没有,请用 nvm 安装或切到 Node 24。
|
|
42
|
+
3. 确保 Codex CLI 存在并且已经登录。如果需要登录,停下来告诉我具体要执行什么。
|
|
43
|
+
4. 用 npm install -g @foxden-app/foxclaw@latest 安装或升级 FoxClaw。
|
|
44
|
+
5. 运行 foxclaw init,然后写入 ~/.foxclaw/.env。不要打印或提交 bot token。
|
|
45
|
+
6. 运行 foxclaw doctor。
|
|
46
|
+
7. 用 foxclaw start 启动 FoxClaw。
|
|
47
|
+
8. 让我在 Telegram bot 里发送 /help 和 /status。
|
|
48
|
+
9. 验证最终状态:
|
|
49
|
+
- Linux 上 foxclaw.service 处于 active/enabled
|
|
50
|
+
- 如果存在旧 telegram-codex-app-bridge.service,它应当 inactive/disabled
|
|
51
|
+
- foxclaw status 可以正常输出
|
|
52
|
+
10. 汇报执行过的命令、最终状态和后续看日志的命令。请隐藏 TG_BOT_TOKEN,不要打印完整 token 或完整 .env。
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 旧项目迁移提示词
|
|
56
|
+
|
|
57
|
+
如果目标机器还在跑 `telegram-codex-app-bridge`,用这段:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
请把这台机器从 telegram-codex-app-bridge 迁移到 FoxClaw。
|
|
61
|
+
|
|
62
|
+
新发布包:
|
|
63
|
+
@foxden-app/foxclaw
|
|
64
|
+
|
|
65
|
+
请执行:
|
|
66
|
+
1. 修改前先检查现有安装方式、服务文件和运行目录。
|
|
67
|
+
2. 如果存在 telegram-codex-app-bridge.service,停止并禁用它。
|
|
68
|
+
3. 如果 ~/.foxclaw 不存在而 ~/.telegram-codex-app-bridge 存在,把旧目录复制到 ~/.foxclaw。
|
|
69
|
+
4. 用 npm install -g @foxden-app/foxclaw@latest 安装或升级 FoxClaw。
|
|
70
|
+
5. 如果 ~/.foxclaw/.env 不存在,运行 foxclaw init;然后检查配置是否完整。
|
|
71
|
+
6. 运行 foxclaw doctor。
|
|
72
|
+
7. 用 foxclaw start 安装或重启 FoxClaw 服务。
|
|
73
|
+
8. 验证 foxclaw.service 正常运行,旧 telegram-codex-app-bridge.service 已停止或禁用。
|
|
74
|
+
9. 汇报最终状态和阻塞点。请隐藏 TG_BOT_TOKEN,不要打印完整 token 或完整 .env。
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 安全注意事项
|
|
78
|
+
|
|
79
|
+
- 不要把 bot token 粘贴到公开 issue、公开聊天或代码仓库。
|
|
80
|
+
- 不要提交 `.env`。
|
|
81
|
+
- 汇报结果时隐藏 `TG_BOT_TOKEN`。
|
|
82
|
+
- 第一次安装不要把 `/`、整个 `/Users`、整个 `/home` 或完整 home 目录设为 `DEFAULT_CWD`。
|
|
83
|
+
- 日常启动用 `foxclaw start`;只有排障时才用前台模式 `foxclaw serve`。
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# FoxClaw Skill 中文说明
|
|
2
|
+
|
|
3
|
+
仓库内置的 `skills/foxclaw` 是给 Codex 使用的安装技能。它的用途是让 Codex 在本机或远程 Mac 上自动完成 FoxClaw bootstrap,包括写 `.env`、安装依赖、构建、跑 `doctor`、安装 launchd 服务,并引导你完成第一次 Telegram 消息验证。
|
|
4
|
+
|
|
5
|
+
## 适合什么时候用
|
|
6
|
+
|
|
7
|
+
- 你想让 Codex 通过 SSH 帮另一台 Mac 安装 FoxClaw。
|
|
8
|
+
- 你希望 agent 先检查环境,再决定如何安装 Node.js 24、Codex CLI 和 FoxClaw。
|
|
9
|
+
- 你不想手动复制每一步安装命令,但愿意提供 Telegram bot token、用户 ID 和默认工作目录。
|
|
10
|
+
|
|
11
|
+
## 基本流程
|
|
12
|
+
|
|
13
|
+
1. 准备 `TG_BOT_TOKEN`、`TG_ALLOWED_USER_ID` 和 `DEFAULT_CWD`。
|
|
14
|
+
2. 让 Codex 使用 `skills/foxclaw`。
|
|
15
|
+
3. 如果是远程机器,提供 SSH 目标。
|
|
16
|
+
4. 让 Codex 执行安装、写配置、跑 `foxclaw doctor`。
|
|
17
|
+
5. 启动服务后,在 Telegram bot 里发送 `/help` 和 `/status` 验证。
|
|
18
|
+
|
|
19
|
+
## 注意事项
|
|
20
|
+
|
|
21
|
+
- 不要让 agent 把完整 bot token 打印到日志或提交到仓库。
|
|
22
|
+
- 第一次请先用私聊模式跑通。
|
|
23
|
+
- 不要把整个 home 目录或根目录作为首次 `DEFAULT_CWD`。
|
|
24
|
+
- 只有在 `doctor` 通过、服务已启动、Telegram 首条消息验证通过后,才算安装完成。
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# 新手安装指南
|
|
2
|
+
|
|
3
|
+
这份指南面向第一次安装 FoxClaw 的用户。你只需要能打开终端、复制命令、编辑一个配置文件,不需要提前熟悉 Node.js、Telegram bot 或 Codex CLI。
|
|
4
|
+
|
|
5
|
+
FoxClaw 跑在你的电脑上。手机发消息给 Telegram bot,bot 把消息交给 FoxClaw,FoxClaw 再控制本机 Codex。整个过程不需要公网服务器。
|
|
6
|
+
|
|
7
|
+
如果这台电脑上已经有 Codex、OpenClaw、QwenPaw、Hermes、OpenCode、Kimi CLI 这类能跑 shell 的 agent,优先看 [Agent 辅助安装](./agent-assisted-install.md)。
|
|
8
|
+
|
|
9
|
+
开始前先记住:
|
|
10
|
+
|
|
11
|
+
- 第一次先用 Telegram 私聊,不要先配群组。
|
|
12
|
+
- 不要把 bot token 发给不信任的人。
|
|
13
|
+
- 第一次不要把 `/`、`/Users`、`/home` 或整个 home 目录设为 `DEFAULT_CWD`。
|
|
14
|
+
- 日常启动用 `foxclaw start`,前台模式只用于排障。
|
|
15
|
+
|
|
16
|
+
## 1. 准备
|
|
17
|
+
|
|
18
|
+
你需要:
|
|
19
|
+
|
|
20
|
+
- 一台可以持续开机的 macOS 或 Linux 电脑
|
|
21
|
+
- 一个 Telegram 账号
|
|
22
|
+
- 一个已可使用的 Codex 账号
|
|
23
|
+
- 一个 Codex 可以工作的目录,例如 `~/Projects` 或 `~/Desktop`
|
|
24
|
+
- 第一次安装大约 10-20 分钟
|
|
25
|
+
|
|
26
|
+
## 2. 安装 Node.js 24
|
|
27
|
+
|
|
28
|
+
FoxClaw 需要 Node.js 24,因为它使用 Node 内置 SQLite 运行时。
|
|
29
|
+
|
|
30
|
+
如果已经安装 Node 24,这条命令会输出 `v24...`:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
node -v
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
如果不是 Node 24,推荐用 `nvm` 安装:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
|
40
|
+
export NVM_DIR="$HOME/.nvm"
|
|
41
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
42
|
+
nvm install 24
|
|
43
|
+
nvm use 24
|
|
44
|
+
node -v
|
|
45
|
+
npm -v
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
如果 `node -v` 仍然显示旧版本,关闭终端,重新打开后运行:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
nvm use 24
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 3. 安装并登录 Codex
|
|
55
|
+
|
|
56
|
+
FoxClaw 不创建 Codex 账号,它使用这台电脑上已经登录的 Codex CLI。
|
|
57
|
+
|
|
58
|
+
如果还没有安装 Codex CLI:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install -g @openai/codex
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
如果遇到 `EACCES`、`EPERM` 或 `permission denied`,不要反复加 `sudo` 硬装,先看 [故障排查](./troubleshooting.md)。
|
|
65
|
+
|
|
66
|
+
登录 Codex:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
codex login
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
检查命令是否存在:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
codex --version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`codex --version` 只能证明命令存在。要确认认证可用,直接启动 Codex 并发一个小请求:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
codex
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
然后输入:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Say ready and exit.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
如果你的 CLI 支持 `codex login status`,也可以用它辅助检查;真正可靠的验证是 Codex 能正常回答一个普通请求。
|
|
91
|
+
|
|
92
|
+
## 4. 创建 Telegram Bot
|
|
93
|
+
|
|
94
|
+
1. 打开 Telegram。
|
|
95
|
+
2. 搜索 `@BotFather`。
|
|
96
|
+
3. 发送 `/newbot`。
|
|
97
|
+
4. 按提示选择 bot 名称。
|
|
98
|
+
5. 复制 bot token,它看起来像 `123456789:AA...`。
|
|
99
|
+
|
|
100
|
+
请保存好这个 token。拿到 token 的人可以控制这个 bot。
|
|
101
|
+
|
|
102
|
+
## 5. 获取 Telegram 数字用户 ID
|
|
103
|
+
|
|
104
|
+
FoxClaw 只接受一个已配置用户的消息。
|
|
105
|
+
|
|
106
|
+
最简单的方式:
|
|
107
|
+
|
|
108
|
+
1. 打开 Telegram。
|
|
109
|
+
2. 搜索 `@userinfobot`。
|
|
110
|
+
3. 给它发任意消息或点击 Start。
|
|
111
|
+
4. 复制数字 `Id`。
|
|
112
|
+
|
|
113
|
+
请使用数字 ID,不要填 `@username`。
|
|
114
|
+
|
|
115
|
+
## 6. 安装 FoxClaw
|
|
116
|
+
|
|
117
|
+
用 npm 安装发布包:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm install -g @foxden-app/foxclaw
|
|
121
|
+
foxclaw init
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
这会创建默认配置文件 `~/.foxclaw/.env`。
|
|
125
|
+
|
|
126
|
+
如果你用 pnpm:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm add -g @foxden-app/foxclaw
|
|
130
|
+
foxclaw init
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 7. 填写 `.env`
|
|
134
|
+
|
|
135
|
+
用简单编辑器打开配置:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
nano ~/.foxclaw/.env
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
第一次私聊模式只需要重点填写这些值:
|
|
142
|
+
|
|
143
|
+
```dotenv
|
|
144
|
+
TG_BOT_TOKEN=123456789:replace_with_your_bot_token
|
|
145
|
+
TG_ALLOWED_USER_ID=123456789
|
|
146
|
+
TG_ALLOWED_CHAT_ID=
|
|
147
|
+
TG_ALLOWED_TOPIC_ID=
|
|
148
|
+
DEFAULT_CWD=/absolute/path/to/a/folder
|
|
149
|
+
DEFAULT_APPROVAL_POLICY=on-request
|
|
150
|
+
DEFAULT_SANDBOX_MODE=workspace-write
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`TG_ALLOWED_CHAT_ID=` 和 `TG_ALLOWED_TOPIC_ID=` 第一次保持为空,不要删掉这两行;留空表示私聊模式。
|
|
154
|
+
|
|
155
|
+
`DEFAULT_CWD` 必须是真实存在的目录,例如:
|
|
156
|
+
|
|
157
|
+
```dotenv
|
|
158
|
+
DEFAULT_CWD=/Users/alice/Desktop
|
|
159
|
+
DEFAULT_CWD=/home/alice/projects
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
在 `nano` 中按 `Ctrl+O`、回车、`Ctrl+X` 保存退出。
|
|
163
|
+
|
|
164
|
+
## 8. 运行检查
|
|
165
|
+
|
|
166
|
+
执行:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
foxclaw doctor
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
理想情况下会看到:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
[OK] node >= 24
|
|
176
|
+
[OK] codex cli available
|
|
177
|
+
[OK] telegram bot token configured
|
|
178
|
+
[OK] telegram allowed user configured
|
|
179
|
+
[OK] default cwd exists
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
如果看到 `[FAIL]`,先看 [故障排查](./troubleshooting.md)。
|
|
183
|
+
|
|
184
|
+
## 9. 启动 FoxClaw
|
|
185
|
+
|
|
186
|
+
启动或重启后台服务:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
foxclaw start
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
这个命令可以重复执行。它会跑检查,并按当前系统安装或重启后台服务。
|
|
193
|
+
|
|
194
|
+
打开你的 Telegram bot,先发:
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
/help
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
如果 bot 回复了,再发:
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
/status
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
然后试一个普通请求:
|
|
207
|
+
|
|
208
|
+
```text
|
|
209
|
+
List the files in the current working directory.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
还可以试:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
/setup
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
List files in DEFAULT_CWD.
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```text
|
|
223
|
+
Create a short README-style summary of this folder.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
```text
|
|
227
|
+
/interrupt
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## 10. 服务命令
|
|
231
|
+
|
|
232
|
+
Linux 上 `foxclaw start` 管理用户级 systemd 服务。查看状态:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
systemctl --user status foxclaw.service
|
|
236
|
+
journalctl --user -u foxclaw.service -f
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
如果希望重启后未登录也能启动用户服务:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
loginctl enable-linger "$USER"
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
macOS 上 `foxclaw start` 管理 launchd,并在你登录后启动 FoxClaw。
|
|
246
|
+
|
|
247
|
+
前台调试时,先停后台服务,再运行 `foxclaw serve`。
|
|
248
|
+
|
|
249
|
+
## 11. 日常维护
|
|
250
|
+
|
|
251
|
+
查看状态:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
foxclaw status
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
修改 `.env` 后重启:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
foxclaw start
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
停止 Linux 服务:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
systemctl --user stop foxclaw.service
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
卸载 Linux 服务:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
foxclaw uninstall-systemd
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
以后升级 FoxClaw:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
npm install -g @foxden-app/foxclaw@latest
|
|
279
|
+
foxclaw start
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## 从旧项目名迁移
|
|
283
|
+
|
|
284
|
+
如果这台机器仍在运行 `telegram-codex-app-bridge`,迁移一次即可:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
systemctl --user disable --now telegram-codex-app-bridge.service 2>/dev/null || true
|
|
288
|
+
test -e ~/.foxclaw || cp -a ~/.telegram-codex-app-bridge ~/.foxclaw
|
|
289
|
+
npm install -g @foxden-app/foxclaw@latest
|
|
290
|
+
foxclaw init
|
|
291
|
+
foxclaw doctor
|
|
292
|
+
foxclaw start
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
如果 `~/.foxclaw/.env` 已经存在,`foxclaw init` 不会覆盖它。
|