@dingxiang-me/openclaw-wechat 2.0.1 → 2.3.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 (79) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.en.md +204 -32
  3. package/README.md +234 -63
  4. package/docs/channels/wecom.md +137 -1
  5. package/openclaw.plugin.json +694 -10
  6. package/package.json +207 -4
  7. package/scripts/wecom-agent-selfcheck.mjs +775 -0
  8. package/scripts/wecom-bot-longconn-probe.mjs +582 -0
  9. package/scripts/wecom-bot-selfcheck.mjs +952 -0
  10. package/scripts/wecom-callback-matrix.mjs +224 -0
  11. package/scripts/wecom-doctor.mjs +1407 -0
  12. package/scripts/wecom-e2e-scenario.mjs +333 -0
  13. package/scripts/wecom-migrate.mjs +261 -0
  14. package/scripts/wecom-quickstart.mjs +1824 -0
  15. package/scripts/wecom-release-check.mjs +232 -0
  16. package/scripts/wecom-remote-e2e.mjs +310 -0
  17. package/scripts/wecom-selfcheck.mjs +1255 -0
  18. package/scripts/wecom-smoke.sh +74 -0
  19. package/src/core/delivery-router.js +21 -0
  20. package/src/core.js +631 -34
  21. package/src/wecom/account-config-core.js +27 -1
  22. package/src/wecom/account-config.js +19 -2
  23. package/src/wecom/agent-dispatch-executor.js +11 -0
  24. package/src/wecom/agent-dispatch-handlers.js +61 -8
  25. package/src/wecom/agent-inbound-guards.js +63 -16
  26. package/src/wecom/agent-inbound-processor.js +34 -2
  27. package/src/wecom/agent-late-reply-runtime.js +30 -2
  28. package/src/wecom/agent-text-sender.js +2 -0
  29. package/src/wecom/api-client-core.js +27 -19
  30. package/src/wecom/api-client-media.js +16 -7
  31. package/src/wecom/api-client-send-text.js +4 -0
  32. package/src/wecom/api-client-send-typed.js +4 -1
  33. package/src/wecom/api-client-senders.js +41 -3
  34. package/src/wecom/api-client.js +1 -0
  35. package/src/wecom/bot-dispatch-fallback.js +18 -3
  36. package/src/wecom/bot-dispatch-handlers.js +47 -10
  37. package/src/wecom/bot-inbound-dispatch-runtime.js +3 -0
  38. package/src/wecom/bot-inbound-executor-helpers.js +11 -1
  39. package/src/wecom/bot-inbound-executor.js +25 -1
  40. package/src/wecom/bot-inbound-guards.js +78 -23
  41. package/src/wecom/bot-long-connection-manager.js +4 -4
  42. package/src/wecom/channel-config-schema.js +132 -0
  43. package/src/wecom/channel-plugin.js +370 -7
  44. package/src/wecom/command-handlers.js +107 -10
  45. package/src/wecom/command-status-text.js +275 -1
  46. package/src/wecom/doc-client.js +7 -1
  47. package/src/wecom/inbound-content-handler-file-video-link.js +4 -0
  48. package/src/wecom/inbound-content-handler-image-voice.js +6 -0
  49. package/src/wecom/inbound-content.js +5 -0
  50. package/src/wecom/installer-api.js +910 -0
  51. package/src/wecom/media-download.js +2 -2
  52. package/src/wecom/migration-diagnostics.js +816 -0
  53. package/src/wecom/network-config.js +91 -0
  54. package/src/wecom/observability-metrics.js +9 -3
  55. package/src/wecom/outbound-agent-delivery.js +313 -0
  56. package/src/wecom/outbound-agent-media-sender.js +37 -7
  57. package/src/wecom/outbound-agent-push.js +1 -0
  58. package/src/wecom/outbound-delivery.js +129 -12
  59. package/src/wecom/outbound-stream-msg-item.js +25 -2
  60. package/src/wecom/outbound-webhook-delivery.js +19 -0
  61. package/src/wecom/outbound-webhook-media.js +30 -6
  62. package/src/wecom/pairing.js +188 -0
  63. package/src/wecom/pending-reply-manager.js +143 -0
  64. package/src/wecom/plugin-account-policy-services.js +26 -0
  65. package/src/wecom/plugin-base-services.js +58 -0
  66. package/src/wecom/plugin-constants.js +1 -1
  67. package/src/wecom/plugin-delivery-inbound-services.js +25 -0
  68. package/src/wecom/plugin-processing-deps.js +7 -0
  69. package/src/wecom/plugin-route-runtime-deps.js +1 -0
  70. package/src/wecom/plugin-services.js +87 -0
  71. package/src/wecom/policy-resolvers.js +93 -20
  72. package/src/wecom/quickstart-metadata.js +1247 -0
  73. package/src/wecom/reasoning-visibility.js +104 -0
  74. package/src/wecom/register-runtime.js +10 -0
  75. package/src/wecom/reliable-delivery-persistence.js +138 -0
  76. package/src/wecom/reliable-delivery.js +642 -0
  77. package/src/wecom/reply-output-policy.js +171 -0
  78. package/src/wecom/text-inbound-scheduler.js +6 -1
  79. package/src/wecom/workspace-auto-sender.js +2 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,91 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [2.3.0] - 2026-03-15
8
+
9
+ ### Added
10
+ - 文档与发布说明已收口为插件侧接入路径:默认推荐 `installer / quickstart / doctor`,`openclaw channels add --channel wecom --use-env` 仅保留为高级 env-backed 初始化路径
11
+ - 新增官方 / sunnoy 风格配置兼容:支持顶层与账户级 `botId`、`secret`、`network.egressProxyUrl`、`network.apiBaseUrl`
12
+ - `wecom:migrate` 现在会识别 flat `botId/secret` 与 `network.*`,并生成归一化到 `bot.longConnection.*`、`outboundProxy`、`apiBaseUrl` 的 patch
13
+ - `wecom:migrate` / `wecom:doctor` 新增 `migrationSource`,可区分 `official-wecom / sunnoy-wecom / legacy-openclaw-wechat / mixed-source`
14
+ - `wecom:doctor` 新增 `--fix / --confirm-fix`,可先应用本地可落盘的 migration/plugin patch,再用修正后的配置重跑 doctor
15
+ - `openclaw.plugin.json` schema 新增上述兼容字段声明,避免被严格校验误判成 inline 账户
16
+ - `delivery.reasoning.mode/title/maxChars`,可控制 WeCom `<think>` / reasoning 内容分离显示、合并到最终回复或隐藏
17
+ - `delivery.replyFormat`,支持 `auto / text / markdown`,可按链路保留 markdown 或自动回退纯文本
18
+ - 最终回复支持 `MEDIA:` / `FILE:` 指令;Bot / Agent 会自动隐藏指令行并回传对应媒体
19
+ - Pending Reply 新增可选持久化,支持把可靠投递状态落盘并在 gateway 重启后恢复
20
+ - `wecom:selfcheck`、`wecom:agent:selfcheck`、`wecom:bot:selfcheck` 新增 persistence / reasoning 摘要
21
+ - channel metadata 新增结构化 quickstart modes,可直接暴露 `bot_long_connection / agent_callback / hybrid` 三种 starter config
22
+ - 新增 `npm run wecom:quickstart`,可打印或合并写入 starter config,并自动备份原 `openclaw.json`
23
+ - quickstart 新增群策略模板:`inherit / mention_only / open_direct / allowlist_template / deny`,支持用 `--group-profile` 直接生成常见群策略配置
24
+ - 新增显式群聊准入策略:`groupPolicy`、`groupChat.policy`、`groups.<chatId>.policy`,支持 `open / allowlist / deny`
25
+ - `/status` 与 selfcheck 新增群策略诊断摘要,直接显示当前命中的群规则来源、触发模式和白名单是否处于生效状态
26
+ - quickstart 新增 setup plan:可直接产出 `placeholders / setupChecklist / warnings`,并通过 runtime metadata 暴露 `supportsSetupPlan / setupCommand / writeCommand`
27
+ - quickstart 新增 `--wizard` 交互式向导,可逐步选择 mode / dm / group profile,并在最后确认是否写入配置
28
+ - quickstart 新增 `--run-checks / --force-checks`,可直接串起推荐 selfcheck,并在 JSON 输出里返回 `postcheck` 摘要
29
+ - quickstart `postcheck` 新增 remediation 归纳,会把常见失败信号翻译成下一步修复建议
30
+ - quickstart `postcheck` 新增 `repairArtifacts`,可直接产出最小 `configPatch` 与 `.env` 模板,减少手工补配置
31
+ - quickstart 新增 `--repair-dir`,可把 `repairArtifacts` 直接落盘为 `wecom.config-patch.json`、`wecom.account-patch.json`、`wecom.env.template`
32
+ - quickstart 新增 `--apply-repair`,可把生成的 repair patch 直接 merge 到目标 `openclaw.json` 并保留备份
33
+ - quickstart 新增 `--confirm-repair`,可先预览将要变更的字段,再确认是否真正应用 repair patch
34
+ - quickstart setup plan / `--json` 新增 `actions`、`installState`、`migrationState`,便于 CLI / UI 直接消费接入闭环动作
35
+ - quickstart `postcheck` 新增 `repairPlan`,会结构化列出 repair 的配置变更、env 变更和预计文件输出
36
+ - `repairApply` / starter `write` 新增 `changedPaths`,可直接看到真实落盘的字段
37
+ - 新增 `npm run wecom:migrate`,可独立盘点 `legacy_config / mixed_layout / stale_package` 并生成迁移 patch 与 env 模板
38
+ - 新增 `npm run wecom:doctor`,可统一聚合 migration、自检、Agent/Bot E2E、Bot 长连接探针和公网回调矩阵
39
+ - 新增单独安装器包 `@dingxiang-me/openclaw-wecom-cli`,支持 `npx -y @dingxiang-me/openclaw-wecom-cli install`
40
+ - 外部安装器 `install --json` 现在会输出 `migration.guide`、legacy 字段路径和回滚命令,并支持 `--confirm-doctor-fix / --no-doctor-fix / --yes`
41
+ - 外部安装器 `install --json` 新增结构化 `actions`,可直接消费来源审阅、迁移 patch、回滚和重跑 doctor 的动作列表
42
+ - 外部安装器在未显式传 `--mode` 时,会按来源和当前配置能力自动选择 `bot_long_connection / agent_callback / hybrid`,并在 `sourceProfile` 里解释决策
43
+ - 外部安装器 `sourceProfile` 新增来源专属 `checkOrder / repairDefaults`;官方 / legacy 来源默认自动附带 `doctor --fix`,sunnoy / mixed-source 默认先给修复建议
44
+ - quickstart `--json` 新增 `sourcePlaybook`,会按当前来源返回推荐检查顺序、占位项提示和默认 repair 策略
45
+ - quickstart metadata 新增 `supportsActions / supportsMigration / supportsRepairPlan / supportsConfirmRepair / migrationCommand`
46
+ - 新增 `npm run test:e2e:local`,黑盒验证本地 `install -> doctor -> fix -> rerun` 闭环
47
+ - 新增 `npm run test:release`,统一检查 root 包、installer CLI、manifest、运行时版本常量和 `npm pack --dry-run` 产物
48
+ - CI 新增 `Onboarding E2E` 与 `Release Check` 两条门禁;tag 发布新增 release workflow,顺序发布插件包与 installer CLI
49
+ - WeCom 插件新增 `setup.applyAccountConfig / applyAccountName / validateInput`,`openclaw channels add --channel wecom --use-env` 现在可用
50
+ - `channels add` 文档补充为 env-backed WeCom 初始化路径,并明确剩余限制来自 OpenClaw core 当前通用参数集合
51
+
52
+ ### Changed
53
+ - WeCom API token / send / media / doc 链路现在统一支持自定义 `apiBaseUrl`
54
+ - `wecom:selfcheck`、`wecom:agent:selfcheck`、`wecom:bot:selfcheck` 已补齐这些兼容字段的识别,不再把它们误判成 legacy inline 账号
55
+ - Bot fallback、Agent 最终回复和 `/status` 现在都会按 reasoning 策略统一处理可见文本与思考内容
56
+ - 可靠投递状态存储支持导出/恢复,Pending Reply 不再局限于纯内存生命周期
57
+ - package.json / openclaw.plugin.json / runtime channel meta 的接入元数据已同步,便于 installer / quickstart / doctor 和后续集成入口直接消费
58
+ - package.json / openclaw.plugin.json / runtime channel meta 现在会同时暴露 `supportsDoctor / doctorCommand`
59
+ - package metadata / runtime quickstart 现在会同时暴露 `supportsExternalInstaller / installerSpec / installerCommand`
60
+ - 群聊发送者校验不再只依赖 `allowFrom` 是否非空推断;`/status`、manifest、UI schema 与运行时现在统一展示显式 `groupPolicy`
61
+ - selfcheck 的 legacy inline 账号发现保留字同步补齐 `groupPolicy/groupAllowFrom/groups`,避免把群策略字段误判成账号 ID
62
+ - `wecom:selfcheck` 现在会直接显示 install / migration 状态,并在检测到 legacy 布局时指向 `npm run wecom:migrate -- --json`
63
+ - 版本一致性回归不再硬编码具体版本号,改为强校验 root 包、CLI 包、manifest 与运行时常量同步
64
+
65
+ ## [2.2.0] - 2026-03-14
66
+
67
+ ### Added
68
+ - 新增 WeCom 可靠投递状态跟踪,统一记录 `24h` 回复窗口、主动发送额度和当前会话/账户的 Pending Reply 数量
69
+ - 新增 Pending Reply 队列与重试管理器,支持失败最终回复的定时补发和“下次入站优先补发”
70
+ - `/status` 新增可靠投递摘要,直接展示窗口状态、额度状态和最近失败原因
71
+ - `wecom:selfcheck`、`wecom:agent:selfcheck`、`wecom:bot:selfcheck` 新增 `reliable-delivery` 摘要
72
+
73
+ ### Changed
74
+ - WeCom Bot delivery router 现在会输出标准化 `deliveryStatus`,区分 `delivered / rejected_window / rejected_quota / rejected_transport / rejected_target / rejected_unknown`
75
+ - Agent 最终文本回复和超时后的 late reply / timeout fallback 统一接入可靠投递链路
76
+ - 配置 schema 新增 `channels.wecom.delivery.pendingReply.*` 与 `channels.wecom.delivery.quotaTracking.enabled`
77
+ - 仓库、manifest 与运行时版本号统一升级到 `2.2.0`
78
+
79
+ ## [2.1.0] - 2026-03-14
80
+
81
+ ### Added
82
+ - 新增 `dm.mode=pairing`,首次私聊可接入 OpenClaw 原生配对审批流,不再只能依赖静态 `allowFrom`
83
+ - 新增 WeCom 渠道 pairing metadata,支持 `quickstartAllowFrom`、`wecomUserId` 归一化以及审批通过后的默认通知回执
84
+ - `wecom:selfcheck`、`wecom:agent:selfcheck`、`wecom:bot:selfcheck` 新增接入摘要,直接输出 `readiness` 与 `routing`
85
+
86
+ ### Changed
87
+ - WeCom 渠道 metadata 补齐 `detailLabel`、`systemImage` 与 quickstart 提示,接入路径更贴近 OpenClaw 原生渠道
88
+ - `/status` 输出优先展示“收消息 / 回消息 / 主动发送 / 媒体 / 语音 / 文档”准备情况,并显式展示 `bindings` / `dynamicAgent` 路由来源
89
+ - WeCom Bot 长连接正常连接日志默认降到 `debug`,减少 `connect/opened/subscribed` 噪音
90
+ - README(中英文)改成 `2.1.0` 接入口径,补充 `pairing`、selfcheck 摘要和推荐接入顺序
91
+
7
92
  ## [2.0.1] - 2026-03-14
8
93
 
9
94
  ### Fixed
package/README.en.md CHANGED
@@ -10,7 +10,7 @@ OpenClaw-Wechat is an OpenClaw channel plugin for Enterprise WeChat (WeCom), wit
10
10
 
11
11
  ## Table of Contents
12
12
 
13
- - [Major Update (v2.0.0)](#major-update-v200)
13
+ - [Reliable Delivery Update (v2.2.0)](#reliable-delivery-update-v220)
14
14
  - [Highlights](#highlights)
15
15
  - [Mode Comparison](#mode-comparison)
16
16
  - [5-Minute Quick Start](#5-minute-quick-start)
@@ -28,41 +28,29 @@ OpenClaw-Wechat is an OpenClaw channel plugin for Enterprise WeChat (WeCom), wit
28
28
  - [Development](#development)
29
29
  - [FAQ](#faq)
30
30
 
31
- ## Major Update (v2.0.0)
31
+ ## Reliable Delivery Update (v2.2.0)
32
32
 
33
- This is a real capability update, not a minor patch.
34
- `OpenClaw-Wechat` now has **working WeCom Bot long-connection support** in real gateway runtime.
33
+ This release focuses on reply reliability rather than new surface area. The goal is to make WeCom delivery visible, retryable, and diagnosable.
35
34
 
36
- ### WeCom Bot long connection
35
+ ### What changed
37
36
 
38
37
  | Item | Result |
39
38
  |---|---|
40
- | Official endpoint | `wss://openws.work.weixin.qq.com` |
41
- | Inbound commands | `aibot_msg_callback` / `aibot_event_callback` |
42
- | Outbound command | `aibot_respond_msg` |
43
- | Runtime | switched to `ws`, no longer blocked by built-in Node WebSocket `1006` failures |
44
- | Public Bot callback required | no, not in long-connection mode |
45
- | Verification command | `npm run wecom:bot:longconn:probe -- --json` |
46
-
47
- ### Control UI and operations
48
-
49
- This release also keeps the earlier operations improvements: **WeCom supports visual configuration in Control UI**, so you no longer need to rely on manual JSON edits only.
50
-
51
- ### Visual config in Control UI
52
-
53
- | Item | Status | Notes |
54
- |---|---|---|
55
- | WeCom config form | ✅ | `channels.wecom` can be edited/saved directly from UI |
56
- | Localized labels | ✅ | Common fields are now clearly labeled in Chinese for ops teams |
57
- | Sensitive-field hints | ✅ | secret/token/aesKey fields are marked as sensitive |
58
- | Runtime status clarity | ✅ | `Connected` is no longer stuck at `n/a`; default account display name is localized |
59
- | Inbound activity tracking | ✅ | `Last inbound` is updated after webhook callbacks (`n/a` before first inbound after restart is expected) |
39
+ | Reliable-delivery status | `/status` now shows `24h window / proactive quota / Pending Reply` summary |
40
+ | Pending Reply | final replies that fail to deliver are queued for retry and next-inbound replay |
41
+ | Failure classification | delivery now distinguishes `window expired / quota exhausted / transport failure / invalid target` |
42
+ | Selfcheck summaries | `wecom:selfcheck`, `wecom:agent:selfcheck`, and `wecom:bot:selfcheck` now print `reliable-delivery` summaries |
43
+ | Group-policy diagnostics | `/status` and selfcheck now show group rule source, access mode, and whether allowlists are actually active |
44
+ | Bot/Agent convergence | bot fallback and agent final reply now share the same reliable-delivery tracking |
45
+ | Long-connection log noise | normal connect / opened / subscribed logs stay at `debug` |
60
46
 
61
47
  ### Practical impact
62
48
 
63
- - Configure WeCom directly in `Channels -> WeCom` without hand-editing large config files.
64
- - Better readability for day-to-day ops and handover.
65
- - More accurate runtime status display reduces false alarm on “plugin not working”.
49
+ - You can now see whether the current session is still inside the 24-hour reply window.
50
+ - Group-chat policy no longer requires log forensics: `/status` and selfcheck explain which group rule is active and whether an allowlist is currently enforced.
51
+ - Failed final replies no longer disappear into timeout-only fallbacks; they move into Pending Reply retry flow.
52
+ - Selfcheck now tells you whether reliable-delivery tracking is enabled, not just whether tokens and webhook paths exist.
53
+ - Bot long-connection stays quiet by default while keeping warnings and errors visible.
66
54
 
67
55
  ## Highlights
68
56
 
@@ -75,7 +63,7 @@ This release also keeps the earlier operations improvements: **WeCom supports vi
75
63
  | Bot card replies | ✅ | `markdown/template_card` with automatic text fallback |
76
64
  | Multi-account support | ✅ | `channels.wecom.accounts.<id>` |
77
65
  | Sender allowlist and admin bypass | ✅ | `allowFrom` + `adminUsers` |
78
- | Direct-message policy | ✅ | `dm.mode=open/allowlist/deny` + account overrides |
66
+ | Direct-message policy | ✅ | `dm.mode=open/allowlist/pairing/deny` + account overrides |
79
67
  | Event welcome reply (`enter_agent`) | ✅ | configurable via `events.enterAgentWelcome*` |
80
68
  | Command allowlist | ✅ | `/help`, `/status`, `/clear`, `/new`, etc. |
81
69
  | Group trigger policy | ✅ | mention-required or direct-trigger |
@@ -99,11 +87,39 @@ This release also keeps the earlier operations improvements: **WeCom supports vi
99
87
 
100
88
  ### 1) Install plugin
101
89
 
90
+ Fastest path:
91
+
92
+ ```bash
93
+ npx -y @dingxiang-me/openclaw-wecom-cli install
94
+ ```
95
+
96
+ This wraps the same quickstart / migrate / doctor flow and turns plugin install + starter config write into one command.
97
+
98
+ If you want to stay inside this repo, run the same flow with:
99
+
100
+ ```bash
101
+ npm run wecom:quickstart -- --mode bot_long_connection
102
+ npm run wecom:doctor -- --json
103
+ ```
104
+
105
+ If you already have `WECOM_*` / `WECOM_BOT_*` env vars prepared, WeCom also supports an env-backed `channels add` flow:
106
+
107
+ ```bash
108
+ export WECOM_BOT_LONG_CONNECTION_BOT_ID=your-bot-id
109
+ export WECOM_BOT_LONG_CONNECTION_SECRET=your-bot-secret
110
+ openclaw channels add --channel wecom --use-env
111
+ ```
112
+
113
+ This works without any OpenClaw core patch because the plugin exposes `setup.applyAccountConfig` for WeCom. It can persist Agent/Bot settings discovered from env vars into `openclaw.json`.
114
+ Treat it as an advanced env-backed compatibility path, not the primary onboarding flow. For full setup, migration, and repair, the external installer remains the recommended path.
115
+
116
+ If you only want the plugin package itself:
117
+
102
118
  ```bash
103
119
  openclaw plugins install @dingxiang-me/openclaw-wechat
104
120
  ```
105
121
 
106
- Recommended minimum package version: `2.0.0`. If `plugins.installs.openclaw-wechat` in `openclaw.json` still reports `1.7.x`, upgrade or reinstall first; those older npm packages do not expose the current WeCom channel metadata.
122
+ Recommended minimum package version: `2.3.0`. If `plugins.installs.openclaw-wechat` in `openclaw.json` still reports `1.7.x`, upgrade or reinstall first; those older npm packages do not expose the current WeCom onboarding, migration, or reliable-delivery capabilities.
107
123
 
108
124
  For local development or direct source-path loading, use:
109
125
 
@@ -159,6 +175,20 @@ If you are loading from source path instead, use the version below with `load.pa
159
175
 
160
176
  > Agent-mode note (important): configure **Trusted IP** in the WeCom self-built app settings and include the real egress IP of your OpenClaw gateway. Otherwise you may see "messages received but no reply".
161
177
 
178
+ If you want first-contact DM approval, add:
179
+
180
+ ```json
181
+ {
182
+ "channels": {
183
+ "wecom": {
184
+ "dm": {
185
+ "mode": "pairing"
186
+ }
187
+ }
188
+ }
189
+ }
190
+ ```
191
+
162
192
  ### 4) Restart and verify
163
193
 
164
194
  ```bash
@@ -169,6 +199,11 @@ npm run wecom:agent:selfcheck -- --all-accounts
169
199
  npm run wecom:bot:selfcheck -- --all-accounts
170
200
  ```
171
201
 
202
+ Selfcheck now starts with two summary lines:
203
+
204
+ - `readiness`: whether receive / reply / send are currently usable
205
+ - `routing`: whether `bindings` and `dynamicAgent` are active
206
+
172
207
  ## Requirements
173
208
 
174
209
  | Item | Description |
@@ -310,16 +345,135 @@ When multi-account is enabled, each account can override Bot callback credential
310
345
  | Sender ACL | `allowFrom`, `allowFromRejectMessage` |
311
346
  | Command ACL | `commands.enabled`, `commands.allowlist`, `commands.rejectMessage` |
312
347
  | Admin bypass | `adminUsers` |
313
- | Direct-message policy | `dm.mode`, `dm.allowFrom`, `dm.rejectMessage` |
348
+ | Direct-message policy | `dm.mode`, `dm.allowFrom`, `dm.rejectMessage` (`open / allowlist / pairing / deny`) |
314
349
  | Event policy | `events.enabled`, `events.enterAgentWelcomeEnabled`, `events.enterAgentWelcomeText` |
315
350
  | Group trigger | `groupChat.enabled`, `groupChat.triggerMode`, `groupChat.mentionPatterns`, `groupChat.triggerKeywords` |
351
+ | Group policy | `groupPolicy`, `groupChat.policy`, `groups.<chatId>.policy` (`open / allowlist / deny`) |
352
+ | Group member ACL | `groupAllowFrom`, `groups.<chatId>.allowFrom` (used with `allowlist`) |
316
353
  | Dynamic route | `dynamicAgent.*` (compatible with `dynamicAgents.*`, `dm.createAgentOnFirstMessage`) |
317
354
  | Debounce | `debounce.enabled`, `debounce.windowMs`, `debounce.maxBatch` |
318
355
  | Agent streaming | `streaming.enabled`, `streaming.minChars`, `streaming.minIntervalMs` |
356
+ | Pending Reply persistence | `delivery.pendingReply.persist`, `delivery.pendingReply.storeFile` |
357
+ | Reasoning visibility | `delivery.reasoning.mode`, `delivery.reasoning.title`, `delivery.reasoning.maxChars` |
358
+ | Final reply format | `delivery.replyFormat` (`auto / text / markdown`) |
319
359
  | Observability | `observability.enabled`, `observability.logPayloadMeta` |
320
360
 
321
361
  ### OpenClaw bindings for account-level routing
322
362
 
363
+ Package metadata, plugin manifest, and runtime channel meta now expose the same quickstart modes so the installer, quickstart, doctor, and future integrations can consume the same starter config and setup checklist.
364
+
365
+ Fastest entry:
366
+
367
+ ```bash
368
+ npx -y @dingxiang-me/openclaw-wecom-cli install
369
+ ```
370
+
371
+ If you prefer the repo-local scripts, you can still generate a starter config immediately:
372
+
373
+ ```bash
374
+ npm run wecom:quickstart -- --mode bot_long_connection
375
+ ```
376
+
377
+ If you prefer an interactive wizard:
378
+
379
+ ```bash
380
+ npm run wecom:quickstart -- --wizard
381
+ ```
382
+
383
+ Common examples:
384
+
385
+ ```bash
386
+ # Recommended default mode
387
+ npm run wecom:quickstart -- --json
388
+
389
+ # Walk through mode / dm / group-policy choices interactively
390
+ npm run wecom:quickstart -- --wizard
391
+
392
+ # Run the recommended selfchecks for the selected mode
393
+ npm run wecom:quickstart -- --run-checks
394
+
395
+ # Force those checks even if starter placeholders are still present
396
+ npm run wecom:quickstart -- --run-checks --force-checks
397
+
398
+ # Write a ready-to-apply config patch and .env template to disk
399
+ npm run wecom:quickstart -- --run-checks --repair-dir ./.wecom-repair
400
+
401
+ # Merge the generated repair configPatch directly into the target openclaw.json
402
+ npm run wecom:quickstart -- --run-checks --apply-repair
403
+
404
+ # Preview the fields that would change, then confirm before applying the repair patch
405
+ npm run wecom:quickstart -- --run-checks --confirm-repair
406
+
407
+ # Inspect legacy / mixed-layout config and generate a migration patch
408
+ npm run wecom:migrate -- --json
409
+
410
+ # Aggregate migration, selfchecks, E2E checks, long-connection probe, and callback matrix
411
+ npm run wecom:doctor -- --json
412
+
413
+ # Run the local black-box onboarding flow: install -> doctor -> fix -> rerun
414
+ npm run test:e2e:local
415
+
416
+ # Verify version sync and npm pack outputs for both packages
417
+ npm run test:release
418
+
419
+ # Scaffold an account-scoped Agent callback setup
420
+ npm run wecom:quickstart -- --mode agent_callback --account sales --dm-mode allowlist
421
+
422
+ # Add a ready-to-edit group allowlist template
423
+ npm run wecom:quickstart -- --mode hybrid --group-profile allowlist_template --group-chat-id wr-ops-room --group-allow ops_lead,oncall_user
424
+
425
+ # Merge into openclaw.json and create a backup first
426
+ npm run wecom:quickstart -- --mode hybrid --write
427
+ ```
428
+
429
+ Supported `--group-profile` values: `inherit`, `mention_only`, `open_direct`, `allowlist_template`, `deny`.
430
+ `--wizard` treats any CLI flags you already passed as defaults, then walks through the remaining choices and write confirmation.
431
+ `--run-checks` executes the recommended post-setup selfchecks for the selected mode; if placeholders are still present, execution is blocked unless you explicitly pass `--force-checks`.
432
+ `--apply-repair` merges `postcheck.repairArtifacts.configPatch` directly into the `--config` file and creates a backup first.
433
+ `--confirm-repair` prints the exact fields that would change, then asks before performing `--apply-repair`; the prompt stays on `stderr` so `--json` output remains machine-readable.
434
+ `npm run wecom:migrate -- --json` skips starter generation and audits only the current install / migration state, which is useful for `legacy_config / mixed_layout / stale_package`.
435
+ `npm run wecom:migrate -- --json` and `npm run wecom:doctor -- --json` now also report `migrationSource`, so you can tell whether the current layout looks closer to `official-wecom`, `sunnoy-wecom`, `legacy-openclaw-wechat`, or `mixed-source`.
436
+ `npm run wecom:doctor -- --json` aggregates `migration + selfcheck + agent/bot e2e + longconn probe + callback matrix` into one report; add `--skip-network` if you want to inspect local install / migration issues first.
437
+ `npm run wecom:doctor -- --fix --skip-network --json` applies the current local fix patch first, then reruns doctor on the merged config.
438
+ `npm run wecom:doctor -- --confirm-fix --skip-network --json` previews the exact fields first, then asks before writing the patch.
439
+ `npm run wecom:quickstart -- --json` now also returns `sourcePlaybook`, so the quickstart report itself can expose source-specific check order, placeholder guidance, and default repair behavior.
440
+ `npx -y @dingxiang-me/openclaw-wecom-cli install` first tries `openclaw plugins install @dingxiang-me/openclaw-wechat`, then writes starter config and can continue with a local doctor pass.
441
+ `npm run test:e2e:local` black-boxes the local `install -> doctor -> fix -> rerun` flow without relying on a live WeCom network.
442
+ `npm run test:release` verifies root package, installer CLI, manifest, runtime version constants, and `npm pack --dry-run` outputs before a release.
443
+ If the current layout looks closer to the official plugin, sunnoy, or legacy OpenClaw-Wechat, the `--json` report now includes `migration.guide`, source-specific notes, legacy field paths, and a rollback command.
444
+ Use `--confirm-doctor-fix` if you want the installer to ask before appending `doctor --fix`; use `--no-doctor-fix` to suppress it entirely, or `--yes` to auto-confirm prompts.
445
+ The installer `--json` report now also includes structured `actions`, so a CLI/UI layer can consume source review, migration, rollback, and rerun-doctor steps directly.
446
+ If you do not pass `--mode`, the installer can now auto-pick `bot_long_connection / agent_callback / hybrid` from the detected source plus current capabilities, and explains that decision in `sourceProfile`.
447
+ The repo now also ships two CI gates: `Onboarding E2E` for the local install loop, and `Release Check` for version/pack consistency; tag releases run a dedicated workflow that publishes both the plugin package and installer CLI in sequence.
448
+ `sourceProfile` now also exposes source-specific `checkOrder` and `repairDefaults`. Official / legacy sources still default to auto-appending `doctor --fix`, while sunnoy / mixed-source defaults stay advisory until you confirm repair explicitly.
449
+
450
+ The `--json` report now also includes:
451
+
452
+ - `placeholders`: starter-template values you still need to replace
453
+ - `setupChecklist`: the next admin/selfcheck steps to run
454
+ - `actions`: structured setup actions that CLI / UI can consume directly
455
+ - `installState / migrationState`: whether the current layout is fresh, legacy_config, stale_package, mixed_layout, or ready
456
+ - `migrationSource / migrationSourceSummary`: whether the current layout looks closer to the official plugin, sunnoy compatibility layout, legacy-openclaw-wechat, or a mixed-source config
457
+ - `fix`: whether doctor `--fix` prompted, confirmed, and wrote a local patch, plus the real `changedPaths`
458
+ - `sourcePlaybook`: the quickstart-side source-specific check order, placeholder guidance, and repair defaults
459
+ - `sourceProfile.checkOrder / sourceProfile.repairDefaults`: the source-specific validation order plus the installer's default repair strategy
460
+ - `warnings`: mode/profile-specific caveats that still need confirmation
461
+ - `postcheck`: recommended selfcheck execution status, blockage reason, or summary
462
+ - `postcheck.remediation`: actionable fix hints derived from failed checks
463
+ - `postcheck.repairArtifacts`: a minimal `configPatch` plus `.env` template you can apply directly to fix the detected setup gaps
464
+ - `postcheck.repairPlan`: itemized repair changes, env updates, and file writes
465
+ - `migration.configPatch / migration.envTemplate`: suggested normalized layout for the current legacy config
466
+
467
+ If you also pass `--repair-dir <path>`, quickstart will materialize those artifacts as:
468
+
469
+ - `wecom.config-patch.json`
470
+ - `wecom.account-patch.json`
471
+ - `wecom.env.template`
472
+ - `README.txt`
473
+
474
+ If you pass `--apply-repair`, the report will also include `repairApply` so you can see whether the repair patch was actually merged into the target config.
475
+ If you pass `--confirm-repair`, `repairApply` also includes `prompted/confirmed` so you can tell whether the patch was declined or auto-applied; actual writes are listed in `repairApply.changedPaths`.
476
+
323
477
  Use OpenClaw core `bindings` for stable account-to-agent routing. The plugin exposes `channel=wecom` and `accountId=<id>` to the core router.
324
478
 
325
479
  ```json
@@ -433,7 +587,7 @@ Outbound target formats:
433
587
  |---|---|
434
588
  | `WECOM_ALLOW_FROM*` | sender authorization |
435
589
  | `WECOM_COMMANDS_*` | command ACL |
436
- | `WECOM_DM_*`, `WECOM_<ACCOUNT>_DM_*` | DM policy + allowlist |
590
+ | `WECOM_DM_*`, `WECOM_<ACCOUNT>_DM_*` | DM policy + allowlist / pairing controls |
437
591
  | `WECOM_EVENTS_*`, `WECOM_<ACCOUNT>_EVENTS_*` | event handling + enter_agent welcome text |
438
592
  | `WECOM_GROUP_CHAT_*` | group trigger policy |
439
593
  | `WECOM_DEBOUNCE_*` | text debounce |
@@ -794,6 +948,24 @@ Set:
794
948
  }
795
949
  ```
796
950
 
951
+ If you also need to limit which members can trigger the bot in a group, add a group member ACL:
952
+
953
+ ```json
954
+ {
955
+ "channels": {
956
+ "wecom": {
957
+ "groupAllowFrom": ["alice", "bob"],
958
+ "groups": {
959
+ "wr9N1x...": {
960
+ "allowFrom": ["ops_lead"],
961
+ "rejectMessage": "Only the on-duty team can trigger this bot in the group."
962
+ }
963
+ }
964
+ }
965
+ }
966
+ }
967
+ ```
968
+
797
969
  And verify WeCom-side prerequisites:
798
970
  1. App callback is enabled and URL verification succeeded.
799
971
  2. App visibility includes group members.