codex-weixin 0.3.4 → 0.3.6
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/CHANGELOG.md +19 -0
- package/README.en.md +4 -1
- package/README.md +262 -223
- package/dist/bridge/format.d.ts +7 -0
- package/dist/bridge/format.js +15 -0
- package/dist/bridge/format.js.map +1 -1
- package/dist/bridge/service.d.ts +2 -0
- package/dist/bridge/service.js +71 -1
- package/dist/bridge/service.js.map +1 -1
- package/dist/codex/app-server-runner.js +2 -1
- package/dist/codex/app-server-runner.js.map +1 -1
- package/dist/codex/exec-runner.js +2 -1
- package/dist/codex/exec-runner.js.map +1 -1
- package/dist/server/account-manager.js +5 -1
- package/dist/server/account-manager.js.map +1 -1
- package/dist/server/http-server.js +4 -1
- package/dist/server/http-server.js.map +1 -1
- package/dist/state/runtime-state.d.ts +2 -0
- package/dist/state/runtime-state.js +14 -0
- package/dist/state/runtime-state.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `codex-weixin` are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.3.6] - 2026-07-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `/resume` in WeChat to list the current sender's managed sessions and switch back to a selected Codex thread by number.
|
|
10
|
+
- Added recent user-prompt summaries and timestamps to the session list so users can identify historical conversations before switching, including lazy recovery for sessions created by older versions.
|
|
11
|
+
|
|
12
|
+
### Security
|
|
13
|
+
|
|
14
|
+
- Kept Codex thread IDs and local attachment paths out of `/resume` replies while preserving attachment names in useful session summaries.
|
|
15
|
+
|
|
16
|
+
## [0.3.5] - 2026-07-17
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Prevented visible Node.js console windows from repeatedly appearing on Windows when the Web UI checks the Codex CLI, starts the Codex app-server, or falls back to `codex exec`.
|
|
21
|
+
|
|
5
22
|
## [0.3.4] - 2026-07-16
|
|
6
23
|
|
|
7
24
|
### Changed
|
|
@@ -178,6 +195,8 @@ All notable changes to `codex-weixin` are documented in this file.
|
|
|
178
195
|
- Kept GPT-5.6 options available after selecting a different model.
|
|
179
196
|
- Removed extra message spacing and hid internal WeChat and Codex routing identifiers from the normal UI.
|
|
180
197
|
|
|
198
|
+
[0.3.6]: https://github.com/XavierJiezou/codex-weixin/releases/tag/v0.3.6
|
|
199
|
+
[0.3.5]: https://github.com/XavierJiezou/codex-weixin/releases/tag/v0.3.5
|
|
181
200
|
[0.3.4]: https://github.com/XavierJiezou/codex-weixin/releases/tag/v0.3.4
|
|
182
201
|
[0.3.3]: https://github.com/XavierJiezou/codex-weixin/releases/tag/v0.3.3
|
|
183
202
|
[0.3.2]: https://github.com/XavierJiezou/codex-weixin/releases/tag/v0.3.2
|
package/README.en.md
CHANGED
|
@@ -31,7 +31,7 @@ Screenshots live under `docs/images/screenshots/`. The Web management screenshot
|
|
|
31
31
|
| ✅ | Browser QR connection | Shows waiting, scanned, connected, and expired QR states. | Pending: `docs/images/screenshots/wechat-qr-login.png` |
|
|
32
32
|
| ✅ | Session management | Grouped account tabs, Markdown history, continued Codex threads, and create, rename, activate, reset, and delete actions. | [Web sessions](docs/images/screenshots/web-session-management.png) |
|
|
33
33
|
| ✅ | Web text and attachments | Send text with up to 10 files (100 MiB total), with media playback, preview, and download in history. | Pending: `docs/images/screenshots/web-attachments.png` |
|
|
34
|
-
| ✅ | WeChat private-chat control | Supports regular messages plus `/status`, `/new`, `/bind`, `/model`, `/effort`, `/prompt start`, `/prompt done`, and `/stop`. | Pending: `docs/images/screenshots/wechat-chat.png` |
|
|
34
|
+
| ✅ | WeChat private-chat control | Supports regular messages plus `/status`, `/new`, `/resume`, `/bind`, `/model`, `/effort`, `/prompt start`, `/prompt done`, and `/stop`. | Pending: `docs/images/screenshots/wechat-chat.png` |
|
|
35
35
|
| ✅ | WeChat media input | Accepts transcribed voice, images, audio, video, and files up to 100 MiB each, with a direct notice when the limit is exceeded. | Pending: `docs/images/screenshots/wechat-media-input.png` |
|
|
36
36
|
| ✅ | File delivery to WeChat | Codex can return local images, videos, and files as native WeChat messages. | Pending: `docs/images/screenshots/wechat-media-output.png` |
|
|
37
37
|
| ✅ | Models and reasoning effort | Model-aware dropdowns loaded from app-server, including GPT-5.6 Sol, Terra, and Luna for IkunCoding. | Pending: `docs/images/screenshots/web-model-settings.png` |
|
|
@@ -107,6 +107,7 @@ The UI uses local remarks instead of treating internal IDs as account names. Exp
|
|
|
107
107
|
- Reset clears the recorded thread so the next message starts fresh context.
|
|
108
108
|
- Delete removes only the bridge record, not Codex's own history files.
|
|
109
109
|
- `/new` creates a new managed session for the current sender.
|
|
110
|
+
- `/resume` lists this sender's sessions with recent prompt summaries and timestamps; `/resume <number>` switches back to the selected Codex thread.
|
|
110
111
|
|
|
111
112
|
## WeChat commands
|
|
112
113
|
|
|
@@ -115,6 +116,8 @@ The UI uses local remarks instead of treating internal IDs as account names. Exp
|
|
|
115
116
|
/status Show session, workspace, thread, backend, effective model, and reasoning effort
|
|
116
117
|
/bind <absolute-path> Bind to an allowed workspace
|
|
117
118
|
/new Create a new managed Codex session
|
|
119
|
+
/resume List historical sessions with recent prompt summaries
|
|
120
|
+
/resume <number> Switch to and continue a historical session
|
|
118
121
|
/model Show the current and available models
|
|
119
122
|
/model <number|model|default> Switch this session's model or restore inheritance
|
|
120
123
|
/effort Show reasoning efforts supported by the current model
|
package/README.md
CHANGED
|
@@ -1,223 +1,262 @@
|
|
|
1
|
-
<h1 align="center">codex-weixin</h1>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="src/web/favicon.svg" alt="codex-weixin logo" width="128" height="128" />
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<strong>中文</strong> | <a href="./README.en.md">English</a>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<strong>把个人微信账号接入本机 OpenAI Codex。</strong>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
`codex-weixin` 是一个跨平台、本机运行的微信到 Codex 专用服务。启动后会打开 Web 管理页;用户在页面扫码登录微信,即可从微信私聊控制本机 Codex、管理工作目录和切换会话。
|
|
16
|
-
|
|
17
|
-
```text
|
|
18
|
-
微信账号 <-> codex-weixin <-> 本机 Codex <-> 允许的工作目录
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
它不是通用消息网关,不接入其他聊天平台,也不把管理页面开放到局域网或公网。
|
|
22
|
-
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<p align="center">
|
|
46
|
-
<img src="docs/images/screenshots/
|
|
47
|
-
</p>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
npm
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Codex
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
1
|
+
<h1 align="center">codex-weixin</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="src/web/favicon.svg" alt="codex-weixin logo" width="128" height="128" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>中文</strong> | <a href="./README.en.md">English</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>把个人微信账号接入本机 OpenAI Codex。</strong>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
`codex-weixin` 是一个跨平台、本机运行的微信到 Codex 专用服务。启动后会打开 Web 管理页;用户在页面扫码登录微信,即可从微信私聊控制本机 Codex、管理工作目录和切换会话。
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
微信账号 <-> codex-weixin <-> 本机 Codex <-> 允许的工作目录
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
它不是通用消息网关,不接入其他聊天平台,也不把管理页面开放到局域网或公网。
|
|
22
|
+
|
|
23
|
+
## 核心功能
|
|
24
|
+
|
|
25
|
+
### 1. 微信多媒体输入与文件回传
|
|
26
|
+
|
|
27
|
+
微信端可以发送文本、图片、音频、视频和文档给 Codex,单个附件最大 100 MiB。Codex 也可以把本机图片、视频和文件作为微信原生消息发回。
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<img src="docs/images/screenshots/wechat-media-input-output.png" alt="通过微信向 Codex 发送文件并接收回传" width="420" />
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
### 2. 微信原生语音指令
|
|
34
|
+
|
|
35
|
+
支持微信语音转写,可以直接用语音向 Codex 下达任务;没有转写文本的语音会作为本机附件交给 Codex 处理。
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="docs/images/screenshots/wechat-voice-command.png" alt="通过微信语音向 Codex 下达指令" width="420" />
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
### 3. Codex CLI 原生命令
|
|
42
|
+
|
|
43
|
+
微信端支持 `/status`、`/new`、`/resume`、`/bind`、`/model`、`/effort`、`/stream`、`/prompt start`、`/prompt done` 和 `/stop`,可以管理会话、工作目录、模型、推理强度和过程进度。
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="docs/images/screenshots/wechat-cli-commands.png" alt="在微信中使用 Codex CLI 原生命令" width="420" />
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
### 4. 过程进度反馈
|
|
50
|
+
|
|
51
|
+
过程进度默认开启。Codex 处理长任务时会持续向微信发送中间进度,Web 端则折叠显示处理过程和用时,最终答案保持完整。
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<img src="docs/images/screenshots/wechat-process-progress.png" alt="Codex 长任务的微信过程进度反馈" width="420" />
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
### 5. 多微信账号接入与管理
|
|
58
|
+
|
|
59
|
+
一个服务可以并行运行多个微信账号。每个账号拥有独立的联系人授权、附件、会话和运行状态;移除账号时还可以选择保留历史,重新扫码后继续使用。
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<img src="docs/images/screenshots/web-multi-account.png" alt="codex-weixin 多微信账号管理" width="100%" />
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
### 6. Web 会话管理
|
|
66
|
+
|
|
67
|
+
Web 端可以按微信账号查看 Markdown 历史、继续同一个 Codex thread,并支持新建、重命名、切换、重置和删除会话。页面也支持直接发送文本和附件,每次最多 10 个文件、合计 100 MiB。
|
|
68
|
+
|
|
69
|
+
<p align="center">
|
|
70
|
+
<img src="docs/images/screenshots/web-session-management.png" alt="codex-weixin Web 会话管理" width="100%" />
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
### 7. Web 全局设置与自动更新
|
|
74
|
+
|
|
75
|
+
Web 端可以配置工作目录、Codex 后端、模型、推理强度和过程进度,也可以检查并安装新版本。全局 npm 安装会更新当前实际运行的 runtime,完成校验后自动重启并恢复连接。
|
|
76
|
+
|
|
77
|
+
<p align="center">
|
|
78
|
+
<img src="docs/images/screenshots/web-global-settings.png" alt="codex-weixin Web 全局设置" width="100%" />
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
## 环境要求
|
|
82
|
+
|
|
83
|
+
- Node.js `>=22`
|
|
84
|
+
- Git
|
|
85
|
+
- 已安装并登录 Codex CLI
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm install -g @openai/codex
|
|
89
|
+
codex --version
|
|
90
|
+
codex
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 安装
|
|
94
|
+
|
|
95
|
+
推荐从 npm 全局安装:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm install -g codex-weixin
|
|
99
|
+
codex-weixin
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
也可以从源码安装:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone https://github.com/XavierJiezou/codex-weixin.git
|
|
106
|
+
cd codex-weixin
|
|
107
|
+
npm install
|
|
108
|
+
npm run build
|
|
109
|
+
npm install -g .
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
服务会自动打开 [http://127.0.0.1:8787](http://127.0.0.1:8787)。如果不希望全局安装,也可以在项目目录运行:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm start
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 第一次接入微信
|
|
119
|
+
|
|
120
|
+
1. 打开管理页,在“设置”中确认 Codex 默认工作目录和允许的工作目录。
|
|
121
|
+
2. 点击“添加微信”,使用微信扫描页面二维码并确认登录。
|
|
122
|
+
3. 在微信中给新接入的账号发送任意消息。
|
|
123
|
+
4. 回到“微信账号”,允许页面中出现的待授权联系人。
|
|
124
|
+
5. 再次从微信发送消息,Codex 会在默认工作目录中开始处理。
|
|
125
|
+
|
|
126
|
+
继续添加账号时重复扫码即可。每个账号都有独立的轮询任务、联系人授权、入站文件和会话状态;单个账号发生错误不会停止其他账号。同一个微信账号因登录过期等原因重新扫码时,会刷新原账号凭据并保留本机备注、授权和会话,不会创建新的空账号。移除账号时可以保留会话历史;登录凭据会立即删除,同一微信用户以后重新扫码时会恢复原备注、授权和受管会话。
|
|
127
|
+
|
|
128
|
+
## 会话管理
|
|
129
|
+
|
|
130
|
+
“会话”页面只管理由本服务创建和使用的 Codex 会话,不扫描或接管其他终端产生的全部 Codex 历史记录。
|
|
131
|
+
|
|
132
|
+
选择一个会话后,右侧会从 Codex 自身保存的 thread 中读取历史用户消息和最终回复。聊天标题下方可以为当前会话选择模型、推理强度和过程进度,或继续继承全局设置;这与微信 `/model`、`/effort`、`/stream` 共用同一份会话配置。过程进度默认开启,在 Web 中折叠展示并记录处理用时,最终答案仍作为一个完整回复显示。可以直接在页面底部继续聊天,并通过回形针按钮将文本提示词和多个文件作为同一个 turn 发送;Web 和微信共用同一个 thread,上下文会保持连续。上传文件按微信账号和会话隔离保存在 `~/.codex-weixin/inbound/`,每次最多 10 个、合计不超过 100 MiB。
|
|
133
|
+
|
|
134
|
+
页面默认使用账号备注,不把内部 ID 当作账号名称。展开账号卡片中的“账号 ID”可以查看 iLink Bot ID 和 User ID;Codex thread id 仍不在普通页面显示。可以在“微信账号”页面给账号设置只保存在本机的备注;备注会同步用于会话标签。未设置备注时才使用“微信账号 1”这类默认名称。当前扫码和消息接口没有提供微信昵称、头像或个人资料查询能力,因此页面使用默认图标。
|
|
135
|
+
|
|
136
|
+
- 每个已授权微信账号有一个当前活动会话,也可以拥有多个命名会话。
|
|
137
|
+
- “切换”决定该联系人下一条微信消息继续哪个 Codex thread。
|
|
138
|
+
- “重置”清空本服务记录的 thread,下一条消息创建新上下文。
|
|
139
|
+
- “删除”只删除本服务中的会话记录,不删除 Codex 自身保存的历史文件。
|
|
140
|
+
- 微信中的 `/new` 会立即为当前联系人创建新的受管会话。
|
|
141
|
+
- 微信中的 `/resume` 会按最近更新时间列出当前联系人的历史会话、最近内容摘要和时间;发送 `/resume <序号>` 可切换并继续原来的 Codex thread。
|
|
142
|
+
|
|
143
|
+
## 微信内命令
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
/help 查看命令
|
|
147
|
+
/status 查看当前会话、工作目录、thread、backend、实际模型和推理强度
|
|
148
|
+
/bind <absolute-path> 绑定到允许列表内的工作目录
|
|
149
|
+
/new 创建新的受管 Codex 会话
|
|
150
|
+
/resume 查看历史会话、最近内容摘要和序号
|
|
151
|
+
/resume <序号> 切换并继续指定的历史会话
|
|
152
|
+
/model 查看当前模型和可用模型
|
|
153
|
+
/model <序号|模型 ID|default> 切换当前会话模型,或恢复继承设置
|
|
154
|
+
/effort 查看当前模型支持的推理强度
|
|
155
|
+
/effort <序号|强度|default> 切换当前会话推理强度,或恢复继承设置
|
|
156
|
+
/stream 查看当前会话的过程进度设置
|
|
157
|
+
/stream <on|off|default> 开启、关闭过程进度,或恢复继承全局设置
|
|
158
|
+
/prompt start 开始缓冲多条微信消息
|
|
159
|
+
/prompt done 将缓冲内容作为一次 Codex turn 提交
|
|
160
|
+
/stop 中断当前 Codex 任务
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
普通消息直接进入当前活动会话。图片、文件、视频和无转写语音会先保存到账号独立的入站目录,再以本地路径加入 prompt;有微信转写文本的语音优先使用转写文本。
|
|
164
|
+
|
|
165
|
+
## 文件回传
|
|
166
|
+
|
|
167
|
+
Codex 可以在最终回复中声明需要发送的本机文件:
|
|
168
|
+
|
|
169
|
+
````text
|
|
170
|
+
```codex-weixin-actions
|
|
171
|
+
{
|
|
172
|
+
"send": [
|
|
173
|
+
{ "type": "image", "path": "/absolute/path/chart.png" },
|
|
174
|
+
{ "type": "video", "path": "/absolute/path/demo.mp4" },
|
|
175
|
+
{ "type": "file", "path": "/absolute/path/report.pdf" }
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
````
|
|
180
|
+
|
|
181
|
+
只接受本机绝对路径。原生出站类型为 `image`、`video` 和 `file`;音频按普通文件发送。远程 URL 不会被当作本机文件上传。
|
|
182
|
+
|
|
183
|
+
## Codex 后端
|
|
184
|
+
|
|
185
|
+
默认的 `codexBackend` 是 `auto`。第一次收到 Codex 消息时,服务会启动一个持久的 `codex app-server --stdio` 进程,并使用新版 `initialize`、`thread/*` 和 `turn/*` 协议。新会话和已有会话都优先通过 app-server 运行;如果 app-server 无法启动、握手或处理请求,会自动回退到 `codex exec` 或 `codex exec resume`。
|
|
186
|
+
|
|
187
|
+
微信端目前没有 Codex 审批弹窗,因此 app-server 使用 `approvalPolicy: "never"`,只在现有 Codex sandbox 权限内执行,不会等待一个无法在微信中回答的本机审批请求。管理页仍可把后端固定为 `app-server` 或 `exec`,用于排查问题。
|
|
188
|
+
|
|
189
|
+
## 模型和推理强度
|
|
190
|
+
|
|
191
|
+
“设置”页面会从 Codex app-server 读取可用模型和各模型支持的推理强度。选择“沿用 Codex 设置”时使用 Codex 自身配置;选择具体模型或推理强度并保存后,后续 Web 和微信消息都会使用该配置。
|
|
192
|
+
|
|
193
|
+
微信中发送 `/model` 或 `/effort` 可以查看带序号的选项,再用序号或英文 ID 切换。微信端设置只覆盖当前受管会话,不影响其他微信账号、联系人或会话;发送 `/model default`、`/effort default` 可恢复继承 Web/Codex 设置。Web 继续该会话时也会沿用这份会话设置。
|
|
194
|
+
|
|
195
|
+
IkunCoding 提供方会额外显示 `gpt-5.6-sol`、`gpt-5.6-terra` 和 `gpt-5.6-luna`。切换到其他模型后,这三项仍会保留在下拉列表和微信 `/model` 列表中。微信发送 `/status` 可以查看当前生效的模型和推理强度。
|
|
196
|
+
|
|
197
|
+
## 本地数据
|
|
198
|
+
|
|
199
|
+
服务状态和默认 Codex 工作目录统一放在:
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
~/.codex-weixin/
|
|
203
|
+
accounts/ 微信账号凭据,每个账号一个文件
|
|
204
|
+
retained-accounts.json 已移除账号的恢复索引,不包含 token
|
|
205
|
+
runtime/<account-id>/ 联系人授权和受管会话状态
|
|
206
|
+
inbound/<account-id>/ 微信入站附件
|
|
207
|
+
config.json Codex 和工作区配置
|
|
208
|
+
logs/
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
不要提交或分享该目录。管理 API 不会把微信 token 返回给浏览器。
|
|
212
|
+
|
|
213
|
+
## 启动设置
|
|
214
|
+
|
|
215
|
+
服务始终只绑定 `127.0.0.1`。可以通过环境变量改变端口、状态目录或关闭自动打开浏览器:
|
|
216
|
+
|
|
217
|
+
```text
|
|
218
|
+
CODEX_WEIXIN_PORT=8787
|
|
219
|
+
CODEX_WEIXIN_STATE_DIR=/absolute/private/path
|
|
220
|
+
CODEX_WEIXIN_OPEN=0
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Windows PowerShell 示例:
|
|
224
|
+
|
|
225
|
+
```powershell
|
|
226
|
+
$env:CODEX_WEIXIN_OPEN="0"
|
|
227
|
+
codex-weixin
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## 安全边界
|
|
231
|
+
|
|
232
|
+
- Web 服务只监听本机,拒绝非本机 Host 和 Origin。
|
|
233
|
+
- 所有修改 API 都需要页面运行时临时令牌。
|
|
234
|
+
- 微信凭据永远不返回管理页面。
|
|
235
|
+
- 未知联系人默认拒绝,必须在管理页明确允许。
|
|
236
|
+
- `/bind` 只能选择允许列表内的绝对工作目录。
|
|
237
|
+
- `danger-full-access` 会绕过 Codex 文件系统 sandbox;只有接受整机访问风险时才启用。
|
|
238
|
+
- 多账号可以并行触发 Codex,会共同占用本机 CPU、内存和 Codex 配额。
|
|
239
|
+
|
|
240
|
+
## 开发
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
npm install
|
|
244
|
+
npm run dev
|
|
245
|
+
npm test
|
|
246
|
+
npm run typecheck
|
|
247
|
+
npm run build
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
开发入口同样只启动本机 Web 服务。浏览器页面、JSON API、多账号运行时、扫码状态机和受管会话都有自动化测试。
|
|
251
|
+
|
|
252
|
+
源码目录通过 `npm run dev` 或 `npm start` 启动时,Web 只检查新版本,不会自动安装;请通过 Git 更新源码后重新构建。全局安装和独立 `node_modules/codex-weixin` runtime 会更新当前实际运行的 npm prefix,并在重启前验证目标版本和服务入口。Windows 更新前会自动释放服务进程对包目录的工作目录占用,避免 npm 因 `EBUSY` 无法替换文件。
|
|
253
|
+
|
|
254
|
+
## 参考与许可
|
|
255
|
+
|
|
256
|
+
项目是独立实现,微信 iLink 接入形态参考 `Tencent/openclaw-weixin`,并参考了公开的 Codex/微信桥接项目在 Codex app-server、媒体传输和安全边界方面的实践。项目未复制 AGPL 项目源码,使用 MIT License。
|
|
257
|
+
|
|
258
|
+
版本变更见 [CHANGELOG.md](./CHANGELOG.md)。
|
|
259
|
+
|
|
260
|
+
## 社区
|
|
261
|
+
|
|
262
|
+
感谢 [LINUX DO](https://linux.do/t/topic/2599273) 社区佬友的支持与反馈。
|
package/dist/bridge/format.d.ts
CHANGED
|
@@ -6,9 +6,16 @@ export type PromptAttachment = {
|
|
|
6
6
|
label: string;
|
|
7
7
|
path: string;
|
|
8
8
|
};
|
|
9
|
+
type PromptPreviewItem = Pick<Extract<PromptBufferItem, {
|
|
10
|
+
kind: "text";
|
|
11
|
+
}>, "kind" | "text"> | Pick<Extract<PromptBufferItem, {
|
|
12
|
+
kind: "file" | "image" | "video" | "audio";
|
|
13
|
+
}>, "kind" | "label">;
|
|
14
|
+
export declare function buildPromptPreview(text: string, attachments?: PromptPreviewItem[], limit?: number): string | undefined;
|
|
9
15
|
export declare function parsePrompt(text: string): {
|
|
10
16
|
text: string;
|
|
11
17
|
attachments: PromptAttachment[];
|
|
12
18
|
};
|
|
13
19
|
export declare function stripBridgeInstructions(text: string): string;
|
|
14
20
|
export declare function chunkText(text: string, limit?: number): string[];
|
|
21
|
+
export {};
|
package/dist/bridge/format.js
CHANGED
|
@@ -23,6 +23,21 @@ export function buildPrompt(text, attachments = [], attachmentSource = "WeChat")
|
|
|
23
23
|
}
|
|
24
24
|
return lines.join("\n\n").trim();
|
|
25
25
|
}
|
|
26
|
+
export function buildPromptPreview(text, attachments = [], limit = 120) {
|
|
27
|
+
const labels = {
|
|
28
|
+
file: "文件",
|
|
29
|
+
image: "图片",
|
|
30
|
+
video: "视频",
|
|
31
|
+
audio: "音频"
|
|
32
|
+
};
|
|
33
|
+
const parts = [text, ...attachments.map((attachment) => attachment.kind === "text"
|
|
34
|
+
? attachment.text
|
|
35
|
+
: `${labels[attachment.kind]}:${attachment.label}`)];
|
|
36
|
+
const preview = parts.join(" ").replace(/\s+/g, " ").trim();
|
|
37
|
+
if (!preview)
|
|
38
|
+
return undefined;
|
|
39
|
+
return preview.length > limit ? `${preview.slice(0, Math.max(1, limit - 1))}…` : preview;
|
|
40
|
+
}
|
|
26
41
|
export function parsePrompt(text) {
|
|
27
42
|
let normalized = text.trim();
|
|
28
43
|
for (const instructions of [BRIDGE_ACTION_INSTRUCTIONS, LEGACY_BRIDGE_ACTION_INSTRUCTIONS]) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/bridge/format.ts"],"names":[],"mappings":"AAEA,MAAM,0BAA0B,GAAG;IACjC,4HAA4H;IAC5H,gIAAgI;IAChI,oEAAoE;IACpE,yBAAyB;IACzB,w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I;IAClD,MAAM,UAAU,GAAG,IAAI,IAAI,eAAe,CAAC;IAC3C,IAAI,UAAU,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;QAC/B,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,OAAO,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;QAClC,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClD,IAAI,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC;YAC/C,GAAG,GAAG,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/bridge/service.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare class BridgeService {
|
|
|
27
27
|
handleMessage(message: NormalizedWeixinMessage): Promise<void>;
|
|
28
28
|
private handleCommand;
|
|
29
29
|
private bindWorkspace;
|
|
30
|
+
private handleResumeCommand;
|
|
31
|
+
private sessionPromptPreview;
|
|
30
32
|
private handlePromptCommand;
|
|
31
33
|
private handleModelCommand;
|
|
32
34
|
private handleEffortCommand;
|