@agent-wechat/agent-wechat 2.5.0 → 2.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.
- package/README.md +7 -7
- package/dist/index.js +29 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ The tool also accepts `disconnect` (retain saved trust), `logout` (durable nativ
|
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Provision the native executable and account registration separately. Omitting `executable` resolves `wx` once from absolute trusted PATH entries. The plugin supports the package's tested npm launcher layout by selecting its already installed checksum-verified ELF payload directly. It never invokes an installer or shell. Unknown wrappers/old container CLIs are rejected. Managed startup refuses an occupied port and requires authenticated readiness matching the owned child PID, store path, server identity and process generation; it never adopts or terminates another process. Stop sends a graceful termination to its own child with bounded escalation. An unexpected child/stream failure is reported; automatic process crash restart is not implemented in this increment.
|
|
49
|
+
Provision the native executable and account registration separately. Omitting `executable` resolves `wx` once from absolute trusted PATH entries. The plugin supports the package's tested npm launcher layout by selecting its already installed checksum-verified ELF payload directly. It never invokes an installer or shell. Unknown wrappers/old container CLIs are rejected. Managed startup refuses an occupied port and requires authenticated readiness matching the owned child PID, store path, server identity and process generation; it never adopts or terminates another process. Stop sends a graceful termination to its own child with bounded escalation. When `wx --json version` lists `serve-exit-with-parent`, the child also runs with `--exit-with-parent`, so it stops gracefully by itself if the Gateway crashes or is killed; an older `wx` starts without the flag. An unexpected child/stream failure is reported; automatic process crash restart is not implemented in this increment.
|
|
50
50
|
|
|
51
51
|
Managed startup sends the resolved token through a private stdin pipe; it creates no token file and does not put the token in arguments or the daemon environment. A managed `serverConfig` must omit `tokenFile`. Reload/restart the Gateway to change credentials or secret-provider configuration.
|
|
52
52
|
|
|
@@ -80,7 +80,7 @@ By default, `readPolicy: "on_inbound"` marks a whole thread read after its incom
|
|
|
80
80
|
|
|
81
81
|
A whole-thread read also clears earlier unread messages in that thread, including messages the model did not receive. The daemon freezes the latest local message boundary, checks the expected version, updates local unread state and submits one native read-status notification. Server acceptance alone does not prove that a phone badge changed. A lost notification response remains `needs_review` and is never automatically resubmitted. Pending reads survive a Gateway restart and retry independently of model execution or new SSE traffic. `readPolicy: "never"` disables both local and remote marking, including previously queued reads. Crashes during an unfinished dispatch retain `needs_review`; the plugin does not automatically duplicate model turns or uncertain outgoing sends.
|
|
82
82
|
|
|
83
|
-
The optional `readPolicy: "on_model_dispatch"` instead requires a confirmed model handoff. On OpenClaw **2026.11.
|
|
83
|
+
The optional `readPolicy: "on_model_dispatch"` instead requires a confirmed model handoff. On OpenClaw **2026.11.4**, the host calls `onPreparedAgentRunStart` for the run that contains the dispatched message once its transcript is prepared, and that call confirms the handoff. It does not need `hooks.allowConversationAccess`. It happens before the provider request and before the host drops images for a text-only model, so it shows that the run started with the message, not that the model received every image. Built-in commands, rejected messages, and media without a ready supplied asset are never confirmed, and status reports `handoffUnconfirmed`.
|
|
84
84
|
|
|
85
85
|
Hosts without `onPreparedAgentRunStart`, such as OpenClaw 2026.10.9, use a stricter compatibility path. Before dispatch, the adapter persists an immutable manifest binding the exact new message ID/version/content hash, policy hash, source and supplied asset hashes, and context roles. Text requires the exact current input and host-created message/account/session facts plus a matching `model_call_started`. Media additionally waits for the same run's `agent_end` snapshot and source-turn identity. Image bytes/MIME/length must match the frozen supplied representation; file/video/voice references must appear in the exact current body. Unknown, omitted, rewritten, merged or ambiguous inputs remain unconfirmed. This path requires the operator's explicit host permission, `plugins.entries.agent-wechat.hooks.allowConversationAccess: true`; it observes only run IDs issued by this adapter and never enables that permission itself. Without the grant, it leaves messages unread. The older `onAgentRunStart` also reports direct tools and early lifecycle phases and is never used as proof. Host/provider history formats can prevent confirmation even when a reply was delivered; use `on_inbound` for ordinary bot read behavior.
|
|
86
86
|
|
|
@@ -110,7 +110,7 @@ Stored-history tools return a recalled placeholder; media tools return terminal
|
|
|
110
110
|
|
|
111
111
|
Old media handles whose stored source changed, or whose source identity cannot be verified, return terminal `unavailable` with `media_source_changed` or `media_identity_unavailable`. They expose no cached path and are not retried automatically. Fresh stored-message discovery can select the intended current message and its bound cached asset without resending a WeChat message.
|
|
112
112
|
|
|
113
|
-
`node
|
|
113
|
+
`node packages/openclaw-extension/test/smoke/recall-model.mjs` builds the actual plugin and runs the pinned Gateway against synthetic native HTTP/SSE and a local provider. It checks registered tool discovery and exact-target execution, stable repeated keys, another thread's rejection, recall intake while provider/media requests are blocked, late-output suppression, out-of-order recall custody and one dispatch for a new exact occupant of a reused source ID. It makes no real account or native protocol exchange.
|
|
114
114
|
|
|
115
115
|
## Stored-history tools
|
|
116
116
|
|
|
@@ -135,7 +135,7 @@ History/search return opaque string message IDs, a bounded text preview, coverag
|
|
|
135
135
|
|
|
136
136
|
Missing media requests a durable daemon transfer by default, with a two-second bounded wait. A pending result includes its `jobId` when known and no claimed local path; call the same tool with the same message ID later to check. The daemon owns and deduplicates the transfer, so cancelling a tool invocation does not cancel submitted work. Use `download: false` for cached media only. `quality` defaults to `best` (best cached image, normal video or decoded voice); explicit `original`, `standard`, `thumbnail`, `normal` and `encoded` variants are strict and may be unavailable. Results report the actual variant and explicit pending, expired, unsupported, unavailable or too-large status. Never automatically retry `retryable: false` or confirmed expiry. The media tool requires account-scoped API `read` and `media` permission, including for download requests. Raw XML, signed transport URLs and keys are never returned.
|
|
137
137
|
|
|
138
|
-
`node
|
|
138
|
+
`node packages/openclaw-extension/test/smoke/history-model.mjs` exercises the pinned Gateway with local account/media/model fixtures: durable group context, original file paths, one preview with a verified hash, a PNG sent as a file remaining a reference, direct image delivery, actual tool discovery, two paginated search calls, rejection of another thread's attachment before media access, one requested image download whose exact image bytes reach vision, and a cached file path reaching the provider. CI runs this check on both Linux architectures.
|
|
139
139
|
|
|
140
140
|
When asset metadata identifies an existing download job, retrieval polls that scoped job instead of submitting another transfer. A terminal job's reason and retryability are preserved, including in cache-only mode; this tool does not automatically retry failed jobs. A service rejection alone is not classified as expiry.
|
|
141
141
|
|
|
@@ -177,9 +177,9 @@ There is no plugin permission list, owner exception or archive sender/thread fil
|
|
|
177
177
|
|
|
178
178
|
History/search/message/thread reads never send messages, mark threads read or change the inbound cursor. Archive media can submit the same bounded, deduplicated download jobs as `wechat_media`; it stays directly callable so actual image blocks reach vision.
|
|
179
179
|
|
|
180
|
-
Run `node
|
|
180
|
+
Run `node packages/openclaw-extension/test/smoke/archive-tools.mjs` to check the pinned Gateway with three separately routed agents: no optional-tool grant, a full profile with an explicit deny, and an archive grant. It checks discovery and guessed-name invocation denial, cross-thread search pagination, other-sender history/media, unchanged default-tool scope, verified image bytes in provider input and a cached file path. All messages, account data and model responses in this test are synthetic. CI runs it on Linux x64 and ARM64.
|
|
181
181
|
|
|
182
|
-
Run `node
|
|
182
|
+
Run `node packages/openclaw-extension/test/smoke/model.mjs` and `node packages/openclaw-extension/test/smoke/media-model.mjs` after installing workspace dependencies. They use the actual pinned Gateway, a local model and synthetic daemon/files. Checks cover default inbound reads without conversation permission, commands without a model call, current provider input, image hashes and prepared previews, reference/transcription delivery, whole-thread read requests, lost-response/reopen recovery, duplicate prevention, omitted images on a text-only model, explicit model-handoff permission, never-read policy and group routing behavior. Transcription uses the real SDK with an explicitly configured local deterministic CLI; it does not test speech recognition accuracy. Concurrent text inputs were serialized into distinct model turns; merged-input refusal has unit coverage for the explicit model policy. These checks establish local runtime behavior, not external provider acceptance, semantic analysis or consumption.
|
|
183
183
|
|
|
184
184
|
Native text/media sends retain daemon intent/job identity and caller idempotency. Text waits for accepted submission; media jobs preserve partial and uncertain outcomes rather than resending. Ordinary audio remains a file; only explicit `audioAsVoice` requests independently encoded voice. Sender/group/mention gates run before retrieval/transcription. Verified voice may use the configured OpenClaw transcription runtime after admission. Native QR login uses a durable daemon operation and authenticated PNG retrieval. Logout commits local inhibition before at most one authenticated native logout, reporting the remote outcome separately; saved-device revocation remains unverified. Explicitly confirmed forgetting removes local auth while retaining history; disconnect retains reusable trust.
|
|
185
185
|
|
|
@@ -218,6 +218,6 @@ Set `native.gatewayFacade: {"enabled": true}` to register `/plugins/agent-wechat
|
|
|
218
218
|
|
|
219
219
|
The actual Gateway authenticates requests before the proxy runs. Its bearer is never forwarded to the daemon; the plugin uses its private daemon token reference. Routes are restricted to the configured account, with no daemon-wide token/account administration. Binary bodies, byte ranges, status codes and SSE are preserved within explicit size limits. Client disconnect/plugin shutdown closes upstream streaming work without cancelling durable sends.
|
|
220
220
|
|
|
221
|
-
`
|
|
221
|
+
`packages/openclaw-extension/test/smoke/gateway.mjs` tests the built plugin on an isolated OpenClaw **2026.11.4** Gateway with synthetic loopback data: auth rejection, separate credentials, account boundaries, Range206, SSE and cancellation. This transport test is separate from the local model-boundary test above; neither uses an external model provider or a real WeChat account.
|
|
222
222
|
|
|
223
223
|
See [native deployment examples](../../deploy/native/README.md) and [native CLI installation](../cli/README.md).
|
package/dist/index.js
CHANGED
|
@@ -1953,6 +1953,12 @@ function nativeExecutableFormat(bytes, platform = process.platform) {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
return false;
|
|
1955
1955
|
}
|
|
1956
|
+
function managedServeArgs(dataDir, listen, serverConfig, capabilities) {
|
|
1957
|
+
const args = ["serve", "--data-dir", dataDir, "--token-stdin", "--listen", listen];
|
|
1958
|
+
if (capabilities.includes("serve-exit-with-parent")) args.push("--exit-with-parent");
|
|
1959
|
+
if (serverConfig) args.push("--server-config", serverConfig);
|
|
1960
|
+
return args;
|
|
1961
|
+
}
|
|
1956
1962
|
async function resolveNativeExecutable(explicit, path = process.env.PATH ?? "", environment = nativeChildEnvironment("")) {
|
|
1957
1963
|
const target = nativeHostTarget();
|
|
1958
1964
|
let candidate = explicit;
|
|
@@ -1997,7 +2003,7 @@ async function resolveNativeExecutable(explicit, path = process.env.PATH ?? "",
|
|
|
1997
2003
|
const version = JSON.parse(stdout);
|
|
1998
2004
|
requireNativeIdentity(version);
|
|
1999
2005
|
if (version.target !== target.rustTarget) throw new Error("native_binary_incompatible: executable architecture differs from this host");
|
|
2000
|
-
return candidate;
|
|
2006
|
+
return { path: candidate, capabilities: version.capabilities };
|
|
2001
2007
|
}
|
|
2002
2008
|
async function portOccupied(url2) {
|
|
2003
2009
|
return new Promise((resolve, reject) => {
|
|
@@ -2050,9 +2056,8 @@ async function startNativeHost(config) {
|
|
|
2050
2056
|
if (await portOccupied(url2)) throw new Error("native_owner_conflict: configured port is already owned; use external mode for an independently operated daemon");
|
|
2051
2057
|
const executable = await resolveNativeExecutable(config.executable, void 0, nativeChildEnvironment(token));
|
|
2052
2058
|
const client = new NativeWeChatClient({ baseUrl: url2.href, token, timeoutMs: 1e3 });
|
|
2053
|
-
const args =
|
|
2054
|
-
|
|
2055
|
-
const child = spawn(executable, args, { env: nativeChildEnvironment(token), stdio: ["pipe", "ignore", "pipe"], shell: false });
|
|
2059
|
+
const args = managedServeArgs(config.dataDir, url2.host, config.serverConfig, executable.capabilities);
|
|
2060
|
+
const child = spawn(executable.path, args, { env: nativeChildEnvironment(token), stdio: ["pipe", "ignore", "pipe"], shell: false });
|
|
2056
2061
|
child.stderr?.on("data", () => {
|
|
2057
2062
|
});
|
|
2058
2063
|
let exited = false;
|
|
@@ -2995,7 +3000,7 @@ ${prepared.body}`.slice(0, 65536) };
|
|
|
2995
3000
|
return { body: renderAttachmentBody("", attachment2), attachment: attachment2, pending: false };
|
|
2996
3001
|
}
|
|
2997
3002
|
await authorize();
|
|
2998
|
-
if (attachmentKind === "file" && asset.byteLength != null && asset.
|
|
3003
|
+
if ((attachmentKind === "file" || attachmentKind === "video") && asset.byteLength != null && asset.sha256) {
|
|
2999
3004
|
const content2 = await client.mediaContentStream(accountId, asset.id, { maxBytes, signal: params.signal });
|
|
3000
3005
|
const mime2 = content2.contentType.split(";", 1)[0].trim().toLowerCase();
|
|
3001
3006
|
if (!/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/.test(mime2)) {
|
|
@@ -3010,7 +3015,7 @@ ${prepared.body}`.slice(0, 65536) };
|
|
|
3010
3015
|
filename,
|
|
3011
3016
|
maxBytes,
|
|
3012
3017
|
expectedBytes: asset.byteLength,
|
|
3013
|
-
expectedSha256: asset.sha256
|
|
3018
|
+
expectedSha256: asset.sha256,
|
|
3014
3019
|
assertCurrent: guard2,
|
|
3015
3020
|
saveMediaStream: params.saveMediaStream ?? saveMediaStream
|
|
3016
3021
|
});
|
|
@@ -3018,7 +3023,17 @@ ${prepared.body}`.slice(0, 65536) };
|
|
|
3018
3023
|
await content2.cancel();
|
|
3019
3024
|
}
|
|
3020
3025
|
await authorize();
|
|
3021
|
-
|
|
3026
|
+
guard2();
|
|
3027
|
+
const actual2 = asset.actualVariant ?? asset.variant;
|
|
3028
|
+
const attachment2 = {
|
|
3029
|
+
kind: attachmentKind,
|
|
3030
|
+
filename,
|
|
3031
|
+
status: "ready",
|
|
3032
|
+
path: saved2.path,
|
|
3033
|
+
mime: mime2,
|
|
3034
|
+
quality: actual2 === "original" ? "full" : actual2 === "standard" ? "standard" : actual2 === "thumbnail" ? "thumbnail" : void 0
|
|
3035
|
+
};
|
|
3036
|
+
const video = attachmentKind === "video";
|
|
3022
3037
|
return {
|
|
3023
3038
|
body: renderAttachmentBody("", attachment2),
|
|
3024
3039
|
attachment: attachment2,
|
|
@@ -3026,22 +3041,23 @@ ${prepared.body}`.slice(0, 65536) };
|
|
|
3026
3041
|
pending: false,
|
|
3027
3042
|
jobId: job?.id,
|
|
3028
3043
|
retryable: false,
|
|
3029
|
-
variant:
|
|
3044
|
+
variant: actual2,
|
|
3030
3045
|
suppliedAssets: [{
|
|
3031
3046
|
id: asset.id,
|
|
3032
3047
|
contextRole: "trigger",
|
|
3033
3048
|
role: "file_reference",
|
|
3034
|
-
kind:
|
|
3049
|
+
kind: attachmentKind,
|
|
3035
3050
|
path: saved2.path,
|
|
3036
3051
|
mime: mime2,
|
|
3037
3052
|
sha256: saved2.sha256,
|
|
3038
3053
|
byteLength: saved2.size,
|
|
3039
|
-
runtimeMedia:
|
|
3054
|
+
runtimeMedia: video,
|
|
3040
3055
|
sourceSha256: saved2.sha256,
|
|
3041
3056
|
sourceByteLength: saved2.size,
|
|
3042
3057
|
sourceMime: mime2,
|
|
3043
3058
|
sourcePath: saved2.path
|
|
3044
|
-
}]
|
|
3059
|
+
}],
|
|
3060
|
+
mediaPath: video ? saved2.path : void 0
|
|
3045
3061
|
};
|
|
3046
3062
|
}
|
|
3047
3063
|
const content = await client.mediaContent(accountId, asset.id, { maxBytes, signal: params.signal });
|
|
@@ -3352,7 +3368,7 @@ function nativeDispatchManifest(params) {
|
|
|
3352
3368
|
}))) } : {},
|
|
3353
3369
|
assets,
|
|
3354
3370
|
policySha256: digest(JSON.stringify(params.policy ?? null)),
|
|
3355
|
-
// Exact source-turn identity of OpenClaw 2026.10.2 through 2026.11.
|
|
3371
|
+
// Exact source-turn identity of OpenClaw 2026.10.2 through 2026.11.4. Requiring it in the later
|
|
3356
3372
|
// snapshot prevents an identical older image/body from proving this input.
|
|
3357
3373
|
hostSourceTurnId: `channel-user:v1:${digest(JSON.stringify(["agent-wechat", params.channelAccountId, `wechat:${params.message.threadId}`, messageSid]))}`
|
|
3358
3374
|
};
|
|
@@ -5420,6 +5436,7 @@ function createLookupTools(context, dependencies, archive) {
|
|
|
5420
5436
|
message,
|
|
5421
5437
|
core,
|
|
5422
5438
|
cfg,
|
|
5439
|
+
saveMediaStream: dependencies.saveMediaStream,
|
|
5423
5440
|
quality,
|
|
5424
5441
|
download: args.download !== false,
|
|
5425
5442
|
waitMs: 2e3,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-wechat/agent-wechat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/node": "^22",
|
|
13
13
|
"esbuild": "^0.25.0",
|
|
14
|
-
"openclaw": "2026.11.
|
|
14
|
+
"openclaw": "2026.11.4",
|
|
15
15
|
"typescript": "^5.4.5",
|
|
16
16
|
"@agent-wechat/shared": "2.0.0"
|
|
17
17
|
},
|