@agent-wechat/cli 0.16.0 → 1.0.0-beta.2
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/README.md +51 -175
- package/THIRD_PARTY_NOTICES.txt +82 -0
- package/native-release.json +29 -0
- package/package.json +13 -16
- package/scripts/native-check-package.mjs +21 -0
- package/scripts/native-install.mjs +21 -0
- package/scripts/native-launcher.mjs +4 -0
- package/scripts/native-runtime.mjs +181 -0
- package/dist/cli.js +0 -8802
package/README.md
CHANGED
|
@@ -1,214 +1,90 @@
|
|
|
1
1
|
# @agent-wechat/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`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. The supported distribution targets are Linux x64 and ARM64 with glibc 2.36+. macOS, Windows and musl do not have a native release. 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.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
After a matching release has been published:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install -g @agent-wechat/cli
|
|
10
|
+
npm install -g @agent-wechat/cli@VERSION
|
|
11
|
+
wx --json version
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
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.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
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.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`wx up` automatically pulls the Docker image from ghcr.io if it isn't found locally.
|
|
20
|
-
|
|
21
|
-
> **Note:** agent-wechat requires `SYS_PTRACE` and `seccomp=unconfined` to interact with the WeChat desktop process. It cannot run in serverless or restricted container environments (AWS Fargate, Cloud Run, etc.). Use a VM or bare-metal Docker host.
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
18
|
+
Installers that disable lifecycle scripts are supported:
|
|
24
19
|
|
|
25
20
|
```bash
|
|
26
|
-
|
|
27
|
-
wx
|
|
28
|
-
|
|
29
|
-
# Check status
|
|
30
|
-
wx status
|
|
31
|
-
|
|
32
|
-
# Log in (displays QR code in terminal)
|
|
33
|
-
wx auth login
|
|
34
|
-
|
|
35
|
-
# List chats
|
|
36
|
-
wx chats list
|
|
37
|
-
|
|
38
|
-
# Send a message
|
|
39
|
-
wx messages send <chatId> --text "Hello"
|
|
21
|
+
npm install -g --ignore-scripts @agent-wechat/cli@VERSION
|
|
22
|
+
wx-native-install
|
|
40
23
|
```
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Container
|
|
45
|
-
|
|
46
|
-
| Command | Description |
|
|
47
|
-
|---------|-------------|
|
|
48
|
-
| `wx up [--proxy user:pass@host:port]` | Start the agent-wechat container |
|
|
49
|
-
| `wx down` | Stop and remove the container |
|
|
50
|
-
| `wx logs` | Tail container logs |
|
|
51
|
-
| `wx status` | Show container up/down status and login status (when available) |
|
|
52
|
-
|
|
53
|
-
### Auth
|
|
54
|
-
|
|
55
|
-
| Command | Description |
|
|
56
|
-
|---------|-------------|
|
|
57
|
-
| `wx auth login` | Log in to WeChat (shows QR code) |
|
|
58
|
-
| `wx auth logout` | Log out of WeChat |
|
|
59
|
-
| `wx auth status` | Check login status |
|
|
60
|
-
| `wx auth token` | Show current auth token |
|
|
61
|
-
| `wx auth token --regenerate` | Generate a new auth token |
|
|
62
|
-
|
|
63
|
-
Login options:
|
|
64
|
-
- `--timeout <seconds>` — login timeout (default: 300)
|
|
65
|
-
- `--new` — switch to a new account instead of existing
|
|
66
|
-
|
|
67
|
-
### Chats
|
|
68
|
-
|
|
69
|
-
| Command | Description |
|
|
70
|
-
|---------|-------------|
|
|
71
|
-
| `wx chats list` | List chats from WeChat |
|
|
72
|
-
| `wx chats get <chatId>` | Get details for a specific chat |
|
|
73
|
-
| `wx chats find <name>` | Search chats by display name |
|
|
74
|
-
| `wx chats open <chatId>` | Open a chat in the WeChat UI |
|
|
75
|
-
|
|
76
|
-
Options: `--limit <n>`, `--offset <n>`, `--json`
|
|
77
|
-
|
|
78
|
-
### Messages
|
|
79
|
-
|
|
80
|
-
| Command | Description |
|
|
81
|
-
|---------|-------------|
|
|
82
|
-
| `wx messages list <chatId>` | List messages in a chat |
|
|
83
|
-
| `wx messages send <chatId>` | Send a message |
|
|
84
|
-
| `wx messages media <chatId> <localId>` | Download a media attachment |
|
|
85
|
-
|
|
86
|
-
Send options:
|
|
87
|
-
- `--text "message"` — send text
|
|
88
|
-
- `--image photo.jpg` — send an image
|
|
89
|
-
- `--file document.pdf` — send a file
|
|
25
|
+
For offline deployment, provision the release binary and its `wx-vVERSION-checksums.json` into one local directory, then run:
|
|
90
26
|
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
- `--thumbnail` — save the cached preview
|
|
95
|
-
- `--best` — explicitly choose the default best-available image behavior
|
|
96
|
-
|
|
97
|
-
Media retrieval does not open a chat. Use `wx chats open <chatId>` separately
|
|
98
|
-
if WeChat needs to cache a regular photo's standard-size copy.
|
|
99
|
-
|
|
100
|
-
### Sessions
|
|
101
|
-
|
|
102
|
-
| Command | Description |
|
|
103
|
-
|---------|-------------|
|
|
104
|
-
| `wx session list` | List all sessions |
|
|
105
|
-
| `wx session create <name>` | Create a new session |
|
|
106
|
-
| `wx session start <id>` | Start a session |
|
|
107
|
-
| `wx session stop <id>` | Stop a session |
|
|
108
|
-
| `wx session delete <id>` | Delete a session |
|
|
109
|
-
|
|
110
|
-
### Debug
|
|
111
|
-
|
|
112
|
-
| Command | Description |
|
|
113
|
-
|---------|-------------|
|
|
114
|
-
| `wx screenshot [file]` | Save a screenshot (default: screenshot.png) |
|
|
115
|
-
| `wx a11y` | Dump the accessibility tree (`--format json|aria`) |
|
|
116
|
-
|
|
117
|
-
## Global Options
|
|
118
|
-
|
|
119
|
-
| Option | Description |
|
|
120
|
-
|--------|-------------|
|
|
121
|
-
| `-s, --session <name>` | Use a specific session (default: "default") |
|
|
122
|
-
| `-V, --version` | Show version |
|
|
123
|
-
| `-h, --help` | Show help |
|
|
124
|
-
|
|
125
|
-
## Configuration
|
|
126
|
-
|
|
127
|
-
The CLI reads configuration from environment variables and a local token file:
|
|
128
|
-
|
|
129
|
-
| Source | Description |
|
|
130
|
-
|--------|-------------|
|
|
131
|
-
| `AGENT_WECHAT_URL` | Server URL (default: `http://localhost:6174`) |
|
|
132
|
-
| `AGENT_WECHAT_TOKEN` | Auth token (overrides token file) |
|
|
133
|
-
| `~/.config/agent-wechat/token` | Auto-generated auth token |
|
|
27
|
+
```bash
|
|
28
|
+
AGENT_WECHAT_NATIVE_ARTIFACT_DIR=/absolute/release-assets wx-native-install
|
|
29
|
+
```
|
|
134
30
|
|
|
135
|
-
The
|
|
31
|
+
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.
|
|
136
32
|
|
|
137
|
-
|
|
33
|
+
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.
|
|
138
34
|
|
|
139
|
-
|
|
35
|
+
## Configuration and storage
|
|
140
36
|
|
|
141
|
-
|
|
37
|
+
```bash
|
|
38
|
+
wx config show
|
|
39
|
+
wx serve --server-config /absolute/server/config.toml
|
|
40
|
+
```
|
|
142
41
|
|
|
143
|
-
|
|
42
|
+
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.
|
|
144
43
|
|
|
145
|
-
The
|
|
44
|
+
The initial workflow takes over an existing official profile in place. Close the official app, start `wx serve`, then use a second terminal:
|
|
146
45
|
|
|
147
46
|
```bash
|
|
148
|
-
wx
|
|
47
|
+
wx auth login --official
|
|
48
|
+
# Or choose a specific path on the daemon host:
|
|
49
|
+
wx auth login --official=/absolute/official-profile
|
|
149
50
|
```
|
|
150
51
|
|
|
151
|
-
|
|
152
|
-
- **Port 6174** — REST API + VNC web viewer at `/vnc/` (exposed to all interfaces)
|
|
153
|
-
- Persistent volumes for data and WeChat home directory
|
|
154
|
-
- Auth token from `~/.config/agent-wechat/token` (auto-generated on first run)
|
|
52
|
+
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.
|
|
155
53
|
|
|
156
|
-
|
|
54
|
+
Lower-level registration and experimental profile copies are also available:
|
|
157
55
|
|
|
158
56
|
```bash
|
|
159
|
-
|
|
57
|
+
# Only use an explicitly stopped/quiescent profile; never share a writer.
|
|
58
|
+
wx store attach --account example --path /absolute/official-profile --source-stopped
|
|
59
|
+
wx store import --account copied --source /absolute/stopped-profile --source-stopped
|
|
60
|
+
wx store export --account copied --destination /absolute/new-export --source-stopped
|
|
160
61
|
```
|
|
161
62
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
For production or when running alongside other services (e.g., OpenClaw), use the `docker-compose.yml` in the repo root as a reference:
|
|
167
|
-
|
|
168
|
-
```yaml
|
|
169
|
-
services:
|
|
170
|
-
agent-wechat:
|
|
171
|
-
image: ghcr.io/thisnick/agent-wechat:latest
|
|
172
|
-
container_name: agent-wechat
|
|
173
|
-
security_opt:
|
|
174
|
-
- seccomp=unconfined
|
|
175
|
-
cap_add:
|
|
176
|
-
- SYS_PTRACE
|
|
177
|
-
- NET_ADMIN
|
|
178
|
-
ports:
|
|
179
|
-
- "6174:6174"
|
|
180
|
-
volumes:
|
|
181
|
-
- agent-wechat-data:/data
|
|
182
|
-
- agent-wechat-home:/home/wechat
|
|
183
|
-
- ~/.config/agent-wechat/token:/data/auth-token:ro
|
|
184
|
-
environment:
|
|
185
|
-
- PROXY=${PROXY:-} # optional: user:pass@host:port
|
|
186
|
-
restart: unless-stopped
|
|
187
|
-
|
|
188
|
-
volumes:
|
|
189
|
-
agent-wechat-data:
|
|
190
|
-
agent-wechat-home:
|
|
191
|
-
```
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
## Build and validate without deployment
|
|
192
66
|
|
|
193
|
-
|
|
67
|
+
From the repository root:
|
|
194
68
|
|
|
195
69
|
```bash
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
70
|
+
pnpm --filter @agent-wechat/cli... build
|
|
71
|
+
pnpm --filter @agent-wechat/cli test
|
|
72
|
+
pnpm native:build
|
|
73
|
+
pnpm native:test
|
|
74
|
+
pnpm native:release:build
|
|
75
|
+
node scripts/native-package-smoke.mjs artifacts/native
|
|
76
|
+
# Substitute the exact artifact version emitted by the build:
|
|
77
|
+
python3 scripts/native-cli-smoke.py artifacts/native/wx-vVERSION-linux-x64-gnu
|
|
78
|
+
python3 scripts/native-cli-fixture-test.py artifacts/native/wx-vVERSION-linux-x64-gnu
|
|
79
|
+
python3 scripts/native-export-smoke.py artifacts/native/wx-vVERSION-linux-x64-gnu
|
|
199
80
|
```
|
|
200
81
|
|
|
201
|
-
|
|
82
|
+
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.
|
|
202
83
|
|
|
203
|
-
|
|
84
|
+
Deployment examples and the deliberate release preparation sequence are in [deploy/native](../../deploy/native/README.md). The previous container CLI and Wechaty packages are retired; see the [migration guide](../../docs/src/content/docs/getting-started/migration.mdx).
|
|
204
85
|
|
|
205
|
-
|
|
86
|
+
## Package helper scripts
|
|
206
87
|
|
|
207
|
-
|
|
208
|
-
# From the repo root — auto-detects host architecture
|
|
209
|
-
pnpm build:image
|
|
88
|
+
`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.
|
|
210
89
|
|
|
211
|
-
|
|
212
|
-
pnpm build:image:arm64
|
|
213
|
-
pnpm build:image:amd64
|
|
214
|
-
```
|
|
90
|
+
`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.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Native wx third-party notices
|
|
2
|
+
|
|
3
|
+
NOTICE
|
|
4
|
+
|
|
5
|
+
The AES-GCM known-answer fixture in src/mmtls.rs is reproduced from
|
|
6
|
+
code/outer.py in Citizen Lab's wechat-security-report repository:
|
|
7
|
+
https://github.com/citizenlab/wechat-security-report
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Mona Wang
|
|
10
|
+
Used under the MIT License; see fixtures/LICENSE-CITIZENLAB.
|
|
11
|
+
|
|
12
|
+
The public MMTLS verification pins and business ECDH/signature pins are public
|
|
13
|
+
protocol constants from the Linux 4.1.13.26 default configuration. They are not
|
|
14
|
+
account credentials. Reference artifact SHA-256:
|
|
15
|
+
2749535f299ba67feb8ef80cab898bb0531fa8f376b16f8a72db706811c84132
|
|
16
|
+
|
|
17
|
+
Other test vectors contain synthetic inputs, RFC 5869 test-case 1 data, or
|
|
18
|
+
independently generated Python cryptography/zlib ciphertext. No private capture,
|
|
19
|
+
account identity, token, device state, message, or runtime executable is shipped.
|
|
20
|
+
|
|
21
|
+
The portable SILK SDK sources under vendor/silk are from kn007/silk-v3-decoder,
|
|
22
|
+
pinned commit 507be6bca8ce1fb977a061481f1d79e8c610e309:
|
|
23
|
+
https://github.com/kn007/silk-v3-decoder
|
|
24
|
+
|
|
25
|
+
The wrapper project is MIT licensed; the SILK SDK sources retain their Skype
|
|
26
|
+
BSD-style notices. Full license text and an allowlist of SHA-256 source hashes
|
|
27
|
+
are in vendor/silk/LICENSE-MIT, LICENSE-SDK and SOURCE.json. Only portable C and
|
|
28
|
+
headers are included. No codec binary from the official client is loaded.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
vendor/silk/LICENSE-MIT
|
|
32
|
+
|
|
33
|
+
The MIT License (MIT)
|
|
34
|
+
|
|
35
|
+
Copyright (c) 2020 Karl Chen
|
|
36
|
+
|
|
37
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
38
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
39
|
+
in the Software without restriction, including without limitation the rights
|
|
40
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
41
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
42
|
+
furnished to do so, subject to the following conditions:
|
|
43
|
+
|
|
44
|
+
The above copyright notice and this permission notice shall be included in all
|
|
45
|
+
copies or substantial portions of the Software.
|
|
46
|
+
|
|
47
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
48
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
49
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
50
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
51
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
52
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
53
|
+
SOFTWARE.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
vendor/silk/LICENSE-SDK
|
|
57
|
+
|
|
58
|
+
Copyright (c) 2006-2012, Skype Limited. All rights reserved.
|
|
59
|
+
Redistribution and use in source and binary forms, with or without
|
|
60
|
+
modification, (subject to the limitations in the disclaimer below)
|
|
61
|
+
are permitted provided that the following conditions are met:
|
|
62
|
+
- Redistributions of source code must retain the above copyright notice,
|
|
63
|
+
this list of conditions and the following disclaimer.
|
|
64
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
65
|
+
notice, this list of conditions and the following disclaimer in the
|
|
66
|
+
documentation and/or other materials provided with the distribution.
|
|
67
|
+
- Neither the name of Skype Limited, nor the names of specific
|
|
68
|
+
contributors, may be used to endorse or promote products derived from
|
|
69
|
+
this software without specific prior written permission.
|
|
70
|
+
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
|
|
71
|
+
BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
72
|
+
CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
|
73
|
+
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
74
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
75
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
76
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
77
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
78
|
+
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
79
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
80
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
81
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
82
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"repository": "thisnick/agent-wechat",
|
|
5
|
+
"sourceCommit": "63c7ce5bac1dade4ee11f2e7c6364a733724c117",
|
|
6
|
+
"sourceTreeDirty": false,
|
|
7
|
+
"assets": [
|
|
8
|
+
{
|
|
9
|
+
"name": "wx-v1.0.0-beta.2-linux-arm64-gnu",
|
|
10
|
+
"platform": "linux",
|
|
11
|
+
"arch": "arm64",
|
|
12
|
+
"libc": "gnu",
|
|
13
|
+
"minimumGlibc": "2.36",
|
|
14
|
+
"rustTarget": "aarch64-unknown-linux-gnu",
|
|
15
|
+
"bytes": 26300152,
|
|
16
|
+
"sha256": "6fff9ad299be969a24ce7dbce409a29ce86fa2abc2de4f93fef5222ce9cfae77"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "wx-v1.0.0-beta.2-linux-x64-gnu",
|
|
20
|
+
"platform": "linux",
|
|
21
|
+
"arch": "x64",
|
|
22
|
+
"libc": "gnu",
|
|
23
|
+
"minimumGlibc": "2.36",
|
|
24
|
+
"rustTarget": "x86_64-unknown-linux-gnu",
|
|
25
|
+
"bytes": 27987976,
|
|
26
|
+
"sha256": "2b9de3ad043868b084bfac64fe01a5dd039b1aaae5eb1499c438bd65983cddc2"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-wechat/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
|
-
"wx": "./
|
|
6
|
+
"wx": "./scripts/native-launcher.mjs",
|
|
7
|
+
"wx-native-install": "./scripts/native-install.mjs"
|
|
7
8
|
},
|
|
8
9
|
"files": [
|
|
9
|
-
"
|
|
10
|
+
"scripts",
|
|
11
|
+
"native-release.json",
|
|
12
|
+
"THIRD_PARTY_NOTICES.txt"
|
|
10
13
|
],
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"qrcode-terminal": "^0.12.0"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"commander": "^14.0.3",
|
|
16
|
-
"esbuild": "^0.25.0",
|
|
17
|
-
"@types/node": "^22",
|
|
18
|
-
"@types/qrcode-terminal": "^0.12.2",
|
|
19
|
-
"typescript": "^5.4.5",
|
|
20
|
-
"@agent-wechat/shared": "0.3.1"
|
|
21
|
-
},
|
|
22
14
|
"publishConfig": {
|
|
23
15
|
"access": "public",
|
|
24
16
|
"provenance": true
|
|
@@ -28,9 +20,14 @@
|
|
|
28
20
|
"url": "git+https://github.com/thisnick/agent-wechat.git",
|
|
29
21
|
"directory": "packages/cli"
|
|
30
22
|
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=24.16"
|
|
25
|
+
},
|
|
26
|
+
"description": "Standalone native WeChat CLI and daemon launcher",
|
|
31
27
|
"scripts": {
|
|
32
28
|
"build": "node build.js",
|
|
33
|
-
"typecheck": "
|
|
34
|
-
"test": "node --test
|
|
29
|
+
"typecheck": "node build.js",
|
|
30
|
+
"test": "node --test test/*.test.mjs",
|
|
31
|
+
"postinstall": "node scripts/native-install.mjs --postinstall"
|
|
35
32
|
}
|
|
36
33
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// prepack checks bundled metadata; prepublishOnly additionally verifies the
|
|
3
|
+
// complete, already published executable matrix before npm can be published.
|
|
4
|
+
import { fetchBytes, manifestName, readManifest, releaseUrl, validateManifest, verifyBytes } from './native-runtime.mjs';
|
|
5
|
+
const { manifest, asset } = await readManifest();
|
|
6
|
+
if (process.env.GITHUB_SHA && manifest.sourceCommit !== process.env.GITHUB_SHA) throw new Error('Native manifest source commit differs from publication commit');
|
|
7
|
+
if (process.argv.includes('--publication')) {
|
|
8
|
+
if (manifest.sourceTreeDirty === true) throw new Error('Dirty local validation artifacts cannot be published');
|
|
9
|
+
// Manual npm publication must enforce the same asset-before-package ordering
|
|
10
|
+
// as the normal release workflow; local pack/offline smoke does not fetch.
|
|
11
|
+
const remote = JSON.parse(await fetchBytes(releaseUrl(manifest.version, manifestName(manifest.version)), 65536));
|
|
12
|
+
validateManifest(manifest, manifest.version, { requireAllTargets: true });
|
|
13
|
+
validateManifest(remote, manifest.version, { requireAllTargets: true });
|
|
14
|
+
if (remote.sourceCommit !== manifest.sourceCommit || remote.sourceTreeDirty === true) throw new Error('Prepared release differs from this npm package');
|
|
15
|
+
for (const item of manifest.assets) {
|
|
16
|
+
const published = remote.assets.find(candidate => candidate.arch === item.arch);
|
|
17
|
+
if (published.sha256 !== item.sha256 || published.bytes !== item.bytes) throw new Error('Prepared release differs from this npm package');
|
|
18
|
+
verifyBytes(await fetchBytes(releaseUrl(manifest.version, item.name), item.bytes), item);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
console.error(`Verified bundled native release manifest for ${manifest.version}.`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// npm postinstall (or explicit offline provisioning) installs a verified runtime.
|
|
3
|
+
// The wx launcher only runs an already installed executable; it never downloads.
|
|
4
|
+
import { access } from 'node:fs/promises';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { installNative, packageRoot, resolveNative } from './native-runtime.mjs';
|
|
7
|
+
try {
|
|
8
|
+
if (process.env.AGENT_WECHAT_SKIP_NATIVE_INSTALL === '1') {
|
|
9
|
+
console.error('Native installation skipped explicitly; provision wx before use.');
|
|
10
|
+
} else {
|
|
11
|
+
let workspace = false;
|
|
12
|
+
try { await access(join(packageRoot, '../../pnpm-workspace.yaml')); workspace = true; } catch {}
|
|
13
|
+
if (workspace && process.argv.includes('--postinstall')) {
|
|
14
|
+
console.error('Source workspace: native release installation deferred. Build Rust wx explicitly.');
|
|
15
|
+
} else if (process.env.AGENT_WECHAT_NATIVE_BINARY) {
|
|
16
|
+
console.error(`Verified separately provisioned native runtime: ${await resolveNative()}`);
|
|
17
|
+
} else {
|
|
18
|
+
console.error(`Installed native runtime: ${await installNative({ artifactDir: process.env.AGENT_WECHAT_NATIVE_ARTIFACT_DIR })}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} catch (error) { console.error(error.message); process.exitCode = 1; }
|