@foxden-app/foxclaw 0.2.4 → 0.2.5
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 +84 -82
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,36 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
# FoxClaw
|
|
4
4
|
|
|
5
|
-
FoxClaw 是 Foxden agents
|
|
5
|
+
FoxClaw 是 Foxden agents 的本地执行爪——跑在你自己电脑上,让你通过 Telegram 或微信远程操控本机的 Codex。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
不需要公网服务器。FoxClaw 在本地和 `codex app-server` 通信,审批在你电脑上完成,结果推送回手机。
|
|
8
8
|
|
|
9
9
|
## 从这里开始
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
11
|
+
- 手头有 Codex、OpenClaw、QwenPaw、Hermes、OpenCode、Kimi CLI 之类能跑 shell 的 agent?推荐走 [Agent 辅助安装](./docs/agent-assisted-install.md)。
|
|
12
|
+
- 对 Node、Telegram 机器人、Codex CLI 不太熟?看 [新手安装指南](./docs/install-for-beginners.md)。
|
|
13
|
+
- Git、Node、`.env` 都玩得转?直接往下看快速设置。
|
|
14
|
+
- 卡住了?看 [故障排查](./docs/troubleshooting.md)。
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
FoxClaw 适合这些场景:
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
18
|
+
- 在手机上用 Codex,但不想把电脑暴露到公网
|
|
19
|
+
- 代码、shell、认证、审批、运行数据全部留在本机
|
|
20
|
+
- 只允许一个受信任的 Telegram 用户远程操作
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
最低要求:一个 Telegram bot token、你的 Telegram 数字用户 ID、Node.js 24、一份已登录的 `codex` CLI。首次安装大约 10–20 分钟。
|
|
23
23
|
|
|
24
|
-
30
|
|
24
|
+
**30 秒体验**:启动 FoxClaw 后,给你的 Telegram 机器人发一句 `List files in DEFAULT_CWD`。Codex 会在本地检查那个目录,然后把结果发回 Telegram。
|
|
25
25
|
|
|
26
26
|
## 环境要求
|
|
27
27
|
|
|
28
|
-
- macOS 或 Linux
|
|
29
|
-
-
|
|
28
|
+
- macOS 或 Linux,`codex` CLI 可用
|
|
29
|
+
- Codex 已完成登录认证
|
|
30
30
|
- Node.js 24+
|
|
31
|
-
-
|
|
31
|
+
- 一个 `@BotFather` 创建的 Telegram bot token
|
|
32
32
|
- 你的 Telegram 数字用户 ID
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## 快速设置
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
npm install -g @foxden-app/foxclaw
|
|
@@ -41,7 +41,7 @@ foxclaw doctor
|
|
|
41
41
|
foxclaw start
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
pnpm
|
|
44
|
+
pnpm 用户:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
47
|
pnpm add -g @foxden-app/foxclaw
|
|
@@ -51,7 +51,7 @@ foxclaw doctor
|
|
|
51
51
|
foxclaw start
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
跑 `doctor` 或 `start` 之前先把 `.env` 填好。私聊模式最小配置:
|
|
55
55
|
|
|
56
56
|
```dotenv
|
|
57
57
|
TG_BOT_TOKEN=123456:telegram-token
|
|
@@ -61,66 +61,68 @@ DEFAULT_APPROVAL_POLICY=on-request
|
|
|
61
61
|
DEFAULT_SANDBOX_MODE=workspace-write
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
配置文件默认在 `~/.foxclaw/.env`。想放别处的话设 `FOXCLAW_ENV=/path/to/.env`。
|
|
65
65
|
|
|
66
|
-
`foxclaw start`
|
|
66
|
+
`foxclaw start` 会自动检查环境并安装/重启后台服务,幂等操作,升级后再跑一次就行。
|
|
67
67
|
|
|
68
|
-
FoxClaw
|
|
68
|
+
FoxClaw 只响应 `TG_ALLOWED_USER_ID` 的消息——把机器人拉进群不代表群里所有人都能用。
|
|
69
69
|
|
|
70
70
|
<details>
|
|
71
|
-
<summary>FoxClaw
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
- Codex
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
- Skills、MCP、hooks、plugins、apps、feature flags、config、requirements
|
|
83
|
-
-
|
|
84
|
-
-
|
|
71
|
+
<summary>FoxClaw 能做什么</summary>
|
|
72
|
+
|
|
73
|
+
- 单个 Telegram 用户通过私聊、群组、话题控制
|
|
74
|
+
- 可选微信/iLink 通道,复用同一套桥接核心
|
|
75
|
+
- `/threads`、`/open`、`/new`、`/where`、`/interrupt`——稳定的聊天-线程绑定
|
|
76
|
+
- 手机上管理线程生命周期:重命名、归档、取消归档、fork、回滚、compact、review、diff
|
|
77
|
+
- 每个聊天独立的设置面板:模型、reasoning effort、Fast tier、access preset、Agent/Plan 模式、active-turn 行为
|
|
78
|
+
- Codex 账户管理:`/account`、`/quota`、`/login_device`、`/login_cancel`、`/auth add <name>`、`/logout confirm`
|
|
79
|
+
- 触发用量限制时自动在本地 `auth.json_*` 之间切换认证
|
|
80
|
+
- 命令、文件变更、细粒度权限审批的内联按钮
|
|
81
|
+
- MCP elicitation 卡片——工具在 turn 中提出结构化问题时展示
|
|
82
|
+
- Skills、MCP、hooks、plugins、apps、feature flags、config、requirements、provider diagnostics
|
|
83
|
+
- SQLite 持久化:绑定、offset、审批、待处理提示、审计日志
|
|
84
|
+
- 单实例进程锁,防止同一 bot token 重复 polling
|
|
85
85
|
|
|
86
86
|
</details>
|
|
87
87
|
|
|
88
88
|
## 服务与调试
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
推荐方式:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
foxclaw start
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
Linux 上会安装/重启用户级 systemd 服务,macOS 上安装/重载 launchd。查看状态:
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
systemctl --user status foxclaw.service
|
|
100
100
|
journalctl --user -u foxclaw.service -f
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
需要前台调试时:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
foxclaw serve
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
运行时文件默认在 `~/.foxclaw`:
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
| 用途 | 路径 |
|
|
112
|
+
|------|------|
|
|
113
|
+
| 数据库 | `~/.foxclaw/data/bridge.sqlite` |
|
|
114
|
+
| Bridge 日志 | `~/.foxclaw/logs/service.log` |
|
|
115
|
+
| 状态 | `~/.foxclaw/runtime/status.json` |
|
|
116
|
+
| App-server 状态 | `~/.foxclaw/runtime/codex-app-server.json` |
|
|
117
|
+
| App-server 日志 | `~/.foxclaw/logs/codex-app-server.log` |
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
可通过 `STORE_PATH`、`LOCK_PATH`、`CODEX_APP_SERVER_STATE_PATH`、`CODEX_APP_SERVER_LOG_PATH` 覆盖。
|
|
118
120
|
|
|
119
121
|
## 从 telegram-codex-app-bridge 迁移
|
|
120
122
|
|
|
121
|
-
FoxClaw 最初 fork 自 `Gan-Xing/telegram-codex-app-bridge
|
|
123
|
+
FoxClaw 最初 fork 自 `Gan-Xing/telegram-codex-app-bridge`,继续以 MIT License 分发。
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
升级已有安装:
|
|
124
126
|
|
|
125
127
|
```bash
|
|
126
128
|
systemctl --user disable --now telegram-codex-app-bridge.service 2>/dev/null || true
|
|
@@ -128,54 +130,54 @@ test -e ~/.foxclaw || cp -a ~/.telegram-codex-app-bridge ~/.foxclaw
|
|
|
128
130
|
foxclaw start
|
|
129
131
|
```
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
macOS launchd 用户先卸载旧 plist:
|
|
132
134
|
|
|
133
135
|
```bash
|
|
134
136
|
launchctl unload ~/Library/LaunchAgents/com.ganxing.telegram-codex-app-bridge.plist 2>/dev/null || true
|
|
135
137
|
foxclaw start
|
|
136
138
|
```
|
|
137
139
|
|
|
138
|
-
|
|
140
|
+
旧目录不会被自动读取。如果要保留已有的绑定、线程缓存、审批和状态数据,手动复制一次即可。
|
|
139
141
|
|
|
140
142
|
## Telegram 设置
|
|
141
143
|
|
|
142
|
-
1.
|
|
143
|
-
2.
|
|
144
|
-
3.
|
|
145
|
-
4.
|
|
144
|
+
1. 用 `@BotFather` 创建机器人,token 填入 `TG_BOT_TOKEN`。
|
|
145
|
+
2. 拿到你的 Telegram 数字用户 ID,填入 `TG_ALLOWED_USER_ID`。
|
|
146
|
+
3. `foxclaw start` 启动。
|
|
147
|
+
4. 打开和机器人的私聊,发 `/help`。
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
可选——群组/话题配置:
|
|
148
150
|
|
|
149
151
|
```dotenv
|
|
150
152
|
TG_ALLOWED_CHAT_ID=-1001234567890
|
|
151
153
|
TG_ALLOWED_TOPIC_ID=42
|
|
152
154
|
```
|
|
153
155
|
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
156
|
+
- `TG_ALLOWED_CHAT_ID` 留空 → 纯私聊模式。
|
|
157
|
+
- 只填 `TG_ALLOWED_CHAT_ID` → 允许一个群组作为默认会话范围。
|
|
158
|
+
- 两个都填 → 绑定到某个话题。
|
|
159
|
+
- 配了群组后,`TG_ALLOWED_USER_ID` 的私聊依然可用。
|
|
158
160
|
|
|
159
|
-
|
|
161
|
+
**怎么找群组和话题 ID:**
|
|
160
162
|
|
|
161
|
-
1.
|
|
162
|
-
2.
|
|
163
|
-
3.
|
|
164
|
-
4.
|
|
165
|
-
5.
|
|
163
|
+
1. 先停掉 FoxClaw。
|
|
164
|
+
2. 在目标群组/话题里发一条消息。
|
|
165
|
+
3. 浏览器打开 `https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates`。
|
|
166
|
+
4. 找 `message.chat.id` → 填 `TG_ALLOWED_CHAT_ID`。
|
|
167
|
+
5. 找 `message.message_thread_id` → 填 `TG_ALLOWED_TOPIC_ID`。
|
|
166
168
|
|
|
167
|
-
如果 FoxClaw
|
|
169
|
+
> 如果 FoxClaw 还在跑,它可能会先把这条 update 消费掉,所以要先停。
|
|
168
170
|
|
|
169
171
|
## Telegram 群组检查清单
|
|
170
172
|
|
|
171
|
-
|
|
173
|
+
要让机器人在群组/超级群里收到普通消息:
|
|
172
174
|
|
|
173
|
-
1.
|
|
174
|
-
2. 在 `@BotFather`
|
|
175
|
-
3.
|
|
176
|
-
4.
|
|
175
|
+
1. 把机器人加进目标群组。
|
|
176
|
+
2. 在 `@BotFather` 里关掉 `privacy mode`。
|
|
177
|
+
3. 把机器人设为群管理员。
|
|
178
|
+
4. 如果是加群之后才改的隐私模式,把机器人踢出去再重新加。
|
|
177
179
|
|
|
178
|
-
|
|
180
|
+
> 注意:即使 privacy mode 挡住了普通消息,`/status@botname` 这种显式命令可能还是能用的。所以验证群组设置时,请用一条普通文本消息测试。
|
|
179
181
|
|
|
180
182
|
## Codex App-Server 生命周期
|
|
181
183
|
|
|
@@ -190,14 +192,14 @@ CODEX_APP_SYNC_ON_OPEN=true
|
|
|
190
192
|
CODEX_APP_SYNC_ON_TURN_COMPLETE=false
|
|
191
193
|
```
|
|
192
194
|
|
|
193
|
-
FoxClaw 会把 `codex app-server`
|
|
195
|
+
FoxClaw 会把 `codex app-server` 作为 detached 子进程启动,记录其 pid 和端口。重启时如果进程还活着就直接重连,否则拉起新进程。`/auth_reload` 和认证切换会重启 app-server 以重新加载 `auth.json`。
|
|
194
196
|
|
|
195
|
-
|
|
197
|
+
一般不需要手动固定 app-server 端口。
|
|
196
198
|
|
|
197
199
|
## 命令
|
|
198
200
|
|
|
199
201
|
- `/help`
|
|
200
|
-
- `/setup`
|
|
202
|
+
- `/setup` — 统一设置面板
|
|
201
203
|
- `/fast <on|off|toggle>`
|
|
202
204
|
- `/active <steer|queue>`
|
|
203
205
|
- `/status`、`/account`、`/quota`
|
|
@@ -215,35 +217,35 @@ FoxClaw 会把 `codex app-server` 启动为一个由 bridge 管理的 detached
|
|
|
215
217
|
- `/skills [query]`、`/skill <name>`、`/skill_enable <name>`、`/skill_disable <name>`
|
|
216
218
|
- `/loaded`、`/hooks`、`/plugins [query]`、`/apps [reload]`、`/features`、`/config`、`/requirements`、`/provider`
|
|
217
219
|
- `/mcp`、`/mcp_reload`、`/mcp_login <server>`、`/mcp_resource <server> <uri>`
|
|
218
|
-
- `/models`、`/model`、`/effort`、`/permissions`、`/access`、`/mode`、`/plan
|
|
220
|
+
- `/models`、`/model`、`/effort`、`/permissions`、`/access`、`/mode`、`/plan`、`/agent`
|
|
219
221
|
- `/reveal`、`/where`、`/interrupt`
|
|
220
222
|
|
|
221
|
-
|
|
223
|
+
直接发文本会送到当前线程;没有绑定线程时自动创建新线程。
|
|
222
224
|
|
|
223
225
|
## 微信/iLink
|
|
224
226
|
|
|
225
|
-
|
|
227
|
+
微信支持默认关闭,需要手动开启:
|
|
226
228
|
|
|
227
229
|
```dotenv
|
|
228
230
|
WX_ENABLED=true
|
|
229
231
|
WX_ALLOWED_ILINK_USER_IDS=
|
|
230
232
|
```
|
|
231
233
|
|
|
232
|
-
|
|
234
|
+
构建完成后跑一次二维码登录:
|
|
233
235
|
|
|
234
236
|
```bash
|
|
235
237
|
foxclaw weixin-login
|
|
236
238
|
```
|
|
237
239
|
|
|
238
|
-
|
|
240
|
+
微信运行时文件在 `~/.foxclaw/weixin`。
|
|
239
241
|
|
|
240
242
|
## Codex Skill
|
|
241
243
|
|
|
242
|
-
|
|
244
|
+
仓库自带一个 Codex skill:[`skills/foxclaw`](./skills/foxclaw)。用它可以让 Codex 通过 SSH 在本机或远程 Mac 上 bootstrap FoxClaw——写 `.env`、构建、跑 doctor、装 launchd、引导首次消息验证,一条龙。
|
|
243
245
|
|
|
244
246
|
## 故障排查
|
|
245
247
|
|
|
246
|
-
`doctor`
|
|
248
|
+
`doctor` 报错、Telegram 没回复、服务日志看不懂、重启行为异常、迁移出问题——都看 [故障排查](./docs/troubleshooting.md)。
|
|
247
249
|
|
|
248
250
|
## 运维命令
|
|
249
251
|
|
|
@@ -256,4 +258,4 @@ foxclaw uninstall-systemd
|
|
|
256
258
|
|
|
257
259
|
## 贡献
|
|
258
260
|
|
|
259
|
-
|
|
261
|
+
欢迎到 [GitHub](https://github.com/foxden-app/foxclaw) 提 issue 和 PR。
|