@agent-wechat/cli

中文文档
1.5.1发布于 2026/11/05MITES Module零依赖构建来源已验证近 30 天下载 6267

Standalone native WeChat CLI and daemon launcher

原始使用文档
文档目录4 节
  1. Installation
  2. Configuration and storage
  3. Build and validate without deployment
  4. Package helper scripts

@agent-wechat/cli

wx is the native Rust client and foreground daemon. The npm package installs a matching release executable; it does not implement the native protocol in JavaScript. Linux x64/ARM64 with glibc 2.36+ is validated. The release matrix also builds macOS ARM64 and native Windows x64/ARM64 candidates; native-machine account acceptance is pending. musl remains unsupported. Official-app profile takeover is Linux-only. Clients on other systems can use the HTTP API of a supported Linux daemon. wx --json version and /v1/status expose the runtime and account capabilities; unsupported official schemas fail explicitly.

Installation

After a matching release has been published:

npm install -g @agent-wechat/cli@VERSION
wx --json version

Linux executables need only glibc to start. Interactive calling uses the local PulseAudio or PipeWire-Pulse service and loads its client library, libpulse0, when it opens the microphone and speakers; other commands need neither. Released executables include microphone/speaker support. Use wx calls devices to list endpoints without starting capture or playback, and wx calls dial --help for device selection. Call participation requires a daemon advertising the corresponding calling capability.

During the native beta series, use a published exact version such as 1.0.0-beta.0, or @agent-wechat/cli@beta. The stable latest channel retains the old container CLI until promotion. See the beta release instructions before assuming a beta has been published.

The explicit npm installation downloads one exact-version asset over verified HTTPS. Its size and SHA-256 must match native-release.json inside the npm package, then a bounded local identity check must report the same version, native backend, Rust target and serve capability before atomic installation. Normal command invocation never downloads a missing runtime. A missing manifest, unsupported platform, corrupt asset or wrong backend is an error.

Installers that disable lifecycle scripts are supported:

npm install -g --ignore-scripts @agent-wechat/cli@VERSION
wx-native-install

For offline deployment, provision the release binary and its wx-vVERSION-checksums.json into one local directory, then run:

AGENT_WECHAT_NATIVE_ARTIFACT_DIR=/absolute/release-assets wx-native-install

The offline manifest must agree with the npm-bundled manifest. Alternatively, provision a trusted executable yourself and set AGENT_WECHAT_NATIVE_BINARY=/absolute/path/to/wx; the launcher verifies its native identity/version rather than downloading. This explicit override trusts the operator-provisioned bytes and does not assert they are identical to a release asset. AGENT_WECHAT_SKIP_NATIVE_INSTALL=1 defers installation during image/package provisioning; commands remain unavailable until the runtime is provided. Do not disable TLS verification.

The OpenClaw plugin uses an already installed global native wx or a configured absolute executable. It never downloads binaries or relies on its plugin installer running npm lifecycle scripts. For managed processes, prefer the actual release executable path to avoid an extra launcher process; the npm launcher also forwards arguments, standard streams, exit codes and termination signals.

Configuration and storage

wx config show
wx serve --server-config /absolute/server/config.toml

The default server configuration is $XDG_CONFIG_HOME/agent-wechat/server/config.toml, or ~/.config/agent-wechat/server/config.toml. The durable root defaults to $XDG_DATA_HOME/agent-wechat, or ~/.local/share/agent-wechat. wx serve --data-dir PATH and AGENT_WECHAT_DATA_DIR override it. Server config can select listen, dataDir and tokenFile; relative references resolve against the config file. Paths are not credentials.

The initial workflow takes over an existing official profile in place. Close the official app, start wx serve, then use a second terminal:

wx auth login --official
# Or choose a specific path on the daemon host:
wx auth login --official=/absolute/official-profile

The daemon binds the stored identity, attempts saved-device login and derives verified database keys after authentication. The official app stays closed while this daemon owns the files.

Recall an own message using its opaque message ID and exact decimal-string server ID from history or a verified send receipt:

wx --account example messages recall MESSAGE_ID --server-id SERVER_ID
wx --account example operations get OPERATION_ID

Use --detach to return the durable operation immediately. A private receipt is written before submission; the same target uses a stable default idempotency key. An uncertain result exits8 and must be inspected rather than automatically resubmitted. WeChat decides eligibility, and stopping the watcher does not cancel the recall. Recalled messages remain as placeholders; their media is unavailable through the daemon. Raw journals, cached files and backups are retained.

Lower-level registration and experimental profile copies are also available:

# Only use an explicitly stopped/quiescent profile; never share a writer.
wx store attach --account example --path /absolute/official-profile --source-stopped
wx store import --account copied --source /absolute/stopped-profile --source-stopped
wx store export --account copied --destination /absolute/new-export --source-stopped

Direct mode keeps official profile bytes at the selected path and daemon-only state under dataDir. Fresh creation, export and returning files to the official app are outside the initial supported takeover scope. Import/export copy the same format; they do not convert schema or refresh login trust. Use --help for the implemented command surface. Never copy or attach a running production profile implicitly.

Build and validate without deployment

From the repository root:

pnpm --filter @agent-wechat/cli... build
pnpm --filter @agent-wechat/cli test
pnpm native:build
pnpm native:test
pnpm native:release:build
node scripts/native-package-smoke.mjs artifacts/native
# Substitute the exact artifact version emitted by the build:
python3 scripts/native-cli-smoke.py artifacts/native/wx-vVERSION-linux-x64-gnu
python3 scripts/native-cli-fixture-test.py artifacts/native/wx-vVERSION-linux-x64-gnu
python3 scripts/native-export-smoke.py artifacts/native/wx-vVERSION-linux-x64-gnu

Source-workspace postinstall defers release installation; run the Rust binary from its target directory or use an explicit trusted executable override. The local release builder tests the Rust workspace, verifies executable identity and creates versioned assets; it does not publish, deploy or log an account in. The package smoke test packs/unpacks an actual npm tarball and installs from local artifacts into a temporary directory.

Deployment examples and the deliberate release preparation sequence are in deploy/native. The previous container CLI and Wechaty packages are retired; see the migration guide.

Package helper scripts

native-install.mjs runs during npm installation, or through wx-native-install for offline/disabled-script installs. It selects the host architecture, checks the npm-bundled hash and verifies executable identity before atomic installation. native-launcher.mjs only runs an already installed executable.

native-check-package.mjs is the prepack/prepublish gate. It checks version/source/target/checksum metadata; before publication it additionally requires both architecture assets to exist and match the package's manifest. A local pack smoke can use one architecture fragment; publication requires the complete matrix. These helpers belong to the existing CLI package, not additional npm packages.

Candidate platform validation and remaining profile boundaries are tracked in the acceptance checklist. Windows executables are named wx.exe; the npm launcher chooses the OS/CPU-specific asset. A native ARM64 Node installation selects the native Windows ARM64 executable.

版本与发布记录

@agent-wechat/cli 共发布 102 个版本,首次发布于 2026/02/21;过去 12 个月发布了 102 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.5.1latest2026/11/051 天前
1.5.02026/11/051 天前
1.4.02026/11/042 天前
1.4.0-beta.6beta2026/11/042 天前
1.4.0-beta.52026/11/042 天前
1.4.0-beta.42026/11/032 天前

关于 @agent-wechat/cli 的常见问题

@agent-wechat/cli 是什么?

Standalone native WeChat CLI and daemon launcher

如何安装 @agent-wechat/cli?

在项目目录运行 npm install @agent-wechat/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 wx、wx-native-install,可以用 npx wx 直接运行。

@agent-wechat/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/agent-wechat__cli 是否存在。

@agent-wechat/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agent-wechat/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.16。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agent-wechat/cli 可以商用吗?

@agent-wechat/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agent-wechat/cli 的下载量有多少?

根据 npm 官方下载统计,@agent-wechat/cli 在 2026/10/05 – 2026/11/03 这 30 天内被下载 6,267 次,日均约 209 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agent-wechat/cli 还在维护吗?

最新版本 1.5.1 发布于 2026/11/05(1 天前);至今共发布 102 个版本,其中过去 12 个月发布了 102 个;首次发布于 2026/02/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。