@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.
@@ -0,0 +1,222 @@
1
+ # 故障排查
2
+
3
+ 先从这两条命令开始:
4
+
5
+ ```bash
6
+ foxclaw doctor
7
+ foxclaw status
8
+ ```
9
+
10
+ 如果 FoxClaw 是 Linux 用户级服务,再看:
11
+
12
+ ```bash
13
+ systemctl --user status foxclaw.service
14
+ journalctl --user -u foxclaw.service -f
15
+ ```
16
+
17
+ ## Doctor 检查失败
18
+
19
+ | 现象 | 含义 | 处理方式 |
20
+ | --- | --- | --- |
21
+ | `[FAIL] node >= 24` | 当前 shell 使用的是旧版 Node.js。 | 运行 `nvm install 24 && nvm use 24`,再重新执行 `foxclaw doctor`。如果服务仍用旧 Node,从 Node 24 的 shell 里重新执行 `foxclaw start`。 |
22
+ | `[FAIL] codex cli available` | `codex` 命令不在 PATH 里。 | 安装 Codex CLI 或修正 PATH,再确认 `codex --version` 可用。 |
23
+ | `[FAIL] telegram bot token configured` | `.env` 里缺少 `TG_BOT_TOKEN`。 | 从 `@BotFather` 复制 token,填入 `.env`。 |
24
+ | `[FAIL] telegram allowed user configured` | `.env` 里缺少 `TG_ALLOWED_USER_ID`。 | 从 `@userinfobot` 获取数字 ID,填入 `.env`。 |
25
+ | `[FAIL] default cwd exists` | `DEFAULT_CWD` 指向不存在的目录。 | 创建该目录,或把 `DEFAULT_CWD` 改成一个真实存在的绝对路径。 |
26
+
27
+ ## Node 或 npm 不存在
28
+
29
+ 如果看到 `node: command not found` 或 `npm: command not found`,用 `nvm` 安装 Node.js 24:
30
+
31
+ ```bash
32
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
33
+ export NVM_DIR="$HOME/.nvm"
34
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
35
+ nvm install 24
36
+ nvm use 24
37
+ node -v
38
+ npm -v
39
+ ```
40
+
41
+ 如果仍然失败,关闭终端,重新打开后运行:
42
+
43
+ ```bash
44
+ nvm use 24
45
+ ```
46
+
47
+ ## npm 权限错误
48
+
49
+ 如果 `npm install -g @openai/codex` 或 `npm install -g @foxden-app/foxclaw` 报 `EACCES`、`EPERM`、`permission denied`,说明当前全局 npm 目录不可写。
50
+
51
+ 推荐处理方式是通过 `nvm` 使用用户级 Node,然后重新安装:
52
+
53
+ ```bash
54
+ nvm install 24
55
+ nvm use 24
56
+ npm install -g @openai/codex
57
+ npm install -g @foxden-app/foxclaw
58
+ ```
59
+
60
+ 除非你很清楚本机 Node 的安装方式,否则不要直接混用 `sudo npm install -g ...`。`sudo`、系统 Node 和 `nvm` 混在一起,常见结果是 PATH 断掉或服务启动时找不到命令。
61
+
62
+ 如果 `codex` 已安装但 FoxClaw 找不到它,先定位二进制:
63
+
64
+ ```bash
65
+ command -v codex
66
+ ```
67
+
68
+ 然后把绝对路径写进 `.env`:
69
+
70
+ ```dotenv
71
+ CODEX_CLI_BIN=/absolute/path/to/codex
72
+ ```
73
+
74
+ ## Bot 没有回复
75
+
76
+ 按顺序检查:
77
+
78
+ 1. 确认 FoxClaw 正在运行:
79
+
80
+ ```bash
81
+ foxclaw status
82
+ ```
83
+
84
+ 2. 先用私聊测试。直接打开 bot 发:
85
+
86
+ ```text
87
+ /help
88
+ ```
89
+
90
+ 3. 确认 `TG_ALLOWED_USER_ID` 是你的 Telegram 数字 ID,不是 `@username`。
91
+
92
+ 4. 确认 `.env` 里的 bot token 属于你正在聊天的 bot。
93
+
94
+ 5. 修改 `.env` 后重启:
95
+
96
+ ```bash
97
+ foxclaw start
98
+ ```
99
+
100
+ 如果正在前台运行,先 `Ctrl+C` 停止,再重新运行 `foxclaw serve`。
101
+
102
+ ## 群组消息不生效
103
+
104
+ 私聊模式最简单。群组或话题模式请检查:
105
+
106
+ 1. 已把 bot 加入目标群组。
107
+ 2. 已在 `@BotFather` 里关闭 bot 的 `privacy mode`。
108
+ 3. 已把 bot 提升为群管理员。
109
+ 4. 如果是加群后才关闭隐私模式,先把 bot 踢出群再重新加入。
110
+ 5. 已配置 `TG_ALLOWED_CHAT_ID`,必要时也配置 `TG_ALLOWED_TOPIC_ID`。
111
+
112
+ `/status@botname` 这种显式命令有时会在隐私模式下仍然可用,所以验证群组配置时请用普通自然语言消息测试。
113
+
114
+ ## 获取群组或话题 ID
115
+
116
+ 1. 停掉 FoxClaw。
117
+ 2. 在目标群组或话题里发一条新消息。
118
+ 3. 浏览器打开:
119
+
120
+ ```text
121
+ https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
122
+ ```
123
+
124
+ 4. 用 `message.chat.id` 作为 `TG_ALLOWED_CHAT_ID`。
125
+ 5. 用 `message.message_thread_id` 作为 `TG_ALLOWED_TOPIC_ID`。
126
+
127
+ 如果 FoxClaw 还在运行,它可能会先消费这条 update,导致你在浏览器里看不到。
128
+
129
+ ## Telegram polling 冲突
130
+
131
+ 如果 Telegram 报 conflict,或者同一个 bot 行为异常,通常是两个进程在轮询同一个 bot token。
132
+
133
+ 检查新旧服务:
134
+
135
+ ```bash
136
+ systemctl --user is-active foxclaw.service
137
+ systemctl --user is-active telegram-codex-app-bridge.service 2>/dev/null || true
138
+ ```
139
+
140
+ 停掉旧服务:
141
+
142
+ ```bash
143
+ systemctl --user disable --now telegram-codex-app-bridge.service
144
+ ```
145
+
146
+ 然后重启 FoxClaw:
147
+
148
+ ```bash
149
+ foxclaw start
150
+ ```
151
+
152
+ ## Codex 或 app-server 异常
153
+
154
+ FoxClaw 需要本机 Codex 已登录。先检查命令:
155
+
156
+ ```bash
157
+ codex --version
158
+ ```
159
+
160
+ 如果没有登录:
161
+
162
+ ```bash
163
+ codex login
164
+ ```
165
+
166
+ `codex --version` 只证明命令存在。要验证认证真的可用,运行:
167
+
168
+ ```bash
169
+ codex
170
+ ```
171
+
172
+ 然后输入:
173
+
174
+ ```text
175
+ Say ready and exit.
176
+ ```
177
+
178
+ 如果你的 CLI 支持 `codex login status`,也可以一起看;但普通请求能成功回答才是最直接的验证。
179
+
180
+ FoxClaw app-server 日志默认在:
181
+
182
+ ```bash
183
+ tail -f ~/.foxclaw/logs/codex-app-server.log
184
+ ```
185
+
186
+ Bridge 日志默认在:
187
+
188
+ ```bash
189
+ tail -f ~/.foxclaw/logs/service.log
190
+ ```
191
+
192
+ ## 服务用了错误的 Node 版本
193
+
194
+ systemd 安装脚本会记录当时 PATH 里的 `node`。如果你从 Node 22 或更旧版本的 shell 里安装过服务,请从 Node 24 的 shell 重新安装:
195
+
196
+ ```bash
197
+ nvm use 24
198
+ foxclaw start
199
+ systemctl --user status foxclaw.service
200
+ ```
201
+
202
+ 状态输出里应该能看到 Node 24 的路径。
203
+
204
+ ## 重启后是否会自动运行
205
+
206
+ Linux 用户级 systemd:
207
+
208
+ ```bash
209
+ systemctl --user is-enabled foxclaw.service
210
+ ```
211
+
212
+ `enabled` 表示会随用户会话启动。如果希望机器重启后未登录也启动用户服务:
213
+
214
+ ```bash
215
+ loginctl enable-linger "$USER"
216
+ ```
217
+
218
+ macOS 上,运行过下面命令后,FoxClaw 会在你登录时由 launchd 启动:
219
+
220
+ ```bash
221
+ foxclaw start
222
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxden-app/foxclaw",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Foxden local execution claw for controlling Codex from trusted chat interfaces.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",