@netcat-ai/openclaw-weixin 2.4.7
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/CHANGELOG.md +156 -0
- package/CHANGELOG.zh_CN.md +156 -0
- package/LICENSE +27 -0
- package/README.md +355 -0
- package/README.zh_CN.md +351 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/src/api/api.js +484 -0
- package/dist/src/api/api.js.map +1 -0
- package/dist/src/api/config-cache.js +64 -0
- package/dist/src/api/config-cache.js.map +1 -0
- package/dist/src/api/session-guard.js +49 -0
- package/dist/src/api/session-guard.js.map +1 -0
- package/dist/src/api/types.js +37 -0
- package/dist/src/api/types.js.map +1 -0
- package/dist/src/auth/accounts.js +328 -0
- package/dist/src/auth/accounts.js.map +1 -0
- package/dist/src/auth/login-qr.js +331 -0
- package/dist/src/auth/login-qr.js.map +1 -0
- package/dist/src/auth/pairing.js +104 -0
- package/dist/src/auth/pairing.js.map +1 -0
- package/dist/src/cdn/aes-ecb.js +19 -0
- package/dist/src/cdn/aes-ecb.js.map +1 -0
- package/dist/src/cdn/cdn-upload.js +74 -0
- package/dist/src/cdn/cdn-upload.js.map +1 -0
- package/dist/src/cdn/cdn-url.js +14 -0
- package/dist/src/cdn/cdn-url.js.map +1 -0
- package/dist/src/cdn/pic-decrypt.js +89 -0
- package/dist/src/cdn/pic-decrypt.js.map +1 -0
- package/dist/src/cdn/upload.js +115 -0
- package/dist/src/cdn/upload.js.map +1 -0
- package/dist/src/channel.js +478 -0
- package/dist/src/channel.js.map +1 -0
- package/dist/src/compat.js +67 -0
- package/dist/src/compat.js.map +1 -0
- package/dist/src/config/config-schema.js +20 -0
- package/dist/src/config/config-schema.js.map +1 -0
- package/dist/src/config/reply-progress.js +5 -0
- package/dist/src/config/reply-progress.js.map +1 -0
- package/dist/src/media/media-download.js +95 -0
- package/dist/src/media/media-download.js.map +1 -0
- package/dist/src/media/mime.js +73 -0
- package/dist/src/media/mime.js.map +1 -0
- package/dist/src/media/silk-transcode.js +64 -0
- package/dist/src/media/silk-transcode.js.map +1 -0
- package/dist/src/messaging/debug-mode.js +63 -0
- package/dist/src/messaging/debug-mode.js.map +1 -0
- package/dist/src/messaging/error-notice.js +25 -0
- package/dist/src/messaging/error-notice.js.map +1 -0
- package/dist/src/messaging/inbound.js +201 -0
- package/dist/src/messaging/inbound.js.map +1 -0
- package/dist/src/messaging/markdown-filter.js +368 -0
- package/dist/src/messaging/markdown-filter.js.map +1 -0
- package/dist/src/messaging/outbound-hooks.js +58 -0
- package/dist/src/messaging/outbound-hooks.js.map +1 -0
- package/dist/src/messaging/process-message.js +406 -0
- package/dist/src/messaging/process-message.js.map +1 -0
- package/dist/src/messaging/reply-progress-sender.js +93 -0
- package/dist/src/messaging/reply-progress-sender.js.map +1 -0
- package/dist/src/messaging/send-media.js +54 -0
- package/dist/src/messaging/send-media.js.map +1 -0
- package/dist/src/messaging/send.js +220 -0
- package/dist/src/messaging/send.js.map +1 -0
- package/dist/src/messaging/slash-commands.js +70 -0
- package/dist/src/messaging/slash-commands.js.map +1 -0
- package/dist/src/monitor/monitor.js +146 -0
- package/dist/src/monitor/monitor.js.map +1 -0
- package/dist/src/storage/state-dir.js +9 -0
- package/dist/src/storage/state-dir.js.map +1 -0
- package/dist/src/storage/sync-buf.js +64 -0
- package/dist/src/storage/sync-buf.js.map +1 -0
- package/dist/src/util/logger.js +120 -0
- package/dist/src/util/logger.js.map +1 -0
- package/dist/src/util/random.js +16 -0
- package/dist/src/util/random.js.map +1 -0
- package/dist/src/util/redact.js +54 -0
- package/dist/src/util/redact.js.map +1 -0
- package/index.ts +19 -0
- package/openclaw.plugin.json +22 -0
- package/package.json +75 -0
- package/src/api/api.ts +586 -0
- package/src/api/config-cache.ts +79 -0
- package/src/api/session-guard.ts +58 -0
- package/src/api/types.ts +278 -0
- package/src/auth/accounts.ts +394 -0
- package/src/auth/login-qr.ts +458 -0
- package/src/auth/pairing.ts +120 -0
- package/src/cdn/aes-ecb.ts +21 -0
- package/src/cdn/cdn-upload.ts +93 -0
- package/src/cdn/cdn-url.ts +20 -0
- package/src/cdn/pic-decrypt.ts +101 -0
- package/src/cdn/upload.ts +168 -0
- package/src/channel.ts +548 -0
- package/src/compat.ts +77 -0
- package/src/config/config-schema.ts +23 -0
- package/src/config/reply-progress.ts +10 -0
- package/src/media/media-download.ts +149 -0
- package/src/media/mime.ts +76 -0
- package/src/media/silk-transcode.ts +74 -0
- package/src/messaging/debug-mode.ts +69 -0
- package/src/messaging/error-notice.ts +32 -0
- package/src/messaging/inbound.ts +262 -0
- package/src/messaging/markdown-filter.ts +361 -0
- package/src/messaging/outbound-hooks.ts +88 -0
- package/src/messaging/process-message.ts +525 -0
- package/src/messaging/reply-progress-sender.ts +122 -0
- package/src/messaging/send-media.ts +72 -0
- package/src/messaging/send.ts +294 -0
- package/src/messaging/slash-commands.ts +110 -0
- package/src/monitor/monitor.ts +224 -0
- package/src/storage/state-dir.ts +11 -0
- package/src/storage/sync-buf.ts +81 -0
- package/src/util/logger.ts +145 -0
- package/src/util/random.ts +17 -0
- package/src/util/redact.ts +54 -0
- package/src/vendor.d.ts +25 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
[简体中文](CHANGELOG.zh_CN.md)
|
|
4
|
+
|
|
5
|
+
This project follows the [Keep a Changelog](https://keepachangelog.com/) format.
|
|
6
|
+
|
|
7
|
+
## [2.4.7] - 2026-07-12
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Published the fork as `@netcat-ai/openclaw-weixin`.
|
|
12
|
+
- Added channel- and account-level `baseUrl` configuration for custom iLink backends; account configuration takes precedence over channel configuration and saved credentials.
|
|
13
|
+
- QR login and QR refresh now use the resolved account base URL instead of the fixed Tencent endpoint.
|
|
14
|
+
|
|
15
|
+
## [2.4.5] - 2026-06-22
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **`classifyFetchError` — network error classification:** New `classifyFetchError` utility in `src/api/api.ts` classifies fetch-level errors into `dns` / `tcp` / `tls` / `timeout` / `unknown`. `apiGetFetch` and `apiPostFetch` now log structured error details (type, description, code) on failure, making network troubleshooting significantly easier. Includes full test coverage for ENOTFOUND, ECONNREFUSED, ETIMEDOUT, SSL/TLS, AbortError, and more.
|
|
20
|
+
- **`sendMessage` response validation:** `sendMessage` now parses the server response (`SendMessageResp` with `ret` / `errmsg`) and throws on non-zero `ret`, preventing silent delivery failures.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **`SESSION_EXPIRED_ERRCODE` → `STALE_TOKEN_ERRCODE`:** Renamed in `src/api/session-guard.ts` to more accurately describe the token-stale condition (the error code -14 indicates a stale/expired token, not a session expiry). All references in `monitor.ts` and tests updated.
|
|
25
|
+
- **Error logging improvements:**
|
|
26
|
+
- `getUpdates` errors in `monitor.ts` now include `classifyFetchError` classification (type, description, code).
|
|
27
|
+
- Removed duplicate `errLog` lines in `monitor.ts`; only `aLog.error` remains.
|
|
28
|
+
- CDN upload failure logs (`cdn-upload.ts`) now include redacted URL and error cause.
|
|
29
|
+
- `downloadRemoteImageToTemp` (`upload.ts`) now logs detailed fetch network errors with cause.
|
|
30
|
+
- API GET/POST fetch failures (`api.ts`) now log redacted URL, timeout, and error classification.
|
|
31
|
+
- **Minimum host version bumped:** `peerDependencies.openclaw` and `install.minHostVersion` raised from `>=2026.3.22` to `>=2026.5.12`.
|
|
32
|
+
|
|
33
|
+
### Added (Dev/Engineering)
|
|
34
|
+
|
|
35
|
+
- **`outbound-hooks.test.ts`:** New test file covering `applyWeixinMessageSendingHook` (no hooks, content modification, cancellation, error recovery) and `emitWeixinMessageSent` (no hooks, success, failure with fire-and-forget) scenarios.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **`pairing.test.ts` mock path:** `vi.mock` target corrected from `"openclaw/plugin-sdk"` to `"openclaw/plugin-sdk/infra-runtime"`.
|
|
40
|
+
- **`api.test.ts` sendMessage mock response:** Success test case mock now returns `"{}"` instead of `""`, matching the updated `sendMessage` logic that parses the response body.
|
|
41
|
+
|
|
42
|
+
## [2.4.4] - 2026-05-22
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- **Tool-call progress messages:** `WeixinReplyProgressSender` sends `TOOL_CALL_START` / `TOOL_CALL_RESULT` progress messages when the model executes tools. Configurable via the `replyProgressMessages` channel option (default: `true`).
|
|
47
|
+
- **Abort signal support for in-flight requests:** `apiPostFetch` / `getUpdates` now accept an external `AbortSignal`. When the gateway stops or hot-reloads a channel, the in-flight long-poll is cancelled immediately instead of waiting for the server-side timeout.
|
|
48
|
+
|
|
49
|
+
## [2.4.3] - 2026-05-08
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **`iLink-App-Id` / `iLink-App-ClientVersion` headers were empty / `0` in production.** `readPackageJson` resolved `package.json` via a fixed `../../` from `import.meta.url`, but the TypeScript build (with `index.ts` plus `src/**/*.ts` in `tsconfig.include`) emits `dist/src/api/api.js` (extra `src/` segment), so the resolved path landed on the non-existent `dist/package.json` and the catch returned `{}`. Replaced with a walk-up that searches for the plugin's own `package.json` (validated by `name` containing `openclaw-weixin` or by the presence of `ilink_appid`), tolerating both dev (`src/api/`) and built (`dist/src/api/`) layouts. Adds tests in `src/api/api.test.ts` covering the compiled layout, dev layout, nested `node_modules/<dep>/package.json` shadowing, missing manifest, and malformed manifest.
|
|
54
|
+
- **`openclaw channels login` exited non-zero when the bot was already bound to this OpenClaw**, which caused automated installers (e.g. `openclaw-weixin-installer`) to report a misleading "首次连接未完成" message and continue past a successful state. The QR poller now returns `alreadyConnected: true` for the server's `binded_redirect` status, and `auth.login` in `channel.ts` treats it as a successful no-op (no save, no throw) so the CLI exits cleanly.
|
|
55
|
+
|
|
56
|
+
## [2.4.2] - 2026-05-07
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
|
|
60
|
+
- **Node 24 / undici compatibility — `TypeError: fetch failed` on every request.** Drop the manually-set `Content-Length` header from `buildHeaders`. The bundled undici in Node 24 rejects pre-set `Content-Length` with `UND_ERR_INVALID_ARG: invalid content-length header`, breaking all CGI calls. Letting `fetch` compute it from the request body restores network calls on Node 24.
|
|
61
|
+
- **OpenClaw ≥ 2026.5.x — Weixin runtime initialization timeout restart loop.** Replace the module-scope `pluginRuntime` global (and remove `src/runtime.ts` along with it) with the `ctx.channelRuntime` injected by the gateway per call. The previous global was set during plugin registration, but newer hosts inject a per-call runtime surface, so the global was missing/stale at startup and the channel kept timing out and restarting.
|
|
62
|
+
|
|
63
|
+
### Removed
|
|
64
|
+
|
|
65
|
+
- **Dead scripts and shims:** `scripts/test-full-upload.ts` / `scripts/test-upload-url.ts` debug scripts and the unused legacy `index.ts` re-exports. No behavior change for consumers.
|
|
66
|
+
|
|
67
|
+
## [2.4.1] - 2026-05-04
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- **Ship compiled runtime in the npm tarball:** `dist/` is added to `files` and `package.json#openclaw.runtimeExtensions` is set to `["./dist/index.js"]`. The host loads the prebuilt JS entry directly instead of relying on source-only TypeScript at install time, which avoids the `requires compiled runtime output for TypeScript entry index.ts` error on stricter host versions.
|
|
72
|
+
- **`openclaw.plugin.json` channel config:** Declare `channels` and `channelConfigs` in `openclaw.plugin.json` so newer hosts (≥ 2026.4.x) can render the channel selection UI without falling back to `package.json#openclaw`.
|
|
73
|
+
|
|
74
|
+
## [2.3.1] - 2026-04-28
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- **`bot_agent` request field:** Outgoing CGI requests now carry an upstream-app-supplied `bot_agent` (UA-style `name/version (comment)` grammar, multi-product allowed). Configurable per upstream app via channel config and sanitized by `sanitizeBotAgent` in `src/api/api.ts`; falls back to `OpenClaw` when missing or invalid.
|
|
79
|
+
- **`local_token_list` on QR fetch:** `fetchQRCode` now posts the most recent local `bot_token`s (up to 10), enabling the server to recognize already-bound bots and reply with `binded_redirect` instead of issuing a duplicate session.
|
|
80
|
+
- **Pair-code login flow:** Support entering a pair-code (`verify_code`) when the QR scan triggers a server-side challenge; `waitForWeixinLogin` handles `need_verifycode` / `verify_code_blocked` states with a stdin prompt and bounded retries.
|
|
81
|
+
- **`binded_redirect` handling:** New status branch in QR polling that prints `✅ 已连接过此 OpenClaw,无需重复连接。` and returns gracefully when the scanned bot is already bound to this OpenClaw.
|
|
82
|
+
- **Connection status notify (start/stop):** Emit `notifyStart` from `gateway.startAccount` (after the provider is announced) and `notifyStop` from a new `gateway.stopAccount` hook, so the upstream Weixin server can reconcile per-account online state.
|
|
83
|
+
|
|
84
|
+
### Changed
|
|
85
|
+
|
|
86
|
+
- **QR login UX:** Reword the QR/scan prompts and remove the client-side timeout from `fetchQRCode` / `startWeixinLoginWithQr` — only server / stack limits now bound the long-poll.
|
|
87
|
+
|
|
88
|
+
## [2.1.10] - 2026-04-24
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- **Connection status notify (start/stop) — initial introduction:** `notifyStart` on account startup and `notifyStop` on shutdown via the new `gateway.stopAccount` hook. (Carried into the 2.3.x line as well.)
|
|
93
|
+
|
|
94
|
+
## [2.1.9] - 2026-04-20
|
|
95
|
+
|
|
96
|
+
### Added
|
|
97
|
+
|
|
98
|
+
- **Outbound hook support:** Add `message_sending` (pre-send interception/modification) and `message_sent` (post-send notification) hook integration for all outbound paths — `sendText`, `sendMedia`, and the inbound-reply `deliver` in `process-message`. Hook logic is extracted into a shared `src/messaging/outbound-hooks.ts` module.
|
|
99
|
+
|
|
100
|
+
### Changed
|
|
101
|
+
|
|
102
|
+
- **Cleanup:** Remove unused `mediaUrl` parameter from `sendWeixinOutbound` signature.
|
|
103
|
+
|
|
104
|
+
## [2.1.8] - 2026-04-07
|
|
105
|
+
|
|
106
|
+
### Changed
|
|
107
|
+
|
|
108
|
+
- **Markdown filter:** `StreamingMarkdownFilter` now preserves more Markdown constructs in outbound text.
|
|
109
|
+
|
|
110
|
+
## [2.1.7] - 2026-04-07
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
|
|
114
|
+
- **Plugin registration re-entrance:** Lazy-import `monitorWeixinProvider` inside `startAccount` in `channel.ts` to avoid pulling in the monitor → process-message → command-auth chain at plugin registration time, which could re-enter the plugin/provider registry before the account starts.
|
|
115
|
+
- **Initialization side effect:** Lazy-import `resolveSenderCommandAuthorizationWithRuntime` / `resolveDirectDmAuthorizationOutcome` in `process-message.ts` to prevent `ensureContextWindowCacheLoaded` from being triggered during module initialization, which caused `loadOpenClawPlugins` re-entrance.
|
|
116
|
+
|
|
117
|
+
### Changed
|
|
118
|
+
|
|
119
|
+
- **Tool-call outbound path:** `sendWeixinOutbound` now applies `StreamingMarkdownFilter` to the outbound text, consistent with the model-output path in `process-message`.
|
|
120
|
+
|
|
121
|
+
## [2.1.4] - 2026-04-03
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
|
|
125
|
+
- **QR login:** Remove client-side timeout for `get_bot_qrcode`; the request is no longer aborted on a fixed deadline (server / stack limits still apply).
|
|
126
|
+
|
|
127
|
+
## [2.1.3] - 2026-04-02
|
|
128
|
+
|
|
129
|
+
### Added
|
|
130
|
+
|
|
131
|
+
- **`StreamingMarkdownFilter`** (`src/messaging/markdown-filter.ts`): outbound text no longer runs through whole-string `markdownToPlainText` stripping; a streaming character filter replaces it, so Markdown goes from **effectively unsupported** to **partially supported**.
|
|
132
|
+
|
|
133
|
+
### Changed
|
|
134
|
+
|
|
135
|
+
- **Outbound text path:** `process-message` uses `StreamingMarkdownFilter` (`feed` / `flush`) per deliver chunk instead of `markdownToPlainText`.
|
|
136
|
+
|
|
137
|
+
### Removed
|
|
138
|
+
|
|
139
|
+
- **`markdownToPlainText`** from `src/messaging/send.ts` (and its tests from `send.test.ts`); coverage moves to `markdown-filter.test.ts`.
|
|
140
|
+
|
|
141
|
+
## [2.1.2] - 2026-04-02
|
|
142
|
+
|
|
143
|
+
### Changed
|
|
144
|
+
|
|
145
|
+
- **Config reload after login:** On each successful Weixin login, bump `channels.openclaw-weixin.channelConfigUpdatedAt` (ISO 8601) in `openclaw.json` so the gateway reloads config from disk, instead of writing an empty `accounts: {}` placeholder.
|
|
146
|
+
- **QR login:** Increase client timeout for `get_bot_qrcode` from 5s to 10s.
|
|
147
|
+
- **Docs:** Uninstall instructions now use `openclaw plugins uninstall @tencent-weixin/openclaw-weixin` (aligned with the plugins CLI).
|
|
148
|
+
- **Logging:** `debug-check` log line no longer includes `stateDir` / `OPENCLAW_STATE_DIR`.
|
|
149
|
+
|
|
150
|
+
### Removed
|
|
151
|
+
|
|
152
|
+
- **`openclaw-weixin` CLI subcommands** (`src/weixin-cli.ts` and registration in `index.ts`). Use the host `openclaw plugins uninstall …` flow instead.
|
|
153
|
+
|
|
154
|
+
### Fixed
|
|
155
|
+
|
|
156
|
+
- Resolves the **dangerous code pattern** warning when installing the plugin on **OpenClaw 2026.3.31+** (host plugin install / static checks).
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# 变更日志
|
|
2
|
+
|
|
3
|
+
[English](CHANGELOG.md)
|
|
4
|
+
|
|
5
|
+
本项目遵循 [Keep a Changelog](https://keepachangelog.com/) 格式。
|
|
6
|
+
|
|
7
|
+
## [2.4.7] - 2026-07-12
|
|
8
|
+
|
|
9
|
+
### 变更
|
|
10
|
+
|
|
11
|
+
- fork 改为通过 `@netcat-ai/openclaw-weixin` 发布。
|
|
12
|
+
- 自定义 iLink 后端支持 channel 和 account 两级 `baseUrl`;account 配置优先于 channel 配置和已保存凭据。
|
|
13
|
+
- 二维码登录及刷新使用解析后的 account base URL,不再固定请求腾讯端点。
|
|
14
|
+
|
|
15
|
+
## [2.4.5] - 2026-06-22
|
|
16
|
+
|
|
17
|
+
### 新增
|
|
18
|
+
|
|
19
|
+
- **`classifyFetchError` — 网络错误分类:** `src/api/api.ts` 新增 `classifyFetchError` 工具函数,将 fetch 级错误分类为 `dns` / `tcp` / `tls` / `timeout` / `unknown`。`apiGetFetch` 与 `apiPostFetch` 在失败时输出结构化日志(type, description, code),便于排查网络问题。覆盖 ENOTFOUND、ECONNREFUSED、ETIMEDOUT、SSL/TLS、AbortError 等场景的完整测试。
|
|
20
|
+
- **`sendMessage` 返回值校验:** `sendMessage` 现在解析服务端返回的 `SendMessageResp`(`ret` / `errmsg`),`ret` 非零时抛错,避免消息发送静默失败。
|
|
21
|
+
|
|
22
|
+
### 变更
|
|
23
|
+
|
|
24
|
+
- **`SESSION_EXPIRED_ERRCODE` → `STALE_TOKEN_ERRCODE`:** 在 `src/api/session-guard.ts` 中重命名,更准确地描述 token 过期(-14 表示 token 失效,而非 session 过期)。`monitor.ts` 与测试中所有引用同步更新。
|
|
25
|
+
- **错误日志改进:**
|
|
26
|
+
- `monitor.ts` 中 `getUpdates` 的错误日志使用 `classifyFetchError` 输出分类信息(type, description, code)。
|
|
27
|
+
- `monitor.ts` 移除重复的 `errLog` 日志行,仅保留 `aLog.error`。
|
|
28
|
+
- CDN 上传失败日志(`cdn-upload.ts`)增加脱敏 URL 和错误 cause 信息。
|
|
29
|
+
- `downloadRemoteImageToTemp`(`upload.ts`)增加 fetch 网络错误详情日志。
|
|
30
|
+
- API GET/POST fetch 失败日志(`api.ts`)增加脱敏 URL、超时设置及错误分类信息。
|
|
31
|
+
- **最低宿主版本升级:** `peerDependencies.openclaw` 和 `install.minHostVersion` 从 `>=2026.3.22` 升至 `>=2026.5.12`。
|
|
32
|
+
|
|
33
|
+
### 新增(开发/工程)
|
|
34
|
+
|
|
35
|
+
- **`outbound-hooks.test.ts`:** 新增测试文件,覆盖 `applyWeixinMessageSendingHook`(无 hook、内容修改、取消、错误容错)和 `emitWeixinMessageSent`(无 hook、成功、失败走 fire-and-forget)各场景。
|
|
36
|
+
|
|
37
|
+
### 修复
|
|
38
|
+
|
|
39
|
+
- **`pairing.test.ts` mock 路径:** `vi.mock` 目标从 `"openclaw/plugin-sdk"` 修正为 `"openclaw/plugin-sdk/infra-runtime"`。
|
|
40
|
+
- **`api.test.ts` sendMessage 测试 mock:** 成功用例的 mock 返回值从 `""` 改为 `"{}"`,与 `sendMessage` 新增的响应解析逻辑一致。
|
|
41
|
+
|
|
42
|
+
## [2.4.4] - 2026-05-22
|
|
43
|
+
|
|
44
|
+
### 新增
|
|
45
|
+
|
|
46
|
+
- **工具调用进度消息:** 模型执行 tool 时,发送 `TOOL_CALL_START` / `TOOL_CALL_RESULT` 进度消息,可通过 `replyProgressMessages` 开关控制(默认开启)。
|
|
47
|
+
- **请求中断信号支持:** `apiPostFetch` / `getUpdates` 现在接受外部的 `AbortSignal`。当网关停止或热重载频道时,正在进行的 long-poll 请求会被立即取消,无需等待服务端超时。
|
|
48
|
+
|
|
49
|
+
## [2.4.3] - 2026-05-08
|
|
50
|
+
|
|
51
|
+
### 修复
|
|
52
|
+
|
|
53
|
+
- **`iLink-App-Id` / `iLink-App-ClientVersion` 请求头在生产环境为空 / `0`。** `readPackageJson` 用固定的 `../../` 从 `import.meta.url` 推算 `package.json`,但 TypeScript 构建(`tsconfig.include` 同时包含 `index.ts` 和 `src/**/*.ts`)实际产物是 `dist/src/api/api.js`(多出一层 `src/`),导致解析到不存在的 `dist/package.json`,catch 返回 `{}`。改为从当前模块所在目录向上逐级查找,并通过 `name` 包含 `openclaw-weixin` 或存在 `ilink_appid` 字段来确认是本插件自己的 `package.json`,同时兼容开发态(`src/api/`)和发布态(`dist/src/api/`)布局。`src/api/api.test.ts` 新增 5 个用例覆盖编译产物布局、开发布局、途经 `node_modules/<dep>/package.json` 不被误识别、找不到时返回 `{}`、坏 JSON 容错继续向上查找。
|
|
54
|
+
- **`openclaw channels login` 在 "已连接过此 OpenClaw" 场景下被误判为失败。** 服务端返回 `binded_redirect` 时本地凭据其实仍有效,但旧逻辑返回 `connected: false`,`channel.ts` 的 `auth.login` 据此 `throw`,CLI 非零退出,导致 `openclaw-weixin-installer` 等自动化脚本误打印"首次连接未完成"。`WeixinQrWaitResult` 新增 `alreadyConnected` 字段,QR 轮询在 `binded_redirect` 时置为 `true`;`auth.login` 据此仅记录消息、不抛错,CLI 以 0 退出。
|
|
55
|
+
|
|
56
|
+
## [2.4.2] - 2026-05-07
|
|
57
|
+
|
|
58
|
+
### 修复
|
|
59
|
+
|
|
60
|
+
- **Node 24 / undici 兼容性——所有请求 `TypeError: fetch failed`。** 从 `buildHeaders` 中移除手动设置的 `Content-Length`。Node 24 自带的 undici 不允许调用方预设 `Content-Length`,会以 `UND_ERR_INVALID_ARG: invalid content-length header` 拒绝整个请求,导致所有 CGI 调用失败。改由 `fetch` 根据请求体自动计算,恢复在 Node 24 下的网络调用。
|
|
61
|
+
- **OpenClaw ≥ 2026.5.x——微信 runtime 初始化超时无限重启。** 移除模块作用域的 `pluginRuntime` 全局变量(同时删掉 `src/runtime.ts`),改为按调用从网关 ctx 中读取 `ctx.channelRuntime`。原先的全局是在插件注册阶段写入的,但较新宿主改为按调用注入 runtime surface,启动时拿不到/拿到旧值,channel 启动一直超时进而被反复重启。
|
|
62
|
+
|
|
63
|
+
### 移除
|
|
64
|
+
|
|
65
|
+
- **冗余脚本与入口:** 删除调试用的 `scripts/test-full-upload.ts` / `scripts/test-upload-url.ts`,以及遗留的 `index.ts` 转发文件。对调用方无行为变更。
|
|
66
|
+
|
|
67
|
+
## [2.4.1] - 2026-05-04
|
|
68
|
+
|
|
69
|
+
### 新增
|
|
70
|
+
|
|
71
|
+
- **npm 包内携带 dist 产物作为 channel 入口:** `package.json` 的 `files` 加入 `dist/`,`openclaw.runtimeExtensions` 设为 `["./dist/index.js"]`;宿主直接加载预编译的 JS 入口,不再依赖装包时的 TypeScript 源码,避免在较严格的宿主版本上出现 `requires compiled runtime output for TypeScript entry index.ts` 错误。
|
|
72
|
+
- **`openclaw.plugin.json` 频道配置:** 在 `openclaw.plugin.json` 中声明 `channels` 与 `channelConfigs`,使较新宿主(≥ 2026.4.x)能直接渲染频道选择 UI,无需回退到 `package.json#openclaw`。
|
|
73
|
+
|
|
74
|
+
## [2.3.1] - 2026-04-28
|
|
75
|
+
|
|
76
|
+
### 新增
|
|
77
|
+
|
|
78
|
+
- **`bot_agent` 请求字段:** 上行 CGI 现在携带由上层应用提供的 `bot_agent`(类似 UA 的 `name/version (comment)` 语法,支持多个 product),按上层应用的 channel 配置传入;`src/api/api.ts` 中的 `sanitizeBotAgent` 负责清洗与长度上限,缺失或不合法时回落为 `OpenClaw`。
|
|
79
|
+
- **扫码时上送 `local_token_list`:** `fetchQRCode` 现在带上本地最近 10 个 `bot_token`,让服务端识别"已绑定到本端"的 bot 并下发 `binded_redirect`,避免重复发会话。
|
|
80
|
+
- **配对码登录流程:** 服务端要求二次校验时(`need_verifycode` / `verify_code_blocked`),`waitForWeixinLogin` 通过 stdin 提示用户输入 `verify_code` 并做有限次重试。
|
|
81
|
+
- **`binded_redirect` 处理:** QR 轮询新增分支,输出 `✅ 已连接过此 OpenClaw,无需重复连接。` 并优雅返回。
|
|
82
|
+
- **连接状态通知(start/stop):** `gateway.startAccount` 在 provider 注册后调用 `notifyStart`,新增的 `gateway.stopAccount` hook 调用 `notifyStop`,便于上游微信服务端对账户在线状态进行对账。
|
|
83
|
+
|
|
84
|
+
### 变更
|
|
85
|
+
|
|
86
|
+
- **扫码登录文案:** 调整 QR / 扫码相关的提示文案;同时移除 `fetchQRCode` / `startWeixinLoginWithQr` 的客户端超时,长轮询仅受服务端与网络栈限制。
|
|
87
|
+
|
|
88
|
+
## [2.1.10] - 2026-04-24
|
|
89
|
+
|
|
90
|
+
### 新增
|
|
91
|
+
|
|
92
|
+
- **连接状态通知(start/stop)首次引入:** 账号启动时发送 `notifyStart`,关闭时通过新的 `gateway.stopAccount` hook 发送 `notifyStop`。该能力在后续 2.3.x 中保留。
|
|
93
|
+
|
|
94
|
+
## [2.1.9] - 2026-04-20
|
|
95
|
+
|
|
96
|
+
### 新增
|
|
97
|
+
|
|
98
|
+
- **外发 hook 支持:** 为所有外发路径(`sendText`、`sendMedia`、`process-message` 中的入站回复 `deliver`)接入 `message_sending`(发送前拦截/修改)和 `message_sent`(发送后通知)hook。hook 逻辑抽取至共享模块 `src/messaging/outbound-hooks.ts`。
|
|
99
|
+
|
|
100
|
+
### 变更
|
|
101
|
+
|
|
102
|
+
- **清理:** 移除 `sendWeixinOutbound` 签名中未使用的 `mediaUrl` 参数。
|
|
103
|
+
|
|
104
|
+
## [2.1.8] - 2026-04-07
|
|
105
|
+
|
|
106
|
+
### 变更
|
|
107
|
+
|
|
108
|
+
- **Markdown 过滤器:** `StreamingMarkdownFilter` 放开了更多 Markdown 格式的保留。
|
|
109
|
+
|
|
110
|
+
## [2.1.7] - 2026-04-07
|
|
111
|
+
|
|
112
|
+
### 修复
|
|
113
|
+
|
|
114
|
+
- **插件注册重入:** `channel.ts` 中将 `monitorWeixinProvider` 改为在 `startAccount` 内部懒加载(`await import(...)`),避免插件注册阶段提前拉取 monitor → process-message → command-auth 依赖链,导致 plugin/provider registry 重入。
|
|
115
|
+
- **初始化副作用:** `process-message.ts` 中将 `resolveSenderCommandAuthorizationWithRuntime` / `resolveDirectDmAuthorizationOutcome` 改为懒加载,避免模块初始化时触发宿主的 `ensureContextWindowCacheLoaded` 副作用,进而导致 `loadOpenClawPlugins` 重入。
|
|
116
|
+
|
|
117
|
+
### 变更
|
|
118
|
+
|
|
119
|
+
- **tool-call 外发路径:** `sendWeixinOutbound` 现在对发送文本应用 `StreamingMarkdownFilter`,与 `process-message` 中的 model-output 路径保持一致。
|
|
120
|
+
|
|
121
|
+
## [2.1.4] - 2026-04-03
|
|
122
|
+
|
|
123
|
+
### 变更
|
|
124
|
+
|
|
125
|
+
- **扫码登录:** 移除 `get_bot_qrcode` 的客户端超时,请求不再因固定时限被 abort(仍受服务端与网络栈限制)。
|
|
126
|
+
|
|
127
|
+
## [2.1.3] - 2026-04-02
|
|
128
|
+
|
|
129
|
+
### 新增
|
|
130
|
+
|
|
131
|
+
- **`StreamingMarkdownFilter`**(`src/messaging/markdown-filter.ts`):外发文本由原先 `markdownToPlainText` 整段剥离 Markdown,改为流式逐字符过滤;**对 Markdown 从完全不支持变为部分支持**。
|
|
132
|
+
|
|
133
|
+
### 变更
|
|
134
|
+
|
|
135
|
+
- **外发文本:** `process-message` 在每次 `deliver` 时用 `StreamingMarkdownFilter`(`feed` / `flush`)处理回复,替代 `markdownToPlainText`。
|
|
136
|
+
|
|
137
|
+
### 移除
|
|
138
|
+
|
|
139
|
+
- 从 `src/messaging/send.ts` 删除 **`markdownToPlainText`**(相关用例从 `send.test.ts` 迁至 `markdown-filter.test.ts`)。
|
|
140
|
+
|
|
141
|
+
## [2.1.2] - 2026-04-02
|
|
142
|
+
|
|
143
|
+
### 变更
|
|
144
|
+
|
|
145
|
+
- **登录后配置刷新:** 每次微信登录成功后,在 `openclaw.json` 中更新 `channels.openclaw-weixin.channelConfigUpdatedAt`(ISO 8601),让网关从磁盘重新加载配置;不再写入空的 `accounts: {}` 占位。
|
|
146
|
+
- **扫码登录:** `get_bot_qrcode` 客户端超时由 5s 调整为 10s。
|
|
147
|
+
- **文档:** 卸载说明改为使用 `openclaw plugins uninstall @tencent-weixin/openclaw-weixin`,与插件 CLI 一致。
|
|
148
|
+
- **日志:** `debug-check` 日志不再输出 `stateDir` / `OPENCLAW_STATE_DIR`。
|
|
149
|
+
|
|
150
|
+
### 移除
|
|
151
|
+
|
|
152
|
+
- **`openclaw-weixin` 子命令**(删除 `src/weixin-cli.ts` 及 `index.ts` 中的注册)。请使用宿主自带的 `openclaw plugins uninstall …` 卸载流程。
|
|
153
|
+
|
|
154
|
+
### 修复
|
|
155
|
+
|
|
156
|
+
- 解决在 **OpenClaw 2026.3.31 及更新版本**上安装插件时出现的 **dangerous code pattern** 提示(宿主插件安装 / 静态检查)。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Tencent is pleased to support the open source community by making openclaw-weixin available.
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2026 Tencent. All rights reserved.
|
|
4
|
+
|
|
5
|
+
openclaw-weixin is licensed under the MIT.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Terms of the MIT:
|
|
9
|
+
--------------------------------------------------------------------
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
11
|
+
a copy of this software and associated documentation files (the
|
|
12
|
+
"Software"), to deal in the Software without restriction, including
|
|
13
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
14
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
15
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
16
|
+
the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be
|
|
19
|
+
included in all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
24
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
25
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|