wechatbridge-cli 1.3.4__tar.gz → 1.4.0__tar.gz

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 (24) hide show
  1. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/PKG-INFO +26 -15
  2. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/README.md +23 -12
  3. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/pyproject.toml +2 -2
  4. wechatbridge_cli-1.4.0/tests/test_codex.py +978 -0
  5. wechatbridge_cli-1.4.0/tests/test_hardening.py +822 -0
  6. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/__init__.py +1 -1
  7. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/agy.py +7 -13
  8. wechatbridge_cli-1.4.0/wechatbridge/codex.py +933 -0
  9. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/config.py +5 -2
  10. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/grok.py +100 -12
  11. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/main.py +46 -12
  12. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/runner_common.py +235 -25
  13. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge_cli.egg-info/PKG-INFO +26 -15
  14. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge_cli.egg-info/SOURCES.txt +2 -0
  15. wechatbridge_cli-1.3.4/tests/test_hardening.py +0 -314
  16. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/LICENSE +0 -0
  17. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/setup.cfg +0 -0
  18. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/__main__.py +0 -0
  19. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/ilink.py +0 -0
  20. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge/update_check.py +0 -0
  21. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge_cli.egg-info/dependency_links.txt +0 -0
  22. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge_cli.egg-info/entry_points.txt +0 -0
  23. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge_cli.egg-info/requires.txt +0 -0
  24. {wechatbridge_cli-1.3.4 → wechatbridge_cli-1.4.0}/wechatbridge_cli.egg-info/top_level.txt +0 -0
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wechatbridge-cli
3
- Version: 1.3.4
4
- Summary: Bridge WeChat messages to agy or Grok Build CLIs — text/image/file/voice in, CLI replies and generated files back.
3
+ Version: 1.4.0
4
+ Summary: Bridge WeChat messages to agy, Grok Build, or Codex CLIs — text/image/file/voice in, CLI replies and generated files back.
5
5
  Author: WeChatBridge contributors
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/dorokuma/wechatbridge
8
8
  Project-URL: Repository, https://github.com/dorokuma/wechatbridge
9
9
  Project-URL: Issues, https://github.com/dorokuma/wechatbridge/issues
10
10
  Project-URL: Changelog, https://github.com/dorokuma/wechatbridge/blob/main/CHANGELOG.md
11
- Keywords: wechat,bot,bridge,agy,grok
11
+ Keywords: wechat,bot,bridge,agy,grok,codex
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: Environment :: Console
14
14
  Classifier: Intended Audience :: Developers
@@ -36,10 +36,10 @@ Dynamic: license-file
36
36
  ![license](https://img.shields.io/badge/license-MIT-blue.svg)
37
37
  ![python](https://img.shields.io/badge/python-3.10+-blue.svg)
38
38
 
39
- WeChatBridge connects a WeChat bot to agentic coding CLIs (Google's agy / Antigravity, or xAI's Grok Build). From WeChat you can send text, images, files, and voice-as-text to the active CLI, get replies back, and receive certain generated files over the WeChat CDN. Switch backends per user with `/backend` — no restart.
39
+ WeChatBridge connects a WeChat bot to agentic coding CLIs (Google's agy / Antigravity, xAI's Grok Build, or OpenAI's Codex). From WeChat you can send text, images, files, and voice-as-text to the active CLI, get replies back, and receive certain generated files over the WeChat CDN. Switch backends per user with `/backend` — no restart.
40
40
 
41
41
  ```
42
- WeChat (phone) ⇄ iLink bot API ⇄ WeChatBridge ⇄ agy / grok CLI
42
+ WeChat (phone) ⇄ iLink bot API ⇄ WeChatBridge ⇄ agy / grok / codex CLI
43
43
  (this project) (runs tools)
44
44
  ```
45
45
 
@@ -47,10 +47,10 @@ The bridge process stays up and long-polls iLink. For prompts that go to a CLI,
47
47
 
48
48
  ## Features
49
49
 
50
- - Text, image, file, and voice (WeChat server-side transcription only) go to the **active** backend (`agy` or `grok`)
50
+ - Text, image, file, and voice (WeChat server-side transcription only) go to the **active** backend (`agy`, `grok`, or `codex`)
51
51
  - Detected CLI artifacts under the per-user allowed tree can be sent back (size-capped); not every file the CLI touches
52
52
  - Each WeChat user gets an isolated workspace; model / effort / mode are remembered **per backend**
53
- - Runtime backend switch: `/backend agy` or `/backend grok` (clears the “continue session” flag so the next CLI turn starts without `-c` / `--continue`; does not immediately wipe history files on disk)
53
+ - Runtime backend switch: `/backend agy`, `/backend grok`, or `/backend codex` (clears that backend's continuation state — the agy/grok continuation flag and the codex `thread_id`/resume state — so the next CLI turn starts a fresh session; history files on disk are not wiped immediately)
54
54
  - Slash commands for model, session reset, persona, and more (see below)
55
55
  - Dangerous-prompt gate: a **keyword list** of concrete destructive patterns asks for confirmation before run
56
56
  - Sender whitelist (`WECHATBRIDGE_ALLOWED_SENDERS`; empty = allow all)
@@ -71,15 +71,24 @@ Default data paths expand from `~` (e.g. `~/.local/share/wechatbridge/<instance>
71
71
 
72
72
  - **agy** (default) — Google Antigravity CLI
73
73
  - **grok** — xAI Grok Build CLI
74
+ - **codex** — OpenAI Codex CLI
74
75
 
75
- Per-user switch: `/backend agy` or `/backend grok`. Each backend keeps its own model / effort / mode memory and persona file layout. Global default is `WECHATBRIDGE_BACKEND`.
76
+ Per-user switch: `/backend agy`, `/backend grok`, or `/backend codex`. Each backend keeps its own model / effort / mode memory and persona file layout. Global default is `WECHATBRIDGE_BACKEND`.
77
+
78
+ ### Codex backend notes
79
+
80
+ - Runs `codex exec --json` for each single turn; conversation continuation uses `codex exec resume <thread_id> <prompt>` with the thread id persisted per user.
81
+ - Isolation: each WeChat user runs with `HOME` and `CODEX_HOME` pointed at their own per-user session directory (`session_dir/.codex`), so sessions, logs, and caches never cross users.
82
+ - Auth: the per-user session links to the host `~/.codex/auth.json` (copied as a fallback), reusing the host `codex login`. Alternatively, set `CODEX_API_KEY` in the bridge process environment to authenticate. No key or token values are stored in this repository.
83
+ - **Status:** there is currently no real Codex subscription or CLI available for live testing. The codex backend is implemented from source research, a JSONL fixture, and a fake CLI used by the test suite (which passes). Final acceptance depends on a real user running it against the actual Codex CLI.
76
84
 
77
85
  ## Prerequisites
78
86
 
79
87
  - At least one CLI installed and signed in:
80
88
  - **agy** on `PATH`, or set `AGY_BIN_PATH`
81
89
  - **and/or grok** on `PATH`, or set `GROK_BIN_PATH`
82
- - Antigravity is Google's terminal agentic coding CLI (successor to Gemini CLI). Grok Build is xAI's counterpart.
90
+ - **and/or codex** on `PATH`, or set `CODEX_BIN_PATH`
91
+ - Antigravity is Google's terminal agentic coding CLI (successor to Gemini CLI). Grok Build is xAI's counterpart; Codex is OpenAI's terminal agentic coding CLI.
83
92
  - A WeChat account with a [ClawBot / iLink](https://ilinkai.weixin.qq.com) bot (QR bind on first run)
84
93
  - Python 3.10+
85
94
 
@@ -149,10 +158,11 @@ Key variables (all have defaults):
149
158
  |---|---|---|
150
159
  | `AGY_BIN_PATH` | `agy` | path to the agy binary |
151
160
  | `GROK_BIN_PATH` | `grok` | path to the grok binary |
152
- | `WECHATBRIDGE_BACKEND` | `agy` | global default backend (`agy` / `grok`; overridable per user via `/backend`) |
161
+ | `CODEX_BIN_PATH` | `codex` | path to the codex binary |
162
+ | `WECHATBRIDGE_BACKEND` | `agy` | global default backend (`agy` / `grok` / `codex`; overridable per user via `/backend`) |
153
163
  | `WECHATBRIDGE_INSTANCE` | `default` | instance name; state / session / QR paths derive from it |
154
164
  | `WECHATBRIDGE_ALLOWED_SENDERS` | _empty_ | comma-separated WeChat IDs (empty = allow all) |
155
- | `AGY_TIMEOUT` | `600` | CLI run timeout in seconds (both backends) |
165
+ | `AGY_TIMEOUT` | `600` | CLI run timeout in seconds (all three backends) |
156
166
  | `WECHATBRIDGE_MAX_OUTBOUND_BYTES` | `104857600` | max file size sent back to WeChat (100 MB) |
157
167
  | `WECHATBRIDGE_MAX_INBOUND_BYTES` | `20971520` | max inbound image/file after download (20 MB) |
158
168
  | `WECHATBRIDGE_MAX_CONCURRENT` | `4` | global concurrent process slots; same user serial (queue does not hold a slot); extras get a busy reply |
@@ -238,10 +248,10 @@ See [`deploy/wechatbridge-windows.md`](deploy/wechatbridge-windows.md).
238
248
  | Command | Action |
239
249
  |---|---|
240
250
  | `/help` | list supported commands for the active backend |
241
- | `/backend <agy\|grok>` | switch CLI backend for this WeChat user (on real change: drop continue flag; history files may remain until retention cleanup) |
251
+ | `/backend <agy\|grok\|codex>` | switch CLI backend for this WeChat user (on real change: clears that backend's continuation state — agy/grok flag and codex `thread_id`/resume — so the next turn starts a fresh session; history files may remain until retention cleanup) |
242
252
  | `/clear` or `/new` | drop continue flag so the next CLI turn is a new conversation (does not instantly delete history files) |
243
- | `/model <name>` | set model (validated against the backend's model list; see `/models`) |
244
- | `/models` | list models from the active CLI |
253
+ | `/model <name>` | set model (validation differs by backend: agy/grok check against the live model list; codex stores the name without verifying, so a typo only surfaces on the next run; see `/models`) |
254
+ | `/models` | list models — agy/grok query the live CLI; codex returns a built-in reference list, not your actual account's models |
245
255
  | `/fast` | set low reasoning effort (**on only** — not a toggle; no “off” command) |
246
256
  | `/planning` | set planning mode (**on only** — not a toggle) |
247
257
  | `/add-dir <path>` | **agy:** pass `--add-dir` on later runs if path is allowed. **grok:** recorded only; not passed to the CLI yet |
@@ -270,7 +280,8 @@ Other `/…` commands are either rejected (e.g. `/exit`), reported as unsupporte
270
280
 
271
281
  ## Limitations
272
282
 
273
- - Not a standalone agent — requires agy and/or grok.
283
+ - Not a standalone agent — requires agy and/or grok and/or codex.
284
+ - The **codex** backend is not yet verified against a real Codex subscription/CLI; it is validated by source research, a JSONL fixture, and a fake CLI in tests. Treat it as community-tested until a real user confirms.
274
285
  - Voice is WeChat speech-to-text only; no local ASR; empty transcript → “type instead”.
275
286
  - No video send/receive; no native WeChat voice-bubble replies (no silk encode).
276
287
  - One WeChat binding per process; multiple accounts need multiple instances (`WECHATBRIDGE_INSTANCE`).
@@ -5,10 +5,10 @@
5
5
  ![license](https://img.shields.io/badge/license-MIT-blue.svg)
6
6
  ![python](https://img.shields.io/badge/python-3.10+-blue.svg)
7
7
 
8
- WeChatBridge connects a WeChat bot to agentic coding CLIs (Google's agy / Antigravity, or xAI's Grok Build). From WeChat you can send text, images, files, and voice-as-text to the active CLI, get replies back, and receive certain generated files over the WeChat CDN. Switch backends per user with `/backend` — no restart.
8
+ WeChatBridge connects a WeChat bot to agentic coding CLIs (Google's agy / Antigravity, xAI's Grok Build, or OpenAI's Codex). From WeChat you can send text, images, files, and voice-as-text to the active CLI, get replies back, and receive certain generated files over the WeChat CDN. Switch backends per user with `/backend` — no restart.
9
9
 
10
10
  ```
11
- WeChat (phone) ⇄ iLink bot API ⇄ WeChatBridge ⇄ agy / grok CLI
11
+ WeChat (phone) ⇄ iLink bot API ⇄ WeChatBridge ⇄ agy / grok / codex CLI
12
12
  (this project) (runs tools)
13
13
  ```
14
14
 
@@ -16,10 +16,10 @@ The bridge process stays up and long-polls iLink. For prompts that go to a CLI,
16
16
 
17
17
  ## Features
18
18
 
19
- - Text, image, file, and voice (WeChat server-side transcription only) go to the **active** backend (`agy` or `grok`)
19
+ - Text, image, file, and voice (WeChat server-side transcription only) go to the **active** backend (`agy`, `grok`, or `codex`)
20
20
  - Detected CLI artifacts under the per-user allowed tree can be sent back (size-capped); not every file the CLI touches
21
21
  - Each WeChat user gets an isolated workspace; model / effort / mode are remembered **per backend**
22
- - Runtime backend switch: `/backend agy` or `/backend grok` (clears the “continue session” flag so the next CLI turn starts without `-c` / `--continue`; does not immediately wipe history files on disk)
22
+ - Runtime backend switch: `/backend agy`, `/backend grok`, or `/backend codex` (clears that backend's continuation state — the agy/grok continuation flag and the codex `thread_id`/resume state — so the next CLI turn starts a fresh session; history files on disk are not wiped immediately)
23
23
  - Slash commands for model, session reset, persona, and more (see below)
24
24
  - Dangerous-prompt gate: a **keyword list** of concrete destructive patterns asks for confirmation before run
25
25
  - Sender whitelist (`WECHATBRIDGE_ALLOWED_SENDERS`; empty = allow all)
@@ -40,15 +40,24 @@ Default data paths expand from `~` (e.g. `~/.local/share/wechatbridge/<instance>
40
40
 
41
41
  - **agy** (default) — Google Antigravity CLI
42
42
  - **grok** — xAI Grok Build CLI
43
+ - **codex** — OpenAI Codex CLI
43
44
 
44
- Per-user switch: `/backend agy` or `/backend grok`. Each backend keeps its own model / effort / mode memory and persona file layout. Global default is `WECHATBRIDGE_BACKEND`.
45
+ Per-user switch: `/backend agy`, `/backend grok`, or `/backend codex`. Each backend keeps its own model / effort / mode memory and persona file layout. Global default is `WECHATBRIDGE_BACKEND`.
46
+
47
+ ### Codex backend notes
48
+
49
+ - Runs `codex exec --json` for each single turn; conversation continuation uses `codex exec resume <thread_id> <prompt>` with the thread id persisted per user.
50
+ - Isolation: each WeChat user runs with `HOME` and `CODEX_HOME` pointed at their own per-user session directory (`session_dir/.codex`), so sessions, logs, and caches never cross users.
51
+ - Auth: the per-user session links to the host `~/.codex/auth.json` (copied as a fallback), reusing the host `codex login`. Alternatively, set `CODEX_API_KEY` in the bridge process environment to authenticate. No key or token values are stored in this repository.
52
+ - **Status:** there is currently no real Codex subscription or CLI available for live testing. The codex backend is implemented from source research, a JSONL fixture, and a fake CLI used by the test suite (which passes). Final acceptance depends on a real user running it against the actual Codex CLI.
45
53
 
46
54
  ## Prerequisites
47
55
 
48
56
  - At least one CLI installed and signed in:
49
57
  - **agy** on `PATH`, or set `AGY_BIN_PATH`
50
58
  - **and/or grok** on `PATH`, or set `GROK_BIN_PATH`
51
- - Antigravity is Google's terminal agentic coding CLI (successor to Gemini CLI). Grok Build is xAI's counterpart.
59
+ - **and/or codex** on `PATH`, or set `CODEX_BIN_PATH`
60
+ - Antigravity is Google's terminal agentic coding CLI (successor to Gemini CLI). Grok Build is xAI's counterpart; Codex is OpenAI's terminal agentic coding CLI.
52
61
  - A WeChat account with a [ClawBot / iLink](https://ilinkai.weixin.qq.com) bot (QR bind on first run)
53
62
  - Python 3.10+
54
63
 
@@ -118,10 +127,11 @@ Key variables (all have defaults):
118
127
  |---|---|---|
119
128
  | `AGY_BIN_PATH` | `agy` | path to the agy binary |
120
129
  | `GROK_BIN_PATH` | `grok` | path to the grok binary |
121
- | `WECHATBRIDGE_BACKEND` | `agy` | global default backend (`agy` / `grok`; overridable per user via `/backend`) |
130
+ | `CODEX_BIN_PATH` | `codex` | path to the codex binary |
131
+ | `WECHATBRIDGE_BACKEND` | `agy` | global default backend (`agy` / `grok` / `codex`; overridable per user via `/backend`) |
122
132
  | `WECHATBRIDGE_INSTANCE` | `default` | instance name; state / session / QR paths derive from it |
123
133
  | `WECHATBRIDGE_ALLOWED_SENDERS` | _empty_ | comma-separated WeChat IDs (empty = allow all) |
124
- | `AGY_TIMEOUT` | `600` | CLI run timeout in seconds (both backends) |
134
+ | `AGY_TIMEOUT` | `600` | CLI run timeout in seconds (all three backends) |
125
135
  | `WECHATBRIDGE_MAX_OUTBOUND_BYTES` | `104857600` | max file size sent back to WeChat (100 MB) |
126
136
  | `WECHATBRIDGE_MAX_INBOUND_BYTES` | `20971520` | max inbound image/file after download (20 MB) |
127
137
  | `WECHATBRIDGE_MAX_CONCURRENT` | `4` | global concurrent process slots; same user serial (queue does not hold a slot); extras get a busy reply |
@@ -207,10 +217,10 @@ See [`deploy/wechatbridge-windows.md`](deploy/wechatbridge-windows.md).
207
217
  | Command | Action |
208
218
  |---|---|
209
219
  | `/help` | list supported commands for the active backend |
210
- | `/backend <agy\|grok>` | switch CLI backend for this WeChat user (on real change: drop continue flag; history files may remain until retention cleanup) |
220
+ | `/backend <agy\|grok\|codex>` | switch CLI backend for this WeChat user (on real change: clears that backend's continuation state — agy/grok flag and codex `thread_id`/resume — so the next turn starts a fresh session; history files may remain until retention cleanup) |
211
221
  | `/clear` or `/new` | drop continue flag so the next CLI turn is a new conversation (does not instantly delete history files) |
212
- | `/model <name>` | set model (validated against the backend's model list; see `/models`) |
213
- | `/models` | list models from the active CLI |
222
+ | `/model <name>` | set model (validation differs by backend: agy/grok check against the live model list; codex stores the name without verifying, so a typo only surfaces on the next run; see `/models`) |
223
+ | `/models` | list models — agy/grok query the live CLI; codex returns a built-in reference list, not your actual account's models |
214
224
  | `/fast` | set low reasoning effort (**on only** — not a toggle; no “off” command) |
215
225
  | `/planning` | set planning mode (**on only** — not a toggle) |
216
226
  | `/add-dir <path>` | **agy:** pass `--add-dir` on later runs if path is allowed. **grok:** recorded only; not passed to the CLI yet |
@@ -239,7 +249,8 @@ Other `/…` commands are either rejected (e.g. `/exit`), reported as unsupporte
239
249
 
240
250
  ## Limitations
241
251
 
242
- - Not a standalone agent — requires agy and/or grok.
252
+ - Not a standalone agent — requires agy and/or grok and/or codex.
253
+ - The **codex** backend is not yet verified against a real Codex subscription/CLI; it is validated by source research, a JSONL fixture, and a fake CLI in tests. Treat it as community-tested until a real user confirms.
243
254
  - Voice is WeChat speech-to-text only; no local ASR; empty transcript → “type instead”.
244
255
  - No video send/receive; no native WeChat voice-bubble replies (no silk encode).
245
256
  - One WeChat binding per process; multiple accounts need multiple instances (`WECHATBRIDGE_INSTANCE`).
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "wechatbridge-cli"
3
3
  dynamic = ["version"]
4
- description = "Bridge WeChat messages to agy or Grok Build CLIs — text/image/file/voice in, CLI replies and generated files back."
4
+ description = "Bridge WeChat messages to agy, Grok Build, or Codex CLIs — text/image/file/voice in, CLI replies and generated files back."
5
5
  requires-python = ">=3.10"
6
6
  readme = "README.md"
7
7
  license = { text = "MIT" }
@@ -9,7 +9,7 @@ urls = { Homepage = "https://github.com/dorokuma/wechatbridge", Repository = "ht
9
9
  authors = [
10
10
  { name = "WeChatBridge contributors" },
11
11
  ]
12
- keywords = ["wechat", "bot", "bridge", "agy", "grok"]
12
+ keywords = ["wechat", "bot", "bridge", "agy", "grok", "codex"]
13
13
  classifiers = [
14
14
  "Development Status :: 4 - Beta",
15
15
  "Environment :: Console",