codex-weixin 0.3.5 → 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 +205 -192
- package/LICENSE +21 -21
- package/NOTICE +5 -5
- package/README.en.md +216 -213
- package/README.md +61 -58
- 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/server/account-manager.js +5 -1
- package/dist/server/account-manager.js.map +1 -1
- package/dist/server/index.js +0 -0
- 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/dist/web/app.js +1452 -1452
- package/dist/web/favicon.svg +10 -10
- package/dist/web/index.html +390 -390
- package/dist/web/styles.css +418 -418
- package/package.json +62 -62
- package/src/web/favicon.svg +10 -10
package/README.en.md
CHANGED
|
@@ -1,213 +1,216 @@
|
|
|
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
|
-
<a href="./README.md">中文</a> | <strong>English</strong>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<strong>Connect multiple personal WeChat accounts to a local OpenAI Codex installation.</strong>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
`codex-weixin` is a cross-platform, local-only WeChat service dedicated to Codex. Starting it opens a Web management page where users scan a WeChat QR code, manage accounts and workspaces, and switch Codex sessions.
|
|
16
|
-
|
|
17
|
-
```text
|
|
18
|
-
Multiple WeChat accounts <-> codex-weixin <-> local Codex <-> allowed workspaces
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
It is not a general messaging gateway. The management page is never exposed to the LAN or public Internet.
|
|
22
|
-
|
|
23
|
-
## Feature status
|
|
24
|
-
|
|
25
|
-
Screenshots live under `docs/images/screenshots/`. The Web management screenshot is included; rows that require a phone view reserve stable filenames for later WeChat captures.
|
|
26
|
-
|
|
27
|
-
| Status | Feature | Details | Screenshot |
|
|
28
|
-
| --- | --- | --- | --- |
|
|
29
|
-
| ✅ | Local Web management | A `127.0.0.1`-only page manages WeChat accounts, sessions, workspaces, and Codex settings. | [Web sessions](docs/images/screenshots/web-session-management.png) |
|
|
30
|
-
| ✅ | Multiple WeChat accounts | One service runs multiple accounts with local remarks and isolated authorization, attachments, and sessions; account removal can retain history. | [Web sessions](docs/images/screenshots/web-session-management.png) |
|
|
31
|
-
| ✅ | Browser QR connection | Shows waiting, scanned, connected, and expired QR states. | Pending: `docs/images/screenshots/wechat-qr-login.png` |
|
|
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
|
-
| ✅ | 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` |
|
|
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
|
-
| ✅ | 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
|
-
| ✅ | 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` |
|
|
38
|
-
| ✅ | Process progress | Enabled by default; Codex progress reaches WeChat immediately and appears in a collapsible Web timeline with elapsed time, while final answers stay intact. | Pending: `docs/images/screenshots/web-process-progress.png` |
|
|
39
|
-
| ✅ | Typing state and deduplication | Web typing state plus persistent sync cursors and message IDs prevent duplicate replies. | Pending: `docs/images/screenshots/wechat-typing.png` |
|
|
40
|
-
| ✅ | App-server first | New and resumed sessions prefer Codex app-server V2 and fall back to `codex exec` when unavailable. | Pending: `docs/images/screenshots/wechat-status.png` |
|
|
41
|
-
| ✅ | Web auto-update | Selects npm or npmmirror, updates the active npm runtime, verifies it, then restarts and reconnects. | Pending: `docs/images/screenshots/web-auto-update.png` |
|
|
42
|
-
|
|
43
|
-
## Web management preview
|
|
44
|
-
|
|
45
|
-
<p align="center">
|
|
46
|
-
<img src="docs/images/screenshots/web-session-management.png" alt="codex-weixin Web session management" width="100%" />
|
|
47
|
-
</p>
|
|
48
|
-
|
|
49
|
-
## Requirements
|
|
50
|
-
|
|
51
|
-
- Node.js `>=22`
|
|
52
|
-
- Git
|
|
53
|
-
- An installed and authenticated Codex CLI
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install -g @openai/codex
|
|
57
|
-
codex --version
|
|
58
|
-
codex
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Install and start
|
|
62
|
-
|
|
63
|
-
Install globally from npm:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npm install -g codex-weixin
|
|
67
|
-
codex-weixin
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Or install from source:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
git clone https://github.com/XavierJiezou/codex-weixin.git
|
|
74
|
-
cd codex-weixin
|
|
75
|
-
npm install
|
|
76
|
-
npm run build
|
|
77
|
-
npm install -g .
|
|
78
|
-
codex-weixin
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
The service opens [http://127.0.0.1:8787](http://127.0.0.1:8787). To run without a global install:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
npm start
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## First connection
|
|
88
|
-
|
|
89
|
-
1. Open Settings and confirm the default and allowed Codex workspaces.
|
|
90
|
-
2. Select Add WeChat, scan the QR code, and confirm in WeChat.
|
|
91
|
-
3. Send any message to the connected account.
|
|
92
|
-
4. Return to WeChat Accounts and allow the pending sender.
|
|
93
|
-
5. Send the message again to start a Codex turn.
|
|
94
|
-
|
|
95
|
-
Repeat the QR flow to add more accounts. Every account has its own monitor, sender authorization, inbound directory, and managed-session state. A failed account does not stop the others. Scanning the same WeChat account again after an expired login refreshes the existing credentials while preserving its local remark, authorization, and sessions instead of creating an empty duplicate. Account removal can retain history: credentials are deleted immediately, while a later scan by the same WeChat user restores the previous remark, authorization, and managed sessions.
|
|
96
|
-
|
|
97
|
-
## Session management
|
|
98
|
-
|
|
99
|
-
The Sessions page manages conversations created and used by this server. It does not scan or take ownership of every Codex conversation created in other terminals.
|
|
100
|
-
|
|
101
|
-
Selecting a session reads its user messages and final replies from Codex's own persisted thread. The controls below the chat title select a model, reasoning effort, and process-progress behavior for the current session or keep inheriting global settings; they share the same session configuration used by the WeChat `/model`, `/effort`, and `/stream` commands. Process progress is enabled by default, appears in a collapsible Web timeline with elapsed time, and leaves the final answer as one stable response. The Web composer can submit text and multiple files as one turn and continues that same thread, so context remains shared with later WeChat messages. Uploads are isolated by account and session under `~/.codex-weixin/inbound/`, with at most 10 files and 100 MiB total per turn.
|
|
102
|
-
|
|
103
|
-
The UI uses local remarks instead of treating internal IDs as account names. Expand “Account IDs” on an account card to inspect its iLink Bot ID and User ID; Codex thread IDs remain hidden from the regular UI. Each account can have a local remark edited from the WeChat Accounts page; the remark is reused by session tabs, with `WeChat Account 1` used only as a fallback. The current QR and messaging APIs do not expose WeChat nicknames, avatars, or a profile lookup endpoint, so the page uses a default icon.
|
|
104
|
-
|
|
105
|
-
- Each authorized WeChat account has one active session and may own multiple named sessions.
|
|
106
|
-
- Activate chooses which Codex thread receives the sender's next message.
|
|
107
|
-
- Reset clears the recorded thread so the next message starts fresh context.
|
|
108
|
-
- Delete removes only the bridge record, not Codex's own history files.
|
|
109
|
-
- `/new` creates a new managed session for the current sender.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
/
|
|
116
|
-
/
|
|
117
|
-
/
|
|
118
|
-
/
|
|
119
|
-
/
|
|
120
|
-
/
|
|
121
|
-
/
|
|
122
|
-
/
|
|
123
|
-
/
|
|
124
|
-
/
|
|
125
|
-
/
|
|
126
|
-
/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
npm
|
|
206
|
-
npm run
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
+
<a href="./README.md">中文</a> | <strong>English</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>Connect multiple personal WeChat accounts to a local OpenAI Codex installation.</strong>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
`codex-weixin` is a cross-platform, local-only WeChat service dedicated to Codex. Starting it opens a Web management page where users scan a WeChat QR code, manage accounts and workspaces, and switch Codex sessions.
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
Multiple WeChat accounts <-> codex-weixin <-> local Codex <-> allowed workspaces
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
It is not a general messaging gateway. The management page is never exposed to the LAN or public Internet.
|
|
22
|
+
|
|
23
|
+
## Feature status
|
|
24
|
+
|
|
25
|
+
Screenshots live under `docs/images/screenshots/`. The Web management screenshot is included; rows that require a phone view reserve stable filenames for later WeChat captures.
|
|
26
|
+
|
|
27
|
+
| Status | Feature | Details | Screenshot |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| ✅ | Local Web management | A `127.0.0.1`-only page manages WeChat accounts, sessions, workspaces, and Codex settings. | [Web sessions](docs/images/screenshots/web-session-management.png) |
|
|
30
|
+
| ✅ | Multiple WeChat accounts | One service runs multiple accounts with local remarks and isolated authorization, attachments, and sessions; account removal can retain history. | [Web sessions](docs/images/screenshots/web-session-management.png) |
|
|
31
|
+
| ✅ | Browser QR connection | Shows waiting, scanned, connected, and expired QR states. | Pending: `docs/images/screenshots/wechat-qr-login.png` |
|
|
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
|
+
| ✅ | 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`, `/resume`, `/bind`, `/model`, `/effort`, `/prompt start`, `/prompt done`, and `/stop`. | Pending: `docs/images/screenshots/wechat-chat.png` |
|
|
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
|
+
| ✅ | 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
|
+
| ✅ | 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` |
|
|
38
|
+
| ✅ | Process progress | Enabled by default; Codex progress reaches WeChat immediately and appears in a collapsible Web timeline with elapsed time, while final answers stay intact. | Pending: `docs/images/screenshots/web-process-progress.png` |
|
|
39
|
+
| ✅ | Typing state and deduplication | Web typing state plus persistent sync cursors and message IDs prevent duplicate replies. | Pending: `docs/images/screenshots/wechat-typing.png` |
|
|
40
|
+
| ✅ | App-server first | New and resumed sessions prefer Codex app-server V2 and fall back to `codex exec` when unavailable. | Pending: `docs/images/screenshots/wechat-status.png` |
|
|
41
|
+
| ✅ | Web auto-update | Selects npm or npmmirror, updates the active npm runtime, verifies it, then restarts and reconnects. | Pending: `docs/images/screenshots/web-auto-update.png` |
|
|
42
|
+
|
|
43
|
+
## Web management preview
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="docs/images/screenshots/web-session-management.png" alt="codex-weixin Web session management" width="100%" />
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- Node.js `>=22`
|
|
52
|
+
- Git
|
|
53
|
+
- An installed and authenticated Codex CLI
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @openai/codex
|
|
57
|
+
codex --version
|
|
58
|
+
codex
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Install and start
|
|
62
|
+
|
|
63
|
+
Install globally from npm:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install -g codex-weixin
|
|
67
|
+
codex-weixin
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or install from source:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/XavierJiezou/codex-weixin.git
|
|
74
|
+
cd codex-weixin
|
|
75
|
+
npm install
|
|
76
|
+
npm run build
|
|
77
|
+
npm install -g .
|
|
78
|
+
codex-weixin
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The service opens [http://127.0.0.1:8787](http://127.0.0.1:8787). To run without a global install:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm start
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## First connection
|
|
88
|
+
|
|
89
|
+
1. Open Settings and confirm the default and allowed Codex workspaces.
|
|
90
|
+
2. Select Add WeChat, scan the QR code, and confirm in WeChat.
|
|
91
|
+
3. Send any message to the connected account.
|
|
92
|
+
4. Return to WeChat Accounts and allow the pending sender.
|
|
93
|
+
5. Send the message again to start a Codex turn.
|
|
94
|
+
|
|
95
|
+
Repeat the QR flow to add more accounts. Every account has its own monitor, sender authorization, inbound directory, and managed-session state. A failed account does not stop the others. Scanning the same WeChat account again after an expired login refreshes the existing credentials while preserving its local remark, authorization, and sessions instead of creating an empty duplicate. Account removal can retain history: credentials are deleted immediately, while a later scan by the same WeChat user restores the previous remark, authorization, and managed sessions.
|
|
96
|
+
|
|
97
|
+
## Session management
|
|
98
|
+
|
|
99
|
+
The Sessions page manages conversations created and used by this server. It does not scan or take ownership of every Codex conversation created in other terminals.
|
|
100
|
+
|
|
101
|
+
Selecting a session reads its user messages and final replies from Codex's own persisted thread. The controls below the chat title select a model, reasoning effort, and process-progress behavior for the current session or keep inheriting global settings; they share the same session configuration used by the WeChat `/model`, `/effort`, and `/stream` commands. Process progress is enabled by default, appears in a collapsible Web timeline with elapsed time, and leaves the final answer as one stable response. The Web composer can submit text and multiple files as one turn and continues that same thread, so context remains shared with later WeChat messages. Uploads are isolated by account and session under `~/.codex-weixin/inbound/`, with at most 10 files and 100 MiB total per turn.
|
|
102
|
+
|
|
103
|
+
The UI uses local remarks instead of treating internal IDs as account names. Expand “Account IDs” on an account card to inspect its iLink Bot ID and User ID; Codex thread IDs remain hidden from the regular UI. Each account can have a local remark edited from the WeChat Accounts page; the remark is reused by session tabs, with `WeChat Account 1` used only as a fallback. The current QR and messaging APIs do not expose WeChat nicknames, avatars, or a profile lookup endpoint, so the page uses a default icon.
|
|
104
|
+
|
|
105
|
+
- Each authorized WeChat account has one active session and may own multiple named sessions.
|
|
106
|
+
- Activate chooses which Codex thread receives the sender's next message.
|
|
107
|
+
- Reset clears the recorded thread so the next message starts fresh context.
|
|
108
|
+
- Delete removes only the bridge record, not Codex's own history files.
|
|
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.
|
|
111
|
+
|
|
112
|
+
## WeChat commands
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
/help Show commands
|
|
116
|
+
/status Show session, workspace, thread, backend, effective model, and reasoning effort
|
|
117
|
+
/bind <absolute-path> Bind to an allowed workspace
|
|
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
|
|
121
|
+
/model Show the current and available models
|
|
122
|
+
/model <number|model|default> Switch this session's model or restore inheritance
|
|
123
|
+
/effort Show reasoning efforts supported by the current model
|
|
124
|
+
/effort <number|level|default> Switch this session's effort or restore inheritance
|
|
125
|
+
/stream Show this session's process-progress setting
|
|
126
|
+
/stream <on|off|default> Enable, disable, or restore global process progress
|
|
127
|
+
/prompt start Buffer multiple WeChat messages
|
|
128
|
+
/prompt done Submit the buffer as one Codex turn
|
|
129
|
+
/stop Interrupt the current Codex task
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Regular messages enter the active session. Images, files, videos, and voice/audio without transcription are saved under the account's inbound directory and added to the prompt by local path. WeChat voice transcription is preferred when available.
|
|
133
|
+
|
|
134
|
+
## Sending local files
|
|
135
|
+
|
|
136
|
+
Codex can request local-file delivery in its final response:
|
|
137
|
+
|
|
138
|
+
````text
|
|
139
|
+
```codex-weixin-actions
|
|
140
|
+
{
|
|
141
|
+
"send": [
|
|
142
|
+
{ "type": "image", "path": "/absolute/path/chart.png" },
|
|
143
|
+
{ "type": "video", "path": "/absolute/path/demo.mp4" },
|
|
144
|
+
{ "type": "file", "path": "/absolute/path/report.pdf" }
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
````
|
|
149
|
+
|
|
150
|
+
Only absolute local paths are accepted. Native outbound types are `image`, `video`, and `file`; audio is sent as a regular file. Remote URLs are not uploaded as local files.
|
|
151
|
+
|
|
152
|
+
## Codex backend
|
|
153
|
+
|
|
154
|
+
The default `codexBackend` is `auto`. On the first Codex message, the service starts one persistent `codex app-server --stdio` process and uses the current `initialize`, `thread/*`, and `turn/*` protocol. New and resumed conversations prefer app-server; startup, handshake, or request failures automatically fall back to `codex exec` or `codex exec resume`.
|
|
155
|
+
|
|
156
|
+
WeChat does not currently expose Codex approval prompts, so app-server uses `approvalPolicy: "never"` and operates only within the configured Codex sandbox instead of waiting for an approval that cannot be answered in WeChat. The management page can still pin the backend to `app-server` or `exec` for diagnostics.
|
|
157
|
+
|
|
158
|
+
## Models and reasoning effort
|
|
159
|
+
|
|
160
|
+
The Settings page loads available models and model-specific reasoning efforts from Codex app-server. Leaving a field on "Use Codex settings" preserves the Codex configuration; choosing and saving an explicit value applies it to later Web and WeChat turns.
|
|
161
|
+
|
|
162
|
+
Send `/model` or `/effort` in WeChat to get a numbered list, then switch by number or exact ID. A WeChat-side selection applies only to the active managed session, without affecting other accounts, senders, or sessions. `/model default` and `/effort default` restore inheritance from Web/Codex settings. Continuing that session from the Web page uses the same session overrides.
|
|
163
|
+
|
|
164
|
+
The IkunCoding provider also exposes `gpt-5.6-sol`, `gpt-5.6-terra`, and `gpt-5.6-luna`. These options remain available after switching to another model in both the Web dropdown and WeChat `/model` list. Send `/status` in WeChat to inspect the effective model and reasoning effort.
|
|
165
|
+
|
|
166
|
+
## Local data
|
|
167
|
+
|
|
168
|
+
Service state and the default Codex workspace share this directory:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
~/.codex-weixin/
|
|
172
|
+
accounts/ One credential file per WeChat account
|
|
173
|
+
retained-accounts.json Recovery index for removed accounts; never stores tokens
|
|
174
|
+
runtime/<account-id>/ Sender authorization and managed sessions
|
|
175
|
+
inbound/<account-id>/ Inbound WeChat attachments
|
|
176
|
+
config.json Codex and workspace configuration
|
|
177
|
+
logs/
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Do not commit or share this directory. The management API never returns WeChat tokens to the browser.
|
|
181
|
+
|
|
182
|
+
## Startup settings
|
|
183
|
+
|
|
184
|
+
The server always binds to `127.0.0.1`. Environment variables can change its port and state directory or disable automatic browser opening:
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
CODEX_WEIXIN_PORT=8787
|
|
188
|
+
CODEX_WEIXIN_STATE_DIR=/absolute/private/path
|
|
189
|
+
CODEX_WEIXIN_OPEN=0
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Security model
|
|
193
|
+
|
|
194
|
+
- Non-local Host and Origin values are rejected.
|
|
195
|
+
- Every mutating API call requires an in-memory page token.
|
|
196
|
+
- WeChat credentials never reach the management page.
|
|
197
|
+
- Unknown senders are denied until explicitly allowed.
|
|
198
|
+
- `/bind` accepts only absolute paths under the workspace allowlist.
|
|
199
|
+
- `danger-full-access` bypasses the Codex filesystem sandbox and must be enabled only when full-machine access is acceptable.
|
|
200
|
+
- Concurrent accounts share local compute resources and Codex quotas.
|
|
201
|
+
|
|
202
|
+
## Development
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
npm install
|
|
206
|
+
npm run dev
|
|
207
|
+
npm test
|
|
208
|
+
npm run typecheck
|
|
209
|
+
npm run build
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The project is a clean-room independent implementation under the MIT License. Its iLink integration shape references `Tencent/openclaw-weixin`, along with public Codex/WeChat projects for app-server, media-transfer, and security-boundary practices. No AGPL source code was copied.
|
|
213
|
+
|
|
214
|
+
When started from a source checkout with `npm run dev` or `npm start`, the Web page checks for updates but does not install them; update the Git checkout and rebuild instead. Global installations and isolated `node_modules/codex-weixin` runtimes update the npm prefix that owns the active package and verify the target version and service entry before restarting. On Windows, the updater first releases any process working-directory lock inside the package tree so npm can replace it without `EBUSY`.
|
|
215
|
+
|
|
216
|
+
See [CHANGELOG.md](./CHANGELOG.md) for release history.
|
package/README.md
CHANGED
|
@@ -20,63 +20,63 @@
|
|
|
20
20
|
|
|
21
21
|
它不是通用消息网关,不接入其他聊天平台,也不把管理页面开放到局域网或公网。
|
|
22
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`、`/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>
|
|
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
80
|
|
|
81
81
|
## 环境要求
|
|
82
82
|
|
|
@@ -138,6 +138,7 @@ npm start
|
|
|
138
138
|
- “重置”清空本服务记录的 thread,下一条消息创建新上下文。
|
|
139
139
|
- “删除”只删除本服务中的会话记录,不删除 Codex 自身保存的历史文件。
|
|
140
140
|
- 微信中的 `/new` 会立即为当前联系人创建新的受管会话。
|
|
141
|
+
- 微信中的 `/resume` 会按最近更新时间列出当前联系人的历史会话、最近内容摘要和时间;发送 `/resume <序号>` 可切换并继续原来的 Codex thread。
|
|
141
142
|
|
|
142
143
|
## 微信内命令
|
|
143
144
|
|
|
@@ -146,6 +147,8 @@ npm start
|
|
|
146
147
|
/status 查看当前会话、工作目录、thread、backend、实际模型和推理强度
|
|
147
148
|
/bind <absolute-path> 绑定到允许列表内的工作目录
|
|
148
149
|
/new 创建新的受管 Codex 会话
|
|
150
|
+
/resume 查看历史会话、最近内容摘要和序号
|
|
151
|
+
/resume <序号> 切换并继续指定的历史会话
|
|
149
152
|
/model 查看当前模型和可用模型
|
|
150
153
|
/model <序号|模型 ID|default> 切换当前会话模型,或恢复继承设置
|
|
151
154
|
/effort 查看当前模型支持的推理强度
|
|
@@ -256,4 +259,4 @@ npm run build
|
|
|
256
259
|
|
|
257
260
|
## 社区
|
|
258
261
|
|
|
259
|
-
感谢 [LINUX DO](https://linux.do/) 社区佬友的支持与反馈。
|
|
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]) {
|