@agent-wechat/cli 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +12 -1
  2. package/dist/cli.js +13 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ wx messages send <chatId> --text "Hello"
43
43
 
44
44
  | Command | Description |
45
45
  |---------|-------------|
46
- | `wx up` | Start the agent-wechat container |
46
+ | `wx up [--proxy user:pass@host:port]` | Start the agent-wechat container |
47
47
  | `wx down` | Stop and remove the container |
48
48
  | `wx logs` | Tail container logs |
49
49
  | `wx status` | Show container and login status |
@@ -146,6 +146,14 @@ This starts a container named `agent-wechat` with:
146
146
  - Persistent volumes for data and WeChat home directory
147
147
  - Auth token from `~/.config/agent-wechat/token` (auto-generated on first run)
148
148
 
149
+ To route all container traffic through a proxy:
150
+
151
+ ```bash
152
+ wx up --proxy user:pass@host:port
153
+ ```
154
+
155
+ This sets up a transparent proxy (redsocks + iptables) inside the container — invisible to WeChat. Prefix with `socks5://` for SOCKS5 proxies.
156
+
149
157
  ### Option 2: Docker Compose (production / networked)
150
158
 
151
159
  For production or when running alongside other services (e.g., OpenClaw), use the `docker-compose.yml` in the repo root as a reference:
@@ -159,6 +167,7 @@ services:
159
167
  - seccomp=unconfined
160
168
  cap_add:
161
169
  - SYS_PTRACE
170
+ - NET_ADMIN
162
171
  ports:
163
172
  - "6174:6174"
164
173
  - "127.0.0.1:5900:5900"
@@ -166,6 +175,8 @@ services:
166
175
  - agent-wechat-data:/data
167
176
  - agent-wechat-home:/home/wechat
168
177
  - ~/.config/agent-wechat/token:/data/auth-token:ro
178
+ environment:
179
+ - PROXY=${PROXY:-} # optional: user:pass@host:port
169
180
  restart: unless-stopped
170
181
 
171
182
  volumes:
package/dist/cli.js CHANGED
@@ -7904,7 +7904,7 @@ import qrTerminal from "qrcode-terminal";
7904
7904
  import os from "os";
7905
7905
  import path from "path";
7906
7906
  import { fileURLToPath } from "url";
7907
- var VERSION = "0.5.0";
7907
+ var VERSION = "0.6.0";
7908
7908
  var CONTAINER_NAME = "agent-wechat";
7909
7909
  var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
7910
7910
  var DEFAULT_PORT = 6174;
@@ -7962,7 +7962,7 @@ function getSubscriptionOptions() {
7962
7962
  sessionId: opts.session
7963
7963
  };
7964
7964
  }
7965
- program2.command("up").description("Start the WeChat container").action(cmdUp);
7965
+ program2.command("up").description("Start the WeChat container").option("--proxy <url>", "Transparent proxy (user:pass@host:port)").action((opts) => cmdUp(opts));
7966
7966
  program2.command("down").description("Stop and remove the container").action(cmdDown);
7967
7967
  program2.command("logs").description("Show container logs").action(cmdLogs);
7968
7968
  var sessionCmd = program2.command("session").description("Manage sessions");
@@ -8096,7 +8096,10 @@ async function cmdLogin(options, timeoutMs = 3e5, newAccount = false) {
8096
8096
  try {
8097
8097
  await new Promise((resolve, reject) => {
8098
8098
  subscription = client.status.loginSubscription.subscribe(
8099
- { timeoutMs, newAccount },
8099
+ {
8100
+ timeoutMs,
8101
+ newAccount
8102
+ },
8100
8103
  {
8101
8104
  onData: (event) => {
8102
8105
  switch (event.type) {
@@ -8414,7 +8417,7 @@ async function cmdSessionDelete(client, idOrName) {
8414
8417
  process.exit(1);
8415
8418
  }
8416
8419
  }
8417
- async function cmdUp() {
8420
+ async function cmdUp(opts = {}) {
8418
8421
  let image = getImageTag();
8419
8422
  try {
8420
8423
  const existingId = execSync(`docker ps -aq -f "name=^${CONTAINER_NAME}$"`, { encoding: "utf-8" }).trim();
@@ -8467,6 +8470,7 @@ async function cmdUp() {
8467
8470
  "--security-opt",
8468
8471
  "seccomp=unconfined",
8469
8472
  "--cap-add=SYS_PTRACE",
8473
+ "--cap-add=NET_ADMIN",
8470
8474
  "-p",
8471
8475
  `${DEFAULT_PORT}:${DEFAULT_PORT}`,
8472
8476
  "-p",
@@ -8476,9 +8480,12 @@ async function cmdUp() {
8476
8480
  "-v",
8477
8481
  `${CONTAINER_NAME}-wechat-home:/home/wechat`,
8478
8482
  "-v",
8479
- `${TOKEN_PATH}:/data/auth-token:ro`,
8480
- image
8483
+ `${TOKEN_PATH}:/data/auth-token:ro`
8481
8484
  ];
8485
+ if (opts.proxy) {
8486
+ dockerArgs.push("-e", `PROXY=${opts.proxy}`);
8487
+ }
8488
+ dockerArgs.push(image);
8482
8489
  try {
8483
8490
  execSync(`docker ${dockerArgs.join(" ")}`, { stdio: "inherit" });
8484
8491
  console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-wechat/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wx": "./dist/cli.js"