@foxden-app/foxclaw 0.2.0

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 (126) hide show
  1. package/.env.example +36 -0
  2. package/LICENSE +22 -0
  3. package/README.md +244 -0
  4. package/README_EN.md +244 -0
  5. package/dist/channels/bridge_messaging_router.d.ts +27 -0
  6. package/dist/channels/bridge_messaging_router.js +85 -0
  7. package/dist/channels/telegram/telegram_channel_adapter.d.ts +12 -0
  8. package/dist/channels/telegram/telegram_channel_adapter.js +21 -0
  9. package/dist/channels/telegram/telegram_messaging_port.d.ts +25 -0
  10. package/dist/channels/telegram/telegram_messaging_port.js +51 -0
  11. package/dist/channels/weixin/account_store.d.ts +15 -0
  12. package/dist/channels/weixin/account_store.js +54 -0
  13. package/dist/channels/weixin/ilink/aes_ecb.d.ts +3 -0
  14. package/dist/channels/weixin/ilink/aes_ecb.js +12 -0
  15. package/dist/channels/weixin/ilink/api.d.ts +44 -0
  16. package/dist/channels/weixin/ilink/api.js +187 -0
  17. package/dist/channels/weixin/ilink/cdn_upload.d.ts +11 -0
  18. package/dist/channels/weixin/ilink/cdn_upload.js +60 -0
  19. package/dist/channels/weixin/ilink/cdn_url.d.ts +7 -0
  20. package/dist/channels/weixin/ilink/cdn_url.js +7 -0
  21. package/dist/channels/weixin/ilink/constants.d.ts +7 -0
  22. package/dist/channels/weixin/ilink/constants.js +27 -0
  23. package/dist/channels/weixin/ilink/context.d.ts +13 -0
  24. package/dist/channels/weixin/ilink/context.js +13 -0
  25. package/dist/channels/weixin/ilink/login_qr.d.ts +34 -0
  26. package/dist/channels/weixin/ilink/login_qr.js +233 -0
  27. package/dist/channels/weixin/ilink/media_image.d.ts +11 -0
  28. package/dist/channels/weixin/ilink/media_image.js +44 -0
  29. package/dist/channels/weixin/ilink/mime.d.ts +3 -0
  30. package/dist/channels/weixin/ilink/mime.js +36 -0
  31. package/dist/channels/weixin/ilink/pic_decrypt.d.ts +2 -0
  32. package/dist/channels/weixin/ilink/pic_decrypt.js +56 -0
  33. package/dist/channels/weixin/ilink/random.d.ts +2 -0
  34. package/dist/channels/weixin/ilink/random.js +7 -0
  35. package/dist/channels/weixin/ilink/redact.d.ts +4 -0
  36. package/dist/channels/weixin/ilink/redact.js +34 -0
  37. package/dist/channels/weixin/ilink/runtime_attach.d.ts +3 -0
  38. package/dist/channels/weixin/ilink/runtime_attach.js +13 -0
  39. package/dist/channels/weixin/ilink/send.d.ts +21 -0
  40. package/dist/channels/weixin/ilink/send.js +108 -0
  41. package/dist/channels/weixin/ilink/session_guard.d.ts +6 -0
  42. package/dist/channels/weixin/ilink/session_guard.js +39 -0
  43. package/dist/channels/weixin/ilink/types.d.ts +155 -0
  44. package/dist/channels/weixin/ilink/types.js +10 -0
  45. package/dist/channels/weixin/ilink/upload.d.ts +15 -0
  46. package/dist/channels/weixin/ilink/upload.js +75 -0
  47. package/dist/channels/weixin/sync_buf_store.d.ts +3 -0
  48. package/dist/channels/weixin/sync_buf_store.js +19 -0
  49. package/dist/channels/weixin/weixin_channel_adapter.d.ts +18 -0
  50. package/dist/channels/weixin/weixin_channel_adapter.js +273 -0
  51. package/dist/channels/weixin/weixin_messaging_port.d.ts +29 -0
  52. package/dist/channels/weixin/weixin_messaging_port.js +113 -0
  53. package/dist/codex_app/client.d.ts +176 -0
  54. package/dist/codex_app/client.js +1230 -0
  55. package/dist/codex_app/deeplink.d.ts +7 -0
  56. package/dist/codex_app/deeplink.js +29 -0
  57. package/dist/codex_app/local_usage.d.ts +16 -0
  58. package/dist/codex_app/local_usage.js +123 -0
  59. package/dist/config.d.ts +44 -0
  60. package/dist/config.js +131 -0
  61. package/dist/controller/access.d.ts +11 -0
  62. package/dist/controller/access.js +33 -0
  63. package/dist/controller/activity.d.ts +62 -0
  64. package/dist/controller/activity.js +330 -0
  65. package/dist/controller/commands.d.ts +6 -0
  66. package/dist/controller/commands.js +17 -0
  67. package/dist/controller/controller.d.ts +326 -0
  68. package/dist/controller/controller.js +7503 -0
  69. package/dist/controller/observer.d.ts +16 -0
  70. package/dist/controller/observer.js +98 -0
  71. package/dist/controller/presentation.d.ts +80 -0
  72. package/dist/controller/presentation.js +568 -0
  73. package/dist/controller/service_tier.d.ts +9 -0
  74. package/dist/controller/service_tier.js +32 -0
  75. package/dist/controller/session_observer.d.ts +22 -0
  76. package/dist/controller/session_observer.js +259 -0
  77. package/dist/controller/status.d.ts +10 -0
  78. package/dist/controller/status.js +28 -0
  79. package/dist/core/bridge_scope.d.ts +18 -0
  80. package/dist/core/bridge_scope.js +46 -0
  81. package/dist/core/channel_port.d.ts +15 -0
  82. package/dist/core/channel_port.js +1 -0
  83. package/dist/i18n.d.ts +1108 -0
  84. package/dist/i18n.js +1154 -0
  85. package/dist/lock.d.ts +7 -0
  86. package/dist/lock.js +80 -0
  87. package/dist/logger.d.ts +12 -0
  88. package/dist/logger.js +57 -0
  89. package/dist/main.d.ts +2 -0
  90. package/dist/main.js +236 -0
  91. package/dist/runtime.d.ts +3 -0
  92. package/dist/runtime.js +14 -0
  93. package/dist/store/database.d.ts +79 -0
  94. package/dist/store/database.js +489 -0
  95. package/dist/store/migrate_bridge_scope.d.ts +6 -0
  96. package/dist/store/migrate_bridge_scope.js +59 -0
  97. package/dist/telegram/addressing.d.ts +33 -0
  98. package/dist/telegram/addressing.js +57 -0
  99. package/dist/telegram/api.d.ts +14 -0
  100. package/dist/telegram/api.js +89 -0
  101. package/dist/telegram/gateway.d.ts +76 -0
  102. package/dist/telegram/gateway.js +383 -0
  103. package/dist/telegram/media.d.ts +34 -0
  104. package/dist/telegram/media.js +180 -0
  105. package/dist/telegram/rendering.d.ts +10 -0
  106. package/dist/telegram/rendering.js +21 -0
  107. package/dist/telegram/scope.d.ts +6 -0
  108. package/dist/telegram/scope.js +24 -0
  109. package/dist/telegram/text.d.ts +7 -0
  110. package/dist/telegram/text.js +47 -0
  111. package/dist/types.d.ts +343 -0
  112. package/dist/types.js +1 -0
  113. package/docs/agent-assisted-install.md +84 -0
  114. package/docs/install-for-beginners.md +287 -0
  115. package/docs/troubleshooting.md +239 -0
  116. package/package.json +62 -0
  117. package/scripts/doctor.sh +3 -0
  118. package/scripts/launchd/install.sh +54 -0
  119. package/scripts/status.sh +3 -0
  120. package/scripts/systemd/install.sh +83 -0
  121. package/scripts/systemd/uninstall.sh +15 -0
  122. package/skills/foxclaw/SKILL.md +167 -0
  123. package/skills/foxclaw/agents/openai.yaml +4 -0
  124. package/skills/foxclaw/references/telegram-setup.md +93 -0
  125. package/skills/foxclaw/scripts/bootstrap_host.py +350 -0
  126. package/skills/foxclaw/scripts/bootstrap_remote.py +67 -0
@@ -0,0 +1,84 @@
1
+ # Agent-Assisted Install
2
+
3
+ If you already have a shell-capable coding agent on the target computer, use this path first. It is the fastest and least error-prone way to install FoxClaw.
4
+
5
+ This works well with Codex, OpenClaw, QwenPaw, Hermes, OpenCode, Kimi CLI, or any agent that can inspect the machine, run shell commands, edit files, and report blockers.
6
+
7
+ ## What You Need To Provide
8
+
9
+ Prepare these values before asking the agent:
10
+
11
+ - `TG_BOT_TOKEN`: Telegram bot token from `@BotFather`
12
+ - `TG_ALLOWED_USER_ID`: your numeric Telegram user id
13
+ - `DEFAULT_CWD`: the folder where Codex should work
14
+
15
+ Optional later:
16
+
17
+ - `TG_ALLOWED_CHAT_ID`
18
+ - `TG_ALLOWED_TOPIC_ID`
19
+
20
+ Use private Telegram chat first. Configure groups/topics only after private chat works.
21
+
22
+ ## Copy-Paste Prompt
23
+
24
+ Send this to your agent on the target computer:
25
+
26
+ ```text
27
+ Install FoxClaw on this machine.
28
+
29
+ Repository:
30
+ https://github.com/foxden-app/foxclaw.git
31
+
32
+ Use private Telegram chat first. Do not configure group/topic mode unless I explicitly provide TG_ALLOWED_CHAT_ID or TG_ALLOWED_TOPIC_ID.
33
+
34
+ Here are the required values:
35
+ TG_BOT_TOKEN=<paste token here>
36
+ TG_ALLOWED_USER_ID=<paste numeric Telegram user id here>
37
+ DEFAULT_CWD=<paste absolute working directory here>
38
+
39
+ Tasks:
40
+ 1. Inspect the machine first. Do not overwrite local changes if a FoxClaw or old telegram-codex-app-bridge repo already exists.
41
+ 2. Ensure Node.js 24+ is available. If not, install or activate Node 24 with nvm.
42
+ 3. Ensure the Codex CLI exists and is logged in. If login is required, stop and tell me exactly what I need to do.
43
+ 4. Clone or update https://github.com/foxden-app/foxclaw.git.
44
+ 5. Write a local .env. Never commit .env.
45
+ 6. Run npm install, npm run build, and npm run doctor.
46
+ 7. Start FoxClaw in the foreground first and ask me to send /help and /status to the Telegram bot.
47
+ 8. Only after the foreground test works, install the background service:
48
+ - Linux: npm run install-systemd
49
+ - macOS: ./scripts/launchd/install.sh
50
+ 9. Verify the final state:
51
+ - foxclaw.service is active/enabled on Linux
52
+ - old telegram-codex-app-bridge.service is inactive/disabled if present
53
+ - npm run status works
54
+ 10. Report the commands used, the final status, and the log command I should use if something stops working. Redact TG_BOT_TOKEN and never print the full token or full .env content.
55
+ ```
56
+
57
+ ## Migration Prompt For Old Installs
58
+
59
+ Use this when the target computer is still running `telegram-codex-app-bridge`:
60
+
61
+ ```text
62
+ Migrate this machine from telegram-codex-app-bridge to FoxClaw.
63
+
64
+ New repository:
65
+ https://github.com/foxden-app/foxclaw.git
66
+
67
+ Please:
68
+ 1. Check git status before changing the repo. If there are uncommitted local changes, stop and report them.
69
+ 2. Stop and disable telegram-codex-app-bridge.service if it exists.
70
+ 3. If ~/.foxclaw does not exist and ~/.telegram-codex-app-bridge exists, copy ~/.telegram-codex-app-bridge to ~/.foxclaw.
71
+ 4. Update the source repo to https://github.com/foxden-app/foxclaw.git and pull main.
72
+ 5. Run npm install, npm run build, npm run doctor.
73
+ 6. Install and start foxclaw.service with npm run install-systemd.
74
+ 7. Verify foxclaw.service is active and telegram-codex-app-bridge.service is inactive/disabled.
75
+ 8. Report final status and any blockers. Redact TG_BOT_TOKEN and never print the full token or full .env content.
76
+ ```
77
+
78
+ ## Safety Notes
79
+
80
+ - Do not paste bot tokens into public issue trackers or public chat logs.
81
+ - Do not commit `.env`.
82
+ - When reporting results, redact `TG_BOT_TOKEN`.
83
+ - Do not use `/` or your whole home directory as `DEFAULT_CWD` for a first install.
84
+ - Do not install the background service before the foreground Telegram test works.
@@ -0,0 +1,287 @@
1
+ # Beginner Install Guide
2
+
3
+ This guide is for a first FoxClaw install. It assumes you can open a terminal and paste commands, but it does not assume you already know Node.js, Telegram bots, or Codex CLI.
4
+
5
+ FoxClaw runs on your own computer. Your phone talks to a Telegram bot, the bot talks to FoxClaw, and FoxClaw talks to local Codex. You do not need a public server.
6
+
7
+ If you already have a shell-capable agent such as Codex, OpenClaw, QwenPaw, Hermes, OpenCode, or Kimi CLI on this computer, use [Agent-Assisted Install](./agent-assisted-install.md) first. It is the recommended path.
8
+
9
+ Before you start:
10
+
11
+ - Do not configure a Telegram group first. Use private chat first.
12
+ - Do not send your bot token to anyone you do not trust.
13
+ - Do not use `/`, `/Users`, `/home`, or your whole home directory as `DEFAULT_CWD` for the first install.
14
+ - Do not install the background service until foreground mode replies to `/help` and `/status`.
15
+
16
+ ## 1. Prepare
17
+
18
+ You need:
19
+
20
+ - a macOS or Linux computer that can stay on while you use FoxClaw
21
+ - a Telegram account
22
+ - a Codex account
23
+ - a folder where Codex can work, for example `~/Projects` or `~/Desktop`
24
+ - about 10-20 minutes for the first setup
25
+
26
+ Use private chat first. Group and topic setup can wait until the bot replies reliably.
27
+
28
+ ## 2. Install Node.js 24
29
+
30
+ FoxClaw needs Node.js 24 because it uses the built-in SQLite runtime.
31
+
32
+ If you already have Node 24, this should print `v24...`:
33
+
34
+ ```bash
35
+ node -v
36
+ ```
37
+
38
+ If not, install Node 24 with `nvm`:
39
+
40
+ ```bash
41
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
42
+ export NVM_DIR="$HOME/.nvm"
43
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
44
+ nvm install 24
45
+ nvm use 24
46
+ node -v
47
+ npm -v
48
+ ```
49
+
50
+ If `node -v` still shows an old version, close the terminal, open a new one, and run:
51
+
52
+ ```bash
53
+ nvm use 24
54
+ ```
55
+
56
+ ## 3. Install And Log In To Codex
57
+
58
+ FoxClaw does not create a Codex account. It uses the Codex CLI already logged in on this computer.
59
+
60
+ Install the Codex CLI if you do not already have it:
61
+
62
+ ```bash
63
+ npm install -g @openai/codex
64
+ ```
65
+
66
+ If this fails with `EACCES` or `permission denied`, stop and check [Troubleshooting](./troubleshooting.md). Do not keep retrying with random `sudo` commands.
67
+
68
+ Log in:
69
+
70
+ ```bash
71
+ codex login
72
+ ```
73
+
74
+ Check the CLI exists:
75
+
76
+ ```bash
77
+ codex --version
78
+ ```
79
+
80
+ `codex --version` only proves the command exists. To verify Codex auth actually works, start Codex and run one tiny request:
81
+
82
+ ```bash
83
+ codex
84
+ ```
85
+
86
+ Ask it:
87
+
88
+ ```text
89
+ Say ready and exit.
90
+ ```
91
+
92
+ If your Codex CLI supports `codex login status`, you can also use it, but the real test is that Codex can answer a normal prompt without asking you to log in again.
93
+
94
+ ## 4. Create A Telegram Bot
95
+
96
+ 1. Open Telegram.
97
+ 2. Search for `@BotFather`.
98
+ 3. Send `/newbot`.
99
+ 4. Follow the prompts and choose a bot name.
100
+ 5. Copy the bot token. It looks like `123456789:AA...`.
101
+
102
+ Keep this token private. Anyone with the token can control that Telegram bot.
103
+
104
+ ## 5. Get Your Numeric Telegram User ID
105
+
106
+ FoxClaw only accepts messages from one configured Telegram user.
107
+
108
+ The easiest path:
109
+
110
+ 1. Open Telegram.
111
+ 2. Search for `@userinfobot`.
112
+ 3. Send it any message or press Start.
113
+ 4. Copy the numeric `Id`.
114
+
115
+ Use the number, not your `@username`.
116
+
117
+ ## 6. Download FoxClaw
118
+
119
+ Choose a stable folder and clone the repo:
120
+
121
+ ```bash
122
+ git clone https://github.com/foxden-app/foxclaw.git
123
+ cd foxclaw
124
+ npm install
125
+ cp .env.example .env
126
+ ```
127
+
128
+ ## 7. Fill In `.env`
129
+
130
+ Open `.env` in a simple editor:
131
+
132
+ ```bash
133
+ nano .env
134
+ ```
135
+
136
+ For a first private-chat install, fill only the important values:
137
+
138
+ ```dotenv
139
+ TG_BOT_TOKEN=123456789:replace_with_your_bot_token
140
+ TG_ALLOWED_USER_ID=123456789
141
+ TG_ALLOWED_CHAT_ID=
142
+ TG_ALLOWED_TOPIC_ID=
143
+ DEFAULT_CWD=/absolute/path/to/a/folder
144
+ DEFAULT_APPROVAL_POLICY=on-request
145
+ DEFAULT_SANDBOX_MODE=workspace-write
146
+ ```
147
+
148
+ Keep `TG_ALLOWED_CHAT_ID=` and `TG_ALLOWED_TOPIC_ID=` empty for the first install. Do not delete those lines; leaving them empty means private-chat mode.
149
+
150
+ `DEFAULT_CWD` must be a real folder. Examples:
151
+
152
+ ```dotenv
153
+ DEFAULT_CWD=/Users/alice/Desktop
154
+ DEFAULT_CWD=/home/alice/projects
155
+ ```
156
+
157
+ In `nano`, press `Ctrl+O`, Enter, then `Ctrl+X` to save and exit.
158
+
159
+ ## 8. Run The First Check
160
+
161
+ Build and run doctor:
162
+
163
+ ```bash
164
+ npm run build
165
+ npm run doctor
166
+ ```
167
+
168
+ You want to see:
169
+
170
+ ```text
171
+ [OK] node >= 24
172
+ [OK] codex cli available
173
+ [OK] telegram bot token configured
174
+ [OK] telegram allowed user configured
175
+ [OK] default cwd exists
176
+ ```
177
+
178
+ If you see `[FAIL]`, stop and check [Troubleshooting](./troubleshooting.md).
179
+
180
+ ## 9. Start In The Foreground First
181
+
182
+ Run FoxClaw directly before installing it as a background service:
183
+
184
+ ```bash
185
+ npm run serve
186
+ ```
187
+
188
+ Leave this terminal open.
189
+
190
+ Now open your Telegram bot and send:
191
+
192
+ ```text
193
+ /help
194
+ ```
195
+
196
+ If it replies, send:
197
+
198
+ ```text
199
+ /status
200
+ ```
201
+
202
+ Then try a normal request, for example:
203
+
204
+ ```text
205
+ List the files in the current working directory.
206
+ ```
207
+
208
+ Good first messages to try:
209
+
210
+ ```text
211
+ /setup
212
+ ```
213
+
214
+ ```text
215
+ List files in DEFAULT_CWD.
216
+ ```
217
+
218
+ ```text
219
+ Create a short README-style summary of this folder.
220
+ ```
221
+
222
+ ```text
223
+ /interrupt
224
+ ```
225
+
226
+ Stop the foreground process with `Ctrl+C` after the bot works.
227
+
228
+ ## 10. Install As A Background Service
229
+
230
+ Only do this after foreground mode works.
231
+
232
+ On Linux with systemd:
233
+
234
+ ```bash
235
+ npm run install-systemd
236
+ systemctl --user status foxclaw.service
237
+ journalctl --user -u foxclaw.service -f
238
+ ```
239
+
240
+ The service starts again when your user session starts. If you need it to start after reboot before you log in, run:
241
+
242
+ ```bash
243
+ loginctl enable-linger "$USER"
244
+ ```
245
+
246
+ On macOS:
247
+
248
+ ```bash
249
+ ./scripts/launchd/install.sh
250
+ ```
251
+
252
+ launchd starts FoxClaw when you log in.
253
+
254
+ ## 11. Day-To-Day Commands
255
+
256
+ Check current status:
257
+
258
+ ```bash
259
+ npm run status
260
+ ```
261
+
262
+ Restart Linux service after changing `.env`:
263
+
264
+ ```bash
265
+ systemctl --user restart foxclaw.service
266
+ ```
267
+
268
+ Stop Linux service:
269
+
270
+ ```bash
271
+ systemctl --user stop foxclaw.service
272
+ ```
273
+
274
+ Uninstall Linux service:
275
+
276
+ ```bash
277
+ npm run uninstall-systemd
278
+ ```
279
+
280
+ Update FoxClaw later:
281
+
282
+ ```bash
283
+ git pull
284
+ npm install
285
+ npm run build
286
+ systemctl --user restart foxclaw.service
287
+ ```
@@ -0,0 +1,239 @@
1
+ # Troubleshooting
2
+
3
+ Start with these commands from the FoxClaw repo directory:
4
+
5
+ ```bash
6
+ npm run doctor
7
+ npm run status
8
+ ```
9
+
10
+ If FoxClaw is installed as a Linux user service, also check:
11
+
12
+ ```bash
13
+ systemctl --user status foxclaw.service
14
+ journalctl --user -u foxclaw.service -f
15
+ ```
16
+
17
+ ## Doctor Failures
18
+
19
+ | Symptom | Meaning | Fix |
20
+ | --- | --- | --- |
21
+ | `[FAIL] node >= 24` | Your current shell is using an older Node.js. | Run `nvm install 24 && nvm use 24`, then rerun `npm run doctor`. If the service uses old Node, reinstall it from a Node 24 shell with `npm run install-systemd`. |
22
+ | `[FAIL] codex cli available` | The `codex` command is not in PATH. | Install Codex CLI or fix PATH, then confirm `codex --version` works. |
23
+ | `[FAIL] telegram bot token configured` | `TG_BOT_TOKEN` is missing from `.env`. | Copy the token from `@BotFather` into `.env`. |
24
+ | `[FAIL] telegram allowed user configured` | `TG_ALLOWED_USER_ID` is missing from `.env`. | Get your numeric id from `@userinfobot` and add it to `.env`. |
25
+ | `[FAIL] default cwd exists` | `DEFAULT_CWD` points to a folder that does not exist. | Create the folder or change `DEFAULT_CWD` to an existing absolute path. |
26
+
27
+ ## Node Or npm Is Missing
28
+
29
+ If you see `node: command not found` or `npm: command not found`, install Node.js 24 with `nvm`:
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
+ If it still fails, close the terminal, open a new one, and run:
42
+
43
+ ```bash
44
+ nvm use 24
45
+ ```
46
+
47
+ ## npm Permission Errors
48
+
49
+ If `npm install -g @openai/codex` fails with `EACCES`, `EPERM`, or `permission denied`, your global npm directory is not writable by your user.
50
+
51
+ Recommended fix: use Node through `nvm`, then install again:
52
+
53
+ ```bash
54
+ nvm install 24
55
+ nvm use 24
56
+ npm install -g @openai/codex
57
+ ```
58
+
59
+ Avoid `sudo npm install -g ...` unless you already understand how your Node installation is managed. Mixing `sudo`, system Node, and `nvm` is a common source of broken PATHs.
60
+
61
+ If `codex` installs but FoxClaw still cannot find it, locate the binary:
62
+
63
+ ```bash
64
+ command -v codex
65
+ ```
66
+
67
+ Then put the absolute path in `.env`:
68
+
69
+ ```dotenv
70
+ CODEX_CLI_BIN=/absolute/path/to/codex
71
+ ```
72
+
73
+ ## Bot Does Not Reply
74
+
75
+ Check these in order:
76
+
77
+ 1. Make sure FoxClaw is running:
78
+
79
+ ```bash
80
+ npm run status
81
+ ```
82
+
83
+ 2. Try private chat first. Open your bot directly and send:
84
+
85
+ ```text
86
+ /help
87
+ ```
88
+
89
+ 3. Confirm `TG_ALLOWED_USER_ID` is your numeric Telegram id, not your `@username`.
90
+
91
+ 4. Confirm the bot token in `.env` belongs to the bot you are messaging.
92
+
93
+ 5. Restart after changing `.env`:
94
+
95
+ ```bash
96
+ systemctl --user restart foxclaw.service
97
+ ```
98
+
99
+ If running foreground mode, stop with `Ctrl+C` and run `npm run serve` again.
100
+
101
+ ## Group Messages Do Not Work
102
+
103
+ Private chat is the easiest mode. For groups and topics:
104
+
105
+ 1. Add the bot to the group.
106
+ 2. Disable the bot's `privacy mode` in `@BotFather`.
107
+ 3. Promote the bot to administrator.
108
+ 4. Remove and re-add the bot if privacy mode was changed after it joined.
109
+ 5. Configure `TG_ALLOWED_CHAT_ID`, and optionally `TG_ALLOWED_TOPIC_ID`.
110
+
111
+ Explicit commands such as `/status@botname` can work even when normal group messages are blocked by privacy mode, so verify with a plain natural-language message too.
112
+
113
+ ## Get Group Or Topic IDs
114
+
115
+ 1. Stop FoxClaw.
116
+ 2. Send a new message in the target group or topic.
117
+ 3. Open:
118
+
119
+ ```text
120
+ https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
121
+ ```
122
+
123
+ 4. Use `message.chat.id` as `TG_ALLOWED_CHAT_ID`.
124
+ 5. Use `message.message_thread_id` as `TG_ALLOWED_TOPIC_ID`.
125
+
126
+ If FoxClaw is still running, it may consume the update before you inspect it.
127
+
128
+ ## Telegram Polling Conflict
129
+
130
+ If Telegram reports conflicts or the same bot behaves strangely, two processes may be polling the same bot token.
131
+
132
+ Check old and new services:
133
+
134
+ ```bash
135
+ systemctl --user is-active foxclaw.service
136
+ systemctl --user is-active telegram-codex-app-bridge.service 2>/dev/null || true
137
+ ```
138
+
139
+ Stop the old service:
140
+
141
+ ```bash
142
+ systemctl --user disable --now telegram-codex-app-bridge.service
143
+ ```
144
+
145
+ Then restart FoxClaw:
146
+
147
+ ```bash
148
+ systemctl --user restart foxclaw.service
149
+ ```
150
+
151
+ ## Codex Or App-Server Fails
152
+
153
+ FoxClaw requires local Codex auth. Check:
154
+
155
+ ```bash
156
+ codex --version
157
+ ```
158
+
159
+ If Codex is not logged in:
160
+
161
+ ```bash
162
+ codex login
163
+ ```
164
+
165
+ `codex --version` only verifies the command exists. To verify auth, run:
166
+
167
+ ```bash
168
+ codex
169
+ ```
170
+
171
+ Then ask:
172
+
173
+ ```text
174
+ Say ready and exit.
175
+ ```
176
+
177
+ If your CLI supports `codex login status`, that is also useful, but a normal successful prompt is the most reliable check.
178
+
179
+ FoxClaw app-server logs are stored here by default:
180
+
181
+ ```bash
182
+ tail -f ~/.foxclaw/logs/codex-app-server.log
183
+ ```
184
+
185
+ Bridge logs are stored here:
186
+
187
+ ```bash
188
+ tail -f ~/.foxclaw/logs/service.log
189
+ ```
190
+
191
+ ## Service Starts With The Wrong Node Version
192
+
193
+ The systemd installer captures the `node` binary from your current PATH. If you installed the service from a shell using Node 22 or older, reinstall it from a Node 24 shell:
194
+
195
+ ```bash
196
+ nvm use 24
197
+ npm run install-systemd
198
+ systemctl --user status foxclaw.service
199
+ ```
200
+
201
+ The status output should show a Node 24 path in `ExecStart`.
202
+
203
+ ## Does It Run After Reboot?
204
+
205
+ Linux user systemd:
206
+
207
+ ```bash
208
+ systemctl --user is-enabled foxclaw.service
209
+ ```
210
+
211
+ `enabled` means it starts with your user session. To start after reboot before login:
212
+
213
+ ```bash
214
+ loginctl enable-linger "$USER"
215
+ ```
216
+
217
+ macOS launchd starts FoxClaw when you log in after running:
218
+
219
+ ```bash
220
+ ./scripts/launchd/install.sh
221
+ ```
222
+
223
+ ## Migrating From The Old Project Name
224
+
225
+ If this machine still runs `telegram-codex-app-bridge`, migrate once:
226
+
227
+ ```bash
228
+ systemctl --user disable --now telegram-codex-app-bridge.service 2>/dev/null || true
229
+ test -e ~/.foxclaw || cp -a ~/.telegram-codex-app-bridge ~/.foxclaw
230
+ git remote set-url origin https://github.com/foxden-app/foxclaw.git
231
+ git fetch origin main
232
+ git checkout main
233
+ git pull --ff-only origin main
234
+ npm install
235
+ npm run build
236
+ npm run install-systemd
237
+ ```
238
+
239
+ If `git status --short` shows local changes before migration, stop and review those changes before pulling.
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@foxden-app/foxclaw",
3
+ "version": "0.2.0",
4
+ "description": "Foxden local execution claw for controlling Codex from trusted chat interfaces.",
5
+ "type": "module",
6
+ "main": "dist/main.js",
7
+ "bin": {
8
+ "foxclaw": "dist/main.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "docs",
13
+ "scripts",
14
+ "skills",
15
+ ".env.example",
16
+ "README.md",
17
+ "README_EN.md",
18
+ "LICENSE"
19
+ ],
20
+ "private": false,
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/foxden-app/foxclaw.git"
24
+ },
25
+ "homepage": "https://github.com/foxden-app/foxclaw#readme",
26
+ "bugs": {
27
+ "url": "https://github.com/foxden-app/foxclaw/issues"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "engines": {
33
+ "node": ">=24"
34
+ },
35
+ "scripts": {
36
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
37
+ "build": "npm run clean && tsc -p tsconfig.build.json",
38
+ "dev": "tsx src/main.ts serve",
39
+ "serve": "node dist/main.js serve",
40
+ "weixin-login": "node dist/main.js weixin-login",
41
+ "status": "node dist/main.js status",
42
+ "doctor": "node dist/main.js doctor",
43
+ "install-systemd": "bash scripts/systemd/install.sh",
44
+ "uninstall-systemd": "bash scripts/systemd/uninstall.sh",
45
+ "typecheck": "tsc --noEmit",
46
+ "lint": "eslint .",
47
+ "test": "node --test --import tsx \"src/**/*.test.ts\"",
48
+ "prepack": "npm run build"
49
+ },
50
+ "dependencies": {
51
+ "dotenv": "^16.6.1",
52
+ "qrcode-terminal": "^0.12.0"
53
+ },
54
+ "devDependencies": {
55
+ "@eslint/js": "^9.39.0",
56
+ "@types/node": "^24.12.0",
57
+ "eslint": "^9.39.0",
58
+ "tsx": "^4.19.3",
59
+ "typescript": "5.9.3",
60
+ "typescript-eslint": "^8.58.0"
61
+ }
62
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ node dist/main.js doctor