claude-codex-wechat 0.1.0 → 0.1.4
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 +183 -350
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,100 +1,50 @@
|
|
|
1
1
|
# claude-codex-wechat
|
|
2
2
|
|
|
3
|
-
`claude-codex-wechat`
|
|
3
|
+
`claude-codex-wechat` 是一个本地 bridge daemon。它把:
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
5
|
+
- WeChat direct 通道
|
|
6
|
+
- 本机原生 `Claude Code`
|
|
7
|
+
- 本机原生 `Codex CLI`
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
接起来,让 WeChat 用户可以直接驱动本机上的原生 CLI 会话,并尽量保留原生 resume 能力。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
这个仓库的定位不是另起一套 agent runtime,也不是 ACP bridge。它的目标一直是:
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- **不是 ACP bridge**
|
|
13
|
+
- WeChat 作为人类控制面
|
|
14
|
+
- 本地原生 CLI 作为真实执行面
|
|
15
|
+
- 两边尽量共享同一条原生会话恢复链路
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
## 当前能力
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
当前实现覆盖的主能力:
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
- WeChat direct 模式接入
|
|
22
|
+
- WeChat 轮询收消息与主动回消息
|
|
23
|
+
- 本地原生 `Claude Code` / `Codex CLI` 会话桥接
|
|
24
|
+
- 会话持久化与当前会话恢复
|
|
25
|
+
- 原生 Claude / Codex recoverable session 列表与 attach
|
|
26
|
+
- 本地管理页
|
|
27
|
+
- npm 全局安装与生产 CLI 入口
|
|
28
|
+
- 本地发布 npm 包
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
- 微信扫码登录与 bot token 获取
|
|
26
|
-
- 微信消息路由到本地 `Claude Code` / `Codex CLI`
|
|
27
|
-
- 会话持久化到 SQLite
|
|
28
|
-
- 原生 Claude / Codex 会话扫描
|
|
29
|
-
- 原生会话手动接入
|
|
30
|
-
- 原生会话自动接入
|
|
31
|
-
- 桥接会话与原生会话绑定持久化
|
|
32
|
-
- 管理页支持:
|
|
33
|
-
- pairing 审批
|
|
34
|
-
- 授权用户管理
|
|
35
|
-
- provider 切换
|
|
36
|
-
- 会话停止 / 归档
|
|
37
|
-
- 权限审批
|
|
38
|
-
- 原生恢复修复
|
|
39
|
-
- Claude 原生恢复能力:
|
|
40
|
-
- `claude --resume <sessionId>`
|
|
41
|
-
- `claude -r '<完整标题>'`
|
|
42
|
-
- Codex 原生恢复能力:
|
|
43
|
-
- `codex resume <sessionId>`
|
|
44
|
-
- `codex resume '<thread_name>'`
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## 当前实现目标
|
|
49
|
-
|
|
50
|
-
这个仓库的核心目标不是“做一个微信聊天 UI”,而是:
|
|
51
|
-
|
|
52
|
-
1. 把微信消息稳定接进本地 bridge
|
|
53
|
-
2. 把 bridge 会话稳定映射到本地原生 Claude / Codex 会话
|
|
54
|
-
3. 让微信侧会话尽可能和本地原生会话恢复链路对齐
|
|
55
|
-
|
|
56
|
-
其中 Claude 这条链路尤其强调:
|
|
57
|
-
|
|
58
|
-
- bridge session 有自己的 `resumeTitle`
|
|
59
|
-
- 原生会话文件里有对应标题
|
|
60
|
-
- `~/.claude/history.jsonl` 里也有对应标题
|
|
61
|
-
|
|
62
|
-
只有这几层都对齐,`claude -r '<完整标题>'` 才真正可用。
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## 目录说明
|
|
30
|
+
## 项目结构
|
|
67
31
|
|
|
68
32
|
主要目录:
|
|
69
33
|
|
|
70
34
|
- `src/`
|
|
71
|
-
-
|
|
72
|
-
- 微信通道
|
|
73
|
-
- provider 接入
|
|
74
|
-
- daemon / admin routes / web
|
|
35
|
+
- daemon、provider、session、channel、web 主实现
|
|
75
36
|
- `tests/`
|
|
76
|
-
-
|
|
77
|
-
- bridge 运行态测试
|
|
78
|
-
- 微信 direct 流程测试
|
|
79
|
-
- 前端交互测试
|
|
37
|
+
- 单元测试、运行态测试、前端测试
|
|
80
38
|
- `scripts/`
|
|
81
|
-
-
|
|
82
|
-
- 联调启动脚本
|
|
83
|
-
- 诊断脚本
|
|
39
|
+
- 诊断与辅助脚本
|
|
84
40
|
- `docs/`
|
|
85
|
-
-
|
|
86
|
-
- 对齐过程文档
|
|
87
|
-
- 参考实现文档
|
|
88
|
-
|
|
89
|
-
脚本分层索引见:
|
|
90
|
-
|
|
91
|
-
- [scripts/README.md](./scripts/README.md)
|
|
41
|
+
- 设计说明、对齐文档、参考资料
|
|
92
42
|
|
|
93
|
-
|
|
43
|
+
脚本说明见 [scripts/README.md](./scripts/README.md)。
|
|
94
44
|
|
|
95
45
|
## 安装
|
|
96
46
|
|
|
97
|
-
###
|
|
47
|
+
### 作为 npm 包安装
|
|
98
48
|
|
|
99
49
|
```bash
|
|
100
50
|
npm install -g claude-codex-wechat
|
|
@@ -102,55 +52,50 @@ npm install -g claude-codex-wechat
|
|
|
102
52
|
pnpm add -g claude-codex-wechat
|
|
103
53
|
```
|
|
104
54
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
安装后会得到一个全局命令 `claude-codex-wechat`:
|
|
55
|
+
安装后会得到全局命令:
|
|
108
56
|
|
|
109
57
|
```bash
|
|
110
|
-
claude-codex-wechat
|
|
111
|
-
claude-codex-wechat
|
|
112
|
-
claude-codex-wechat
|
|
113
|
-
claude-codex-wechat
|
|
114
|
-
claude-codex-wechat
|
|
58
|
+
claude-codex-wechat help
|
|
59
|
+
claude-codex-wechat init
|
|
60
|
+
claude-codex-wechat doctor
|
|
61
|
+
claude-codex-wechat start
|
|
62
|
+
claude-codex-wechat print-config
|
|
115
63
|
```
|
|
116
64
|
|
|
117
|
-
|
|
65
|
+
说明:
|
|
118
66
|
|
|
119
|
-
|
|
67
|
+
- 该包依赖 `better-sqlite3`
|
|
68
|
+
- 大多数常见平台会直接下载预编译二进制
|
|
69
|
+
- 少数环境可能需要本地编译工具链
|
|
70
|
+
- Node 版本要求:`>=20`
|
|
120
71
|
|
|
121
|
-
###
|
|
72
|
+
### 从源码安装
|
|
122
73
|
|
|
123
74
|
```bash
|
|
124
|
-
cd /
|
|
75
|
+
cd /Users/liuyuhua/github/claude-codex-wechat
|
|
125
76
|
pnpm install
|
|
126
77
|
```
|
|
127
78
|
|
|
128
|
-
|
|
79
|
+
## CLI 命令
|
|
129
80
|
|
|
130
|
-
|
|
81
|
+
生产态 CLI 入口在 `dist/server/cli.js`,通过 `bin` 暴露为 `claude-codex-wechat`。
|
|
131
82
|
|
|
132
|
-
|
|
83
|
+
可用命令:
|
|
133
84
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
pnpm test
|
|
145
|
-
pnpm build # = vite build(前端 -> dist/web)+ esbuild(server -> dist/server/cli.js)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
构建产物:
|
|
85
|
+
- `claude-codex-wechat start`
|
|
86
|
+
- 前台启动 daemon
|
|
87
|
+
- `claude-codex-wechat init`
|
|
88
|
+
- 写默认配置到 `~/.claude-codex-wechat/config.json`
|
|
89
|
+
- `claude-codex-wechat doctor`
|
|
90
|
+
- 检查配置、前端产物、`claude`/`codex` 可执行文件
|
|
91
|
+
- `claude-codex-wechat print-config`
|
|
92
|
+
- 打印当前配置文件
|
|
93
|
+
- `claude-codex-wechat help`
|
|
94
|
+
- 显示帮助
|
|
149
95
|
|
|
150
|
-
|
|
151
|
-
- `dist/server/cli.js` —— CLI / daemon 入口(对应 `bin` 字段)
|
|
96
|
+
默认监听地址:
|
|
152
97
|
|
|
153
|
-
|
|
98
|
+
- `http://127.0.0.1:8787`
|
|
154
99
|
|
|
155
100
|
## 配置
|
|
156
101
|
|
|
@@ -160,18 +105,16 @@ pnpm build # = vite build(前端 -> dist/web)+ esbuild(server -> di
|
|
|
160
105
|
~/.claude-codex-wechat/config.json
|
|
161
106
|
```
|
|
162
107
|
|
|
163
|
-
|
|
108
|
+
推荐先初始化:
|
|
164
109
|
|
|
165
110
|
```bash
|
|
166
|
-
|
|
167
|
-
cp config.example.json ~/.claude-codex-wechat/config.json
|
|
111
|
+
claude-codex-wechat init
|
|
168
112
|
```
|
|
169
113
|
|
|
170
114
|
最小配置示例:
|
|
171
115
|
|
|
172
116
|
```json
|
|
173
117
|
{
|
|
174
|
-
"databasePath": "/Users/you/.claude-codex-wechat/bridge.sqlite",
|
|
175
118
|
"wechat": {
|
|
176
119
|
"enabled": true,
|
|
177
120
|
"baseUrl": "https://ilinkai.weixin.qq.com",
|
|
@@ -185,11 +128,15 @@ cp config.example.json ~/.claude-codex-wechat/config.json
|
|
|
185
128
|
"codex": {
|
|
186
129
|
"command": "/opt/homebrew/bin/codex"
|
|
187
130
|
}
|
|
131
|
+
},
|
|
132
|
+
"bridge": {
|
|
133
|
+
"defaultProvider": "claude-code",
|
|
134
|
+
"defaultWorkspace": "/absolute/path/to/workspace"
|
|
188
135
|
}
|
|
189
136
|
}
|
|
190
137
|
```
|
|
191
138
|
|
|
192
|
-
|
|
139
|
+
环境变量:
|
|
193
140
|
|
|
194
141
|
- `BRIDGE_PORT`
|
|
195
142
|
- `BRIDGE_CONFIG`
|
|
@@ -200,31 +147,62 @@ cp config.example.json ~/.claude-codex-wechat/config.json
|
|
|
200
147
|
- `BRIDGE_CLAUDE_COMMAND`
|
|
201
148
|
- `BRIDGE_CODEX_COMMAND`
|
|
202
149
|
|
|
203
|
-
|
|
150
|
+
## 本地开发
|
|
204
151
|
|
|
205
|
-
|
|
152
|
+
开发模式启动:
|
|
206
153
|
|
|
207
|
-
|
|
154
|
+
```bash
|
|
155
|
+
pnpm dev
|
|
156
|
+
```
|
|
208
157
|
|
|
209
|
-
|
|
158
|
+
这会:
|
|
159
|
+
|
|
160
|
+
- 启动 daemon
|
|
161
|
+
- 在同一进程里挂 Vite middleware
|
|
162
|
+
- 提供本地管理页与前端热更新
|
|
163
|
+
|
|
164
|
+
开发检查:
|
|
210
165
|
|
|
211
166
|
```bash
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
167
|
+
pnpm typecheck
|
|
168
|
+
pnpm test
|
|
169
|
+
pnpm build
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
构建产物:
|
|
173
|
+
|
|
174
|
+
- `dist/web/`
|
|
175
|
+
- 前端静态资源
|
|
176
|
+
- `dist/server/cli.js`
|
|
177
|
+
- 生产 CLI / daemon 入口
|
|
178
|
+
|
|
179
|
+
## 生产运行
|
|
180
|
+
|
|
181
|
+
生产态通常按下面方式运行:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
claude-codex-wechat start
|
|
217
185
|
```
|
|
218
186
|
|
|
219
|
-
|
|
187
|
+
注意:
|
|
188
|
+
|
|
189
|
+
- 这是前台进程
|
|
190
|
+
- npm 本身不负责守护
|
|
191
|
+
- 长期常驻建议交给进程管理器
|
|
192
|
+
|
|
193
|
+
### pm2
|
|
220
194
|
|
|
221
195
|
```bash
|
|
222
|
-
|
|
196
|
+
npm install -g pm2
|
|
197
|
+
pm2 start claude-codex-wechat --name ccwx -- start
|
|
198
|
+
pm2 logs ccwx
|
|
199
|
+
pm2 restart ccwx
|
|
200
|
+
pm2 startup && pm2 save
|
|
223
201
|
```
|
|
224
202
|
|
|
225
|
-
###
|
|
203
|
+
### systemd
|
|
226
204
|
|
|
227
|
-
|
|
205
|
+
示例:
|
|
228
206
|
|
|
229
207
|
```ini
|
|
230
208
|
[Unit]
|
|
@@ -235,7 +213,6 @@ After=network.target
|
|
|
235
213
|
Type=simple
|
|
236
214
|
User=youruser
|
|
237
215
|
Environment=BRIDGE_PORT=8787
|
|
238
|
-
# 如需指定配置文件:Environment=BRIDGE_CONFIG=/home/youruser/.claude-codex-wechat/config.json
|
|
239
216
|
ExecStart=/usr/bin/claude-codex-wechat start
|
|
240
217
|
Restart=on-failure
|
|
241
218
|
RestartSec=5
|
|
@@ -244,17 +221,9 @@ RestartSec=5
|
|
|
244
221
|
WantedBy=multi-user.target
|
|
245
222
|
```
|
|
246
223
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
```bash
|
|
250
|
-
sudo systemctl daemon-reload
|
|
251
|
-
sudo systemctl enable --now claude-codex-wechat
|
|
252
|
-
sudo journalctl -u claude-codex-wechat -f # 看日志
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### 方式三:launchd(macOS)
|
|
224
|
+
### launchd
|
|
256
225
|
|
|
257
|
-
|
|
226
|
+
示例:
|
|
258
227
|
|
|
259
228
|
```xml
|
|
260
229
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -277,282 +246,146 @@ sudo journalctl -u claude-codex-wechat -f # 看日志
|
|
|
277
246
|
<true/>
|
|
278
247
|
<key>KeepAlive</key>
|
|
279
248
|
<true/>
|
|
280
|
-
<key>StandardOutPath</key>
|
|
281
|
-
<string>/tmp/claude-codex-wechat.out.log</string>
|
|
282
|
-
<key>StandardErrorPath</key>
|
|
283
|
-
<string>/tmp/claude-codex-wechat.err.log</string>
|
|
284
249
|
</dict>
|
|
285
250
|
</plist>
|
|
286
251
|
```
|
|
287
252
|
|
|
288
|
-
|
|
253
|
+
## 发布 npm 包
|
|
289
254
|
|
|
290
|
-
|
|
291
|
-
launchctl load ~/Library/LaunchAgents/com.claude-codex-wechat.plist
|
|
292
|
-
launchctl list | grep claude-codex-wechat # 确认在跑
|
|
293
|
-
# 卸载:launchctl unload ~/Library/LaunchAgents/com.claude-codex-wechat.plist
|
|
294
|
-
```
|
|
255
|
+
当前仓库只保留本地发布流,不再使用 GitHub Action 自动发布。
|
|
295
256
|
|
|
296
|
-
|
|
257
|
+
### 发布行为
|
|
297
258
|
|
|
298
|
-
|
|
259
|
+
本地执行 `npm publish` 时,会自动触发:
|
|
299
260
|
|
|
300
|
-
|
|
261
|
+
- `npm version patch --no-git-tag-version`
|
|
301
262
|
|
|
302
|
-
|
|
263
|
+
也就是说:
|
|
303
264
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
```
|
|
265
|
+
- 每次成功发布都会自动把版本加一位 `patch`
|
|
266
|
+
- 版本 bump 发生在真正 publish 之前
|
|
307
267
|
|
|
308
|
-
|
|
268
|
+
完整的发布前校验定义在 [release.sh](./release.sh),`prepublishOnly` 只负责自动递增版本,避免在 `npm publish` 阶段重复再跑一遍测试和构建。
|
|
309
269
|
|
|
310
|
-
|
|
311
|
-
BRIDGE_DEFAULT_PROVIDER=codex bash ./scripts/recover-weixin-runtime.sh
|
|
312
|
-
```
|
|
270
|
+
### 直接发布
|
|
313
271
|
|
|
314
|
-
|
|
272
|
+
如果不需要自动提交版本变更:
|
|
315
273
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
5. 启动最新 bridge runtime
|
|
274
|
+
```bash
|
|
275
|
+
cd /Users/liuyuhua/github/claude-codex-wechat
|
|
276
|
+
npm publish --access public --registry=https://registry.npmjs.org/
|
|
277
|
+
```
|
|
321
278
|
|
|
322
|
-
|
|
279
|
+
如果必须走代理:
|
|
323
280
|
|
|
324
281
|
```bash
|
|
325
|
-
|
|
282
|
+
cd /Users/liuyuhua/github/claude-codex-wechat
|
|
283
|
+
HTTPS_PROXY=http://127.0.0.1:7890 HTTP_PROXY=http://127.0.0.1:7890 npm publish --access public --registry=https://registry.npmjs.org/
|
|
326
284
|
```
|
|
327
285
|
|
|
328
|
-
|
|
286
|
+
### 使用 release.sh
|
|
329
287
|
|
|
330
|
-
|
|
288
|
+
如果希望:
|
|
331
289
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
290
|
+
- 发布前先提交当前工作区
|
|
291
|
+
- 发布后把自动 bump 的版本提交回当前分支
|
|
292
|
+
- 自动 `git push`
|
|
335
293
|
|
|
336
|
-
|
|
294
|
+
使用:
|
|
337
295
|
|
|
338
|
-
```
|
|
339
|
-
/
|
|
296
|
+
```bash
|
|
297
|
+
cd /Users/liuyuhua/github/claude-codex-wechat
|
|
298
|
+
chmod +x release.sh
|
|
299
|
+
./release.sh
|
|
340
300
|
```
|
|
341
301
|
|
|
342
|
-
|
|
302
|
+
脚本默认会使用本地代理:
|
|
343
303
|
|
|
344
304
|
```text
|
|
345
|
-
|
|
346
|
-
/tmp/bridge-weixin.env
|
|
305
|
+
http://127.0.0.1:7890
|
|
347
306
|
```
|
|
348
307
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
- 这两个 `/tmp` 文件仍然会生成,方便联调和显式 `source`
|
|
352
|
-
- 扫码成功后,helper 现在也会自动把新凭据回写到 `~/.claude-codex-wechat/config.json`
|
|
353
|
-
- 之后直接执行 `pnpm dev`,默认就会继续读取这份正式配置
|
|
354
|
-
|
|
355
|
-
最少要同步这几个字段:
|
|
356
|
-
|
|
357
|
-
- `wechat.baseUrl`
|
|
358
|
-
- `wechat.token`
|
|
359
|
-
- `wechat.accountId`
|
|
360
|
-
|
|
361
|
-
否则你会看到一种典型现象:
|
|
362
|
-
|
|
363
|
-
- 扫码后当前 runtime 能用
|
|
364
|
-
- 重启 `pnpm dev` 后又读不到刚才的新凭据
|
|
365
|
-
- 看起来像“每次重启都要重新扫码”
|
|
366
|
-
|
|
367
|
-
### 2. 启动成功后检查 bridge 是否真的连通
|
|
308
|
+
如果你要覆盖默认代理:
|
|
368
309
|
|
|
369
310
|
```bash
|
|
370
|
-
|
|
311
|
+
cd /Users/liuyuhua/github/claude-codex-wechat
|
|
312
|
+
chmod +x release.sh
|
|
313
|
+
HTTPS_PROXY=http://127.0.0.1:7890 HTTP_PROXY=http://127.0.0.1:7890 ./release.sh
|
|
371
314
|
```
|
|
372
315
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
- `weixin_connected`
|
|
376
|
-
- `weixin_status`
|
|
377
|
-
- `weixin_last_error`
|
|
378
|
-
|
|
379
|
-
如果是正常连通,通常应该看到:
|
|
380
|
-
|
|
381
|
-
- `weixin_connected=true`
|
|
382
|
-
- `weixin_status=connected`
|
|
383
|
-
|
|
384
|
-
### 3. 发微信消息开始对话
|
|
385
|
-
|
|
386
|
-
给当前 bot 账号发一条文本消息。
|
|
387
|
-
|
|
388
|
-
bridge 收到消息后会:
|
|
389
|
-
|
|
390
|
-
- 自动授权用户(如果设置中开启)
|
|
391
|
-
- 创建或接入 bridge session
|
|
392
|
-
- 默认用当前设置的 provider 对话
|
|
393
|
-
|
|
394
|
-
---
|
|
395
|
-
|
|
396
|
-
## 管理页有哪些功能
|
|
397
|
-
|
|
398
|
-
当前管理页主要分成 4 块:
|
|
399
|
-
|
|
400
|
-
### 1. Dashboard
|
|
401
|
-
|
|
402
|
-
- daemon 状态
|
|
403
|
-
- provider 状态
|
|
404
|
-
- 活跃会话数
|
|
405
|
-
- 待处理权限数
|
|
406
|
-
|
|
407
|
-
### 2. WeChatPanel
|
|
408
|
-
|
|
409
|
-
- 微信扫码登录
|
|
410
|
-
- pairing 待审批列表
|
|
411
|
-
- 批准 / 拒绝 pairing
|
|
412
|
-
- 已授权用户管理
|
|
413
|
-
- 撤销授权
|
|
414
|
-
- 扫描可恢复原生会话
|
|
415
|
-
- 手动接入原生会话
|
|
416
|
-
- 自动接入原生会话
|
|
417
|
-
- Claude recoverable session 修复
|
|
418
|
-
|
|
419
|
-
### 3. SessionsPanel
|
|
316
|
+
这个脚本会:
|
|
420
317
|
|
|
421
|
-
-
|
|
422
|
-
-
|
|
423
|
-
-
|
|
424
|
-
-
|
|
425
|
-
-
|
|
426
|
-
-
|
|
427
|
-
- 查看绑定来源
|
|
428
|
-
- 单个 / 批量修复 Claude 原生恢复元数据
|
|
318
|
+
- 先执行 `pnpm typecheck`
|
|
319
|
+
- 再执行 `pnpm build`
|
|
320
|
+
- 提交当前改动
|
|
321
|
+
- 以默认参数执行 `npm publish --access public --registry=https://registry.npmjs.org/`
|
|
322
|
+
- 提交自动 bump 后的 `package.json`
|
|
323
|
+
- 推送到当前分支
|
|
429
324
|
|
|
430
|
-
###
|
|
431
|
-
|
|
432
|
-
- 批准 / 拒绝 / 中止高风险权限请求
|
|
433
|
-
|
|
434
|
-
---
|
|
435
|
-
|
|
436
|
-
## 原生恢复能力
|
|
437
|
-
|
|
438
|
-
### Claude
|
|
439
|
-
|
|
440
|
-
当前仓库支持两种恢复方式:
|
|
441
|
-
|
|
442
|
-
按原生 session id:
|
|
325
|
+
### 发布前建议检查
|
|
443
326
|
|
|
444
327
|
```bash
|
|
445
|
-
claude
|
|
328
|
+
cd /Users/liuyuhua/github/claude-codex-wechat
|
|
329
|
+
npm whoami
|
|
330
|
+
npm config get registry
|
|
331
|
+
npm pack --dry-run
|
|
332
|
+
pnpm typecheck
|
|
333
|
+
pnpm build
|
|
446
334
|
```
|
|
447
335
|
|
|
448
|
-
|
|
336
|
+
如果包名是否可用要先确认:
|
|
449
337
|
|
|
450
338
|
```bash
|
|
451
|
-
claude
|
|
339
|
+
npm view claude-codex-wechat
|
|
452
340
|
```
|
|
453
341
|
|
|
454
|
-
|
|
342
|
+
## 常见问题
|
|
455
343
|
|
|
456
|
-
|
|
457
|
-
- `providerResumeHistorySynced = true`
|
|
344
|
+
### `npm publish` 报 `EPERM scandir ~/.Trash`
|
|
458
345
|
|
|
459
|
-
|
|
346
|
+
一般是因为你不在项目目录,而是在家目录执行了 `npm publish`。
|
|
460
347
|
|
|
461
|
-
|
|
348
|
+
先确认:
|
|
462
349
|
|
|
463
350
|
```bash
|
|
464
|
-
|
|
351
|
+
pwd
|
|
465
352
|
```
|
|
466
353
|
|
|
467
|
-
|
|
354
|
+
应该在:
|
|
468
355
|
|
|
469
356
|
```bash
|
|
470
|
-
codex
|
|
357
|
+
/Users/liuyuhua/github/claude-codex-wechat
|
|
471
358
|
```
|
|
472
359
|
|
|
473
|
-
|
|
360
|
+
### `Public registration is not allowed`
|
|
474
361
|
|
|
475
|
-
|
|
362
|
+
通常是下面几类问题:
|
|
476
363
|
|
|
477
|
-
|
|
364
|
+
- `registry` 不是官方 npm
|
|
365
|
+
- 正在往私有 registry 发包
|
|
366
|
+
- scoped package 没带 `--access public`
|
|
367
|
+
- 账号没有该包名或 scope 的发布权限
|
|
478
368
|
|
|
479
|
-
|
|
480
|
-
最推荐的恢复入口
|
|
481
|
-
- `scripts/weixin-login-helper.ts`
|
|
482
|
-
单独扫码与落盘凭据
|
|
483
|
-
- `scripts/start-runtime-check.sh`
|
|
484
|
-
启动最新 runtime 并打印关键状态
|
|
485
|
-
|
|
486
|
-
### 诊断 / 验收工具
|
|
487
|
-
|
|
488
|
-
- `scripts/check-runtime-readiness.sh`
|
|
489
|
-
看 bridge 是否真的连通
|
|
490
|
-
- `scripts/check-runtime-recovery.sh`
|
|
491
|
-
看 bridge session 恢复字段
|
|
492
|
-
- `scripts/check-weixin-updates.ts`
|
|
493
|
-
直接打微信官方 `getupdates`
|
|
494
|
-
|
|
495
|
-
如果只想记一个命令:
|
|
369
|
+
检查:
|
|
496
370
|
|
|
497
371
|
```bash
|
|
498
|
-
|
|
372
|
+
npm config get registry
|
|
373
|
+
npm whoami
|
|
374
|
+
node -p "require('./package.json').name"
|
|
499
375
|
```
|
|
500
376
|
|
|
501
|
-
|
|
377
|
+
### 本地必须走代理
|
|
378
|
+
|
|
379
|
+
临时发布可直接这样:
|
|
502
380
|
|
|
503
381
|
```bash
|
|
504
|
-
|
|
505
|
-
BRIDGE_PORT=8788 WAIT_SECONDS=120 bash ./scripts/check-codex-wechat-flow.sh
|
|
382
|
+
HTTPS_PROXY=http://127.0.0.1:7890 HTTP_PROXY=http://127.0.0.1:7890 npm publish --access public --registry=https://registry.npmjs.org/
|
|
506
383
|
```
|
|
507
384
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
## 当前已知边界
|
|
511
|
-
|
|
512
|
-
这个仓库当前已经把工程内能做的链路基本铺平了,但仍有一个非常现实的边界:
|
|
513
|
-
|
|
514
|
-
- 微信 bot 新授权出来的 token 可能会很快再次 `session timeout`
|
|
515
|
-
|
|
516
|
-
也就是说,即使:
|
|
517
|
-
|
|
518
|
-
- 扫码成功
|
|
519
|
-
- 新 token 落盘成功
|
|
520
|
-
- 最新 runtime 能启动
|
|
521
|
-
|
|
522
|
-
微信官方 `getupdates` 会话本身仍可能在很短时间后再次失效。
|
|
523
|
-
|
|
524
|
-
如果出现:
|
|
525
|
-
|
|
526
|
-
- `weixin_connected=false`
|
|
527
|
-
- `weixin_status=session_timeout`
|
|
528
|
-
- `weixin_last_error=weixin_get_updates_failed:-14:session timeout`
|
|
529
|
-
|
|
530
|
-
这更像是微信侧登录 / updates 会话稳定性问题,而不一定是这个 bridge 的业务逻辑问题。
|
|
531
|
-
|
|
532
|
-
---
|
|
533
|
-
|
|
534
|
-
## 怎么判断真正成功
|
|
535
|
-
|
|
536
|
-
一个最小闭环应至少满足:
|
|
537
|
-
|
|
538
|
-
1. `check-runtime-readiness.sh` 显示:
|
|
539
|
-
- `weixin_connected=true`
|
|
540
|
-
- `weixin_status=connected`
|
|
541
|
-
2. 给 bot 发一条真实微信消息后:
|
|
542
|
-
- `/api/channel/sessions` 出现新会话
|
|
543
|
-
3. Claude 会话里看到:
|
|
544
|
-
- `providerResumeTitleSynced=true`
|
|
545
|
-
- `providerResumeHistorySynced=true`
|
|
546
|
-
4. `claude -r '<完整标题>'` 真能恢复
|
|
547
|
-
|
|
548
|
-
如果要验 Codex,则再满足:
|
|
549
|
-
|
|
550
|
-
5. `codex resume '<thread_name>'` 真能恢复
|
|
551
|
-
|
|
552
|
-
---
|
|
553
|
-
|
|
554
|
-
## 更多文档
|
|
385
|
+
## 相关文件
|
|
555
386
|
|
|
556
|
-
- [
|
|
557
|
-
- [
|
|
387
|
+
- [package.json](./package.json)
|
|
388
|
+
- [release.sh](./release.sh)
|
|
558
389
|
- [scripts/README.md](./scripts/README.md)
|
|
390
|
+
- [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md)
|
|
391
|
+
- [docs/wechatbot-usage-guide.md](./docs/wechatbot-usage-guide.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-codex-wechat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build:web": "vite build",
|
|
22
22
|
"build:server": "node scripts/build-server.mjs",
|
|
23
23
|
"build": "vite build && node scripts/build-server.mjs",
|
|
24
|
-
"prepublishOnly": "npm
|
|
24
|
+
"prepublishOnly": "npm version patch --no-git-tag-version"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fastify/static": "^9.1.3",
|