@dingxiang-me/openclaw-wechat 1.4.1 → 1.7.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/README.en.md +89 -12
  3. package/README.md +103 -15
  4. package/docs/channels/wecom.md +28 -3
  5. package/openclaw.plugin.json +467 -10
  6. package/package.json +13 -2
  7. package/src/core/agent-routing.js +6 -0
  8. package/src/core.js +564 -35
  9. package/src/wecom/account-config-core.js +28 -8
  10. package/src/wecom/account-config.js +55 -0
  11. package/src/wecom/account-diagnostics.js +121 -0
  12. package/src/wecom/account-paths.js +39 -0
  13. package/src/wecom/agent-inbound-dispatch.js +9 -0
  14. package/src/wecom/agent-inbound-guards.js +24 -4
  15. package/src/wecom/agent-inbound-processor.js +27 -0
  16. package/src/wecom/agent-webhook-handler.js +11 -0
  17. package/src/wecom/bot-context.js +2 -1
  18. package/src/wecom/bot-dispatch-fallback.js +2 -1
  19. package/src/wecom/bot-inbound-content.js +73 -3
  20. package/src/wecom/bot-inbound-dispatch-runtime.js +2 -1
  21. package/src/wecom/bot-inbound-executor-helpers.js +56 -5
  22. package/src/wecom/bot-inbound-executor.js +19 -0
  23. package/src/wecom/bot-inbound-guards.js +36 -4
  24. package/src/wecom/bot-runtime-context.js +5 -3
  25. package/src/wecom/bot-webhook-dispatch.js +45 -12
  26. package/src/wecom/bot-webhook-handler.js +45 -13
  27. package/src/wecom/command-handlers.js +26 -0
  28. package/src/wecom/command-status-text.js +76 -7
  29. package/src/wecom/observability-metrics.js +133 -0
  30. package/src/wecom/outbound-agent-push.js +2 -1
  31. package/src/wecom/outbound-bot-card.js +103 -0
  32. package/src/wecom/outbound-delivery.js +92 -7
  33. package/src/wecom/outbound-response-delivery.js +10 -6
  34. package/src/wecom/outbound-webhook-delivery.js +42 -1
  35. package/src/wecom/plugin-account-policy-services.js +19 -0
  36. package/src/wecom/plugin-base-services.js +13 -0
  37. package/src/wecom/plugin-constants.js +1 -1
  38. package/src/wecom/plugin-delivery-inbound-services.js +8 -0
  39. package/src/wecom/plugin-processing-deps.js +4 -0
  40. package/src/wecom/plugin-route-runtime-deps.js +5 -0
  41. package/src/wecom/plugin-services.js +7 -0
  42. package/src/wecom/policy-resolvers.js +82 -5
  43. package/src/wecom/register-runtime.js +31 -2
  44. package/src/wecom/route-registration.js +173 -41
  45. package/src/wecom/runtime-utils.js +7 -2
  46. package/src/wecom/webhook-adapter.js +61 -0
  47. package/src/wecom/webhook-bot.js +26 -0
@@ -16,11 +16,15 @@ This channel integrates OpenClaw with WeCom (企业微信) internal apps.
16
16
  - Multi-account: supported (`channels.wecom.accounts`)
17
17
  - Voice recognition: WeCom `Recognition` first; local whisper fallback supported (`channels.wecom.voiceTranscription`)
18
18
  - Delivery fallback chain: optional (`active_stream -> response_url -> webhook_bot -> agent_push`)
19
- - Group trigger mode: `direct` / `mention` / `keyword` (`channels.wecom.groupChat.triggerMode`)
19
+ - Bot card replies: supported (`channels.wecom.bot.card`, `markdown/template_card`)
20
+ - Direct-message policy: supported (`channels.wecom.dm.mode=open|allowlist|deny`, account-level override via `accounts.<id>.dm`)
21
+ - Event handling: supported (`channels.wecom.events.*`, supports `enter_agent` welcome reply)
22
+ - Group trigger mode: Agent callback supports `direct` / `mention` / `keyword`; Bot mode is effectively `mention` (WeCom platform callback constraint)
20
23
  - Dynamic agent route mode: `deterministic` / `mapping` / `hybrid` (`channels.wecom.dynamicAgent.mode`)
21
24
  - Dynamic workspace seeding: supported via `channels.wecom.dynamicAgent.workspaceTemplate`
22
25
  - Session queue / stream manager: optional (`channels.wecom.stream.manager`)
23
26
  - Bot timeout tuning: supported (`channels.wecom.bot.replyTimeoutMs`, `lateReplyWatchMs`, `lateReplyPollMs`)
27
+ - Observability counters: supported (`channels.wecom.observability.*`, visible in `/status`)
24
28
 
25
29
  ## Callback URL
26
30
 
@@ -36,7 +40,7 @@ Named webhook targets (optional):
36
40
 
37
41
  WeCom has two different integration shapes:
38
42
 
39
- 1. **Webhook Bot**: can be added directly to regular group chats.
43
+ 1. **Webhook Bot**: can be added directly to regular group chats, but callbacks are typically triggered only when the bot is mentioned (`@机器人`).
40
44
  2. **Self-built App callback**: plugin supports group processing when callback payload contains `ChatId`.
41
45
 
42
46
  To enable direct group trigger (`triggerMode=direct`) for self-built app callback, ensure:
@@ -49,6 +53,8 @@ To enable direct group trigger (`triggerMode=direct`) for self-built app callbac
49
53
  If logs never show `chatId`, WeCom is not delivering group messages to this callback route.
50
54
  In that case, use **Webhook Bot mode** for regular group chat scenarios.
51
55
 
56
+ Note: In Bot mode, `groupChat.triggerMode=direct/keyword` is normalized to `mention` by the plugin to avoid misleading config.
57
+
52
58
  ## Selfcheck
53
59
 
54
60
  Run:
@@ -133,16 +139,35 @@ All new switches are default-off for compatibility.
133
139
  "maxConcurrentPerSession": 1
134
140
  }
135
141
  },
142
+ "bot": {
143
+ "card": {
144
+ "enabled": false,
145
+ "mode": "markdown",
146
+ "title": "OpenClaw-Wechat",
147
+ "responseUrlEnabled": true,
148
+ "webhookBotEnabled": true
149
+ }
150
+ },
136
151
  "observability": {
137
152
  "enabled": true,
138
153
  "logPayloadMeta": true
154
+ },
155
+ "dm": {
156
+ "mode": "allowlist",
157
+ "allowFrom": ["alice", "wecom:bob"],
158
+ "rejectMessage": "当前账号未授权,请联系管理员。"
159
+ },
160
+ "events": {
161
+ "enabled": true,
162
+ "enterAgentWelcomeEnabled": true,
163
+ "enterAgentWelcomeText": "你好,我是 AI 助手,直接发消息即可开始对话。"
139
164
  }
140
165
  }
141
166
  }
142
167
  }
143
168
  ```
144
169
 
145
- ## P2 Routing Config (Recommended)
170
+ ## P2 Routing Config (Recommended, Agent callback)
146
171
 
147
172
  ```json
148
173
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-wechat",
3
3
  "name": "OpenClaw-Wechat",
4
- "version": "1.4.1",
4
+ "version": "1.7.2",
5
5
  "description": "WeCom (企业微信) channel plugin for OpenClaw (自建应用回调 + 发送 API).",
6
6
  "channels": [
7
7
  "wecom"
@@ -12,7 +12,17 @@
12
12
  "configSchema": {
13
13
  "type": "object",
14
14
  "additionalProperties": false,
15
+ "patternProperties": {
16
+ "^(?!(name|enabled|corpId|corpSecret|agentId|callbackToken|token|callbackAesKey|encodingAesKey|webhookPath|agent|bot|delivery|webhookBot|stream|observability|outboundProxy|webhooks|allowFrom|allowFromRejectMessage|adminUsers|commandAllowlist|commandBlockMessage|commands|workspaceTemplate|groupChat|dynamicAgent|dynamicAgents|dm|debounce|streaming|voiceTranscription|accounts)$)[A-Za-z0-9_-]+$": {
17
+ "type": "object",
18
+ "description": "兼容旧配置:inline 多账户(推荐迁移到 channels.wecom.accounts.<id>)"
19
+ }
20
+ },
15
21
  "properties": {
22
+ "name": {
23
+ "type": "string",
24
+ "description": "兼容旧配置:渠道显示名(运行时可忽略)"
25
+ },
16
26
  "enabled": {
17
27
  "type": "boolean",
18
28
  "default": true,
@@ -50,7 +60,7 @@
50
60
  "token": {
51
61
  "type": "string",
52
62
  "minLength": 1,
53
- "description": "兼容旧配置:等价 callbackToken(不推荐新配置继续使用)",
63
+ "description": "兼容字段:默认等价 callbackToken;当使用 legacy agent 配置块时可作为 Bot token 使用",
54
64
  "x-sensitive": true
55
65
  },
56
66
  "callbackAesKey": {
@@ -62,7 +72,7 @@
62
72
  "encodingAesKey": {
63
73
  "type": "string",
64
74
  "minLength": 1,
65
- "description": "兼容旧配置:等价 callbackAesKey(不推荐新配置继续使用)",
75
+ "description": "兼容字段:默认等价 callbackAesKey;当使用 legacy agent 配置块时可作为 Bot encodingAesKey 使用",
66
76
  "x-sensitive": true
67
77
  },
68
78
  "webhookPath": {
@@ -70,6 +80,56 @@
70
80
  "description": "Webhook 路径",
71
81
  "default": "/wecom/callback"
72
82
  },
83
+ "agent": {
84
+ "type": "object",
85
+ "description": "兼容旧配置:自建应用凭证块(与顶层 corpId/corpSecret/agentId 等价)",
86
+ "additionalProperties": false,
87
+ "properties": {
88
+ "corpId": {
89
+ "type": "string",
90
+ "minLength": 1
91
+ },
92
+ "corpSecret": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "x-sensitive": true
96
+ },
97
+ "agentId": {
98
+ "oneOf": [
99
+ {
100
+ "type": "number"
101
+ },
102
+ {
103
+ "type": "string",
104
+ "pattern": "^[0-9]+$"
105
+ }
106
+ ]
107
+ },
108
+ "callbackToken": {
109
+ "type": "string",
110
+ "minLength": 1,
111
+ "x-sensitive": true
112
+ },
113
+ "token": {
114
+ "type": "string",
115
+ "minLength": 1,
116
+ "x-sensitive": true
117
+ },
118
+ "callbackAesKey": {
119
+ "type": "string",
120
+ "minLength": 1,
121
+ "x-sensitive": true
122
+ },
123
+ "encodingAesKey": {
124
+ "type": "string",
125
+ "minLength": 1,
126
+ "x-sensitive": true
127
+ },
128
+ "webhookPath": {
129
+ "type": "string"
130
+ }
131
+ }
132
+ },
73
133
  "bot": {
74
134
  "type": "object",
75
135
  "description": "企业微信 AI 机器人(Bot API 模式)配置(JSON 回调 + 原生 stream)",
@@ -126,6 +186,56 @@
126
186
  "maximum": 10000,
127
187
  "default": 2000,
128
188
  "description": "Bot 异步补发轮询间隔(毫秒)"
189
+ },
190
+ "card": {
191
+ "type": "object",
192
+ "description": "Bot 卡片回包策略(response_url / webhook_bot)",
193
+ "additionalProperties": false,
194
+ "properties": {
195
+ "enabled": {
196
+ "type": "boolean",
197
+ "default": false,
198
+ "description": "是否启用 Bot 卡片回包(默认关闭,保持兼容)"
199
+ },
200
+ "mode": {
201
+ "type": "string",
202
+ "enum": [
203
+ "markdown",
204
+ "template_card"
205
+ ],
206
+ "default": "markdown",
207
+ "description": "卡片模式:markdown(兼容优先)/ template_card(模板卡片)"
208
+ },
209
+ "title": {
210
+ "type": "string",
211
+ "description": "卡片标题"
212
+ },
213
+ "subtitle": {
214
+ "type": "string",
215
+ "description": "卡片副标题"
216
+ },
217
+ "footer": {
218
+ "type": "string",
219
+ "description": "卡片底部说明"
220
+ },
221
+ "maxContentLength": {
222
+ "type": "integer",
223
+ "minimum": 200,
224
+ "maximum": 4000,
225
+ "default": 1400,
226
+ "description": "卡片正文最大长度(超出自动截断)"
227
+ },
228
+ "responseUrlEnabled": {
229
+ "type": "boolean",
230
+ "default": true,
231
+ "description": "是否在 response_url 层启用卡片发送"
232
+ },
233
+ "webhookBotEnabled": {
234
+ "type": "boolean",
235
+ "default": true,
236
+ "description": "是否在 webhook_bot 层启用卡片发送"
237
+ }
238
+ }
129
239
  }
130
240
  }
131
241
  },
@@ -275,6 +385,18 @@
275
385
  "minLength": 1
276
386
  }
277
387
  },
388
+ "commandAllowlist": {
389
+ "type": "array",
390
+ "description": "兼容旧配置:命令白名单(等价 commands.allowlist)",
391
+ "items": {
392
+ "type": "string",
393
+ "minLength": 1
394
+ }
395
+ },
396
+ "commandBlockMessage": {
397
+ "type": "string",
398
+ "description": "兼容旧配置:命令拦截提示(等价 commands.rejectMessage)"
399
+ },
278
400
  "commands": {
279
401
  "type": "object",
280
402
  "description": "指令白名单控制(启用后仅允许 allowlist 内的 / 指令)",
@@ -296,9 +418,17 @@
296
418
  "rejectMessage": {
297
419
  "type": "string",
298
420
  "description": "命中未授权指令时返回给用户的提示文本"
421
+ },
422
+ "blockMessage": {
423
+ "type": "string",
424
+ "description": "兼容旧配置:等价 rejectMessage"
299
425
  }
300
426
  }
301
427
  },
428
+ "workspaceTemplate": {
429
+ "type": "string",
430
+ "description": "兼容旧配置:动态 Agent workspace 模板目录(等价 dynamicAgent.workspaceTemplate)"
431
+ },
302
432
  "groupChat": {
303
433
  "type": "object",
304
434
  "description": "群聊触发策略",
@@ -443,6 +573,76 @@
443
573
  "type": "boolean",
444
574
  "default": true,
445
575
  "description": "未命中动态映射时是否回退到 OpenClaw 默认路由"
576
+ },
577
+ "dmCreateAgentOnFirstMessage": {
578
+ "type": "boolean",
579
+ "default": true,
580
+ "description": "私聊是否启用动态 Agent(兼容 dm.createAgentOnFirstMessage)"
581
+ },
582
+ "groupEnabled": {
583
+ "type": "boolean",
584
+ "default": true,
585
+ "description": "群聊是否启用动态 Agent 路由(消息触发仍受 groupChat 配置控制)"
586
+ }
587
+ }
588
+ },
589
+ "dynamicAgents": {
590
+ "type": "object",
591
+ "description": "兼容旧配置:等价 dynamicAgent(旧项目常用命名)",
592
+ "additionalProperties": true
593
+ },
594
+ "dm": {
595
+ "type": "object",
596
+ "description": "私聊策略与兼容配置",
597
+ "additionalProperties": false,
598
+ "properties": {
599
+ "mode": {
600
+ "type": "string",
601
+ "enum": [
602
+ "open",
603
+ "allowlist",
604
+ "deny"
605
+ ],
606
+ "default": "open",
607
+ "description": "私聊策略:open=开放,allowlist=白名单,deny=关闭"
608
+ },
609
+ "rejectMessage": {
610
+ "type": "string",
611
+ "description": "私聊被拒绝时的提示文案"
612
+ },
613
+ "createAgentOnFirstMessage": {
614
+ "type": "boolean",
615
+ "default": true,
616
+ "description": "是否为私聊在首条消息时创建动态 Agent(等价 dynamicAgent.dmCreateAgentOnFirstMessage)"
617
+ },
618
+ "allowFrom": {
619
+ "type": "array",
620
+ "description": "私聊白名单(mode=allowlist 时生效)",
621
+ "items": {
622
+ "type": "string",
623
+ "minLength": 1
624
+ }
625
+ }
626
+ }
627
+ },
628
+ "events": {
629
+ "type": "object",
630
+ "description": "事件消息策略(如 enter_agent 欢迎语)",
631
+ "additionalProperties": false,
632
+ "properties": {
633
+ "enabled": {
634
+ "type": "boolean",
635
+ "default": true,
636
+ "description": "是否处理事件消息(MsgType=event)"
637
+ },
638
+ "enterAgentWelcomeEnabled": {
639
+ "type": "boolean",
640
+ "default": false,
641
+ "description": "是否在 enter_agent 事件时自动回复欢迎语"
642
+ },
643
+ "enterAgentWelcomeText": {
644
+ "type": "string",
645
+ "description": "enter_agent 自动欢迎语文本"
446
646
  }
447
647
  }
448
648
  },
@@ -592,6 +792,10 @@
592
792
  "type": "boolean",
593
793
  "default": true
594
794
  },
795
+ "name": {
796
+ "type": "string",
797
+ "description": "兼容旧配置:账户显示名"
798
+ },
595
799
  "corpId": {
596
800
  "type": "string",
597
801
  "minLength": 1
@@ -636,7 +840,188 @@
636
840
  },
637
841
  "webhookPath": {
638
842
  "type": "string",
639
- "default": "/wecom/callback"
843
+ "default": "/wecom/callback",
844
+ "description": "Agent 回调路径;非 default 账户未填写时自动使用 /wecom/<accountId>/callback"
845
+ },
846
+ "agent": {
847
+ "type": "object",
848
+ "description": "兼容旧配置:该账户自建应用凭证块(与账户顶层 corpId/corpSecret/agentId 等价)",
849
+ "additionalProperties": false,
850
+ "properties": {
851
+ "corpId": {
852
+ "type": "string",
853
+ "minLength": 1
854
+ },
855
+ "corpSecret": {
856
+ "type": "string",
857
+ "minLength": 1,
858
+ "x-sensitive": true
859
+ },
860
+ "agentId": {
861
+ "oneOf": [
862
+ {
863
+ "type": "number"
864
+ },
865
+ {
866
+ "type": "string",
867
+ "pattern": "^[0-9]+$"
868
+ }
869
+ ]
870
+ },
871
+ "callbackToken": {
872
+ "type": "string",
873
+ "minLength": 1,
874
+ "x-sensitive": true
875
+ },
876
+ "token": {
877
+ "type": "string",
878
+ "minLength": 1,
879
+ "x-sensitive": true
880
+ },
881
+ "callbackAesKey": {
882
+ "type": "string",
883
+ "minLength": 1,
884
+ "x-sensitive": true
885
+ },
886
+ "encodingAesKey": {
887
+ "type": "string",
888
+ "minLength": 1,
889
+ "x-sensitive": true
890
+ },
891
+ "webhookPath": {
892
+ "type": "string"
893
+ }
894
+ }
895
+ },
896
+ "bot": {
897
+ "type": "object",
898
+ "description": "该账户专用 Bot 模式配置(覆盖 channels.wecom.bot)",
899
+ "additionalProperties": false,
900
+ "properties": {
901
+ "enabled": {
902
+ "type": "boolean",
903
+ "default": false,
904
+ "description": "是否启用该账户 Bot 模式"
905
+ },
906
+ "token": {
907
+ "type": "string",
908
+ "description": "Bot 模式回调 Token"
909
+ },
910
+ "callbackToken": {
911
+ "type": "string",
912
+ "description": "兼容旧配置:等价 token"
913
+ },
914
+ "encodingAesKey": {
915
+ "type": "string",
916
+ "description": "Bot 模式回调 EncodingAESKey(43 位)",
917
+ "x-sensitive": true
918
+ },
919
+ "callbackAesKey": {
920
+ "type": "string",
921
+ "description": "兼容旧配置:等价 encodingAesKey",
922
+ "x-sensitive": true
923
+ },
924
+ "webhookPath": {
925
+ "type": "string",
926
+ "default": "/wecom/bot/callback",
927
+ "description": "Bot 模式 webhook 路径;非 default 账户未填写时自动使用 /wecom/<accountId>/bot/callback"
928
+ },
929
+ "placeholderText": {
930
+ "type": "string",
931
+ "default": "消息已收到,正在处理中,请稍等片刻。",
932
+ "description": "Bot 模式初始 stream 占位文本"
933
+ },
934
+ "streamExpireMs": {
935
+ "type": "integer",
936
+ "minimum": 30000,
937
+ "maximum": 3600000,
938
+ "default": 600000,
939
+ "description": "Bot 流式会话保留时长(毫秒)"
940
+ },
941
+ "replyTimeoutMs": {
942
+ "type": "integer",
943
+ "minimum": 15000,
944
+ "maximum": 600000,
945
+ "default": 90000,
946
+ "description": "Bot 模式等待模型回包超时(毫秒)"
947
+ },
948
+ "lateReplyWatchMs": {
949
+ "type": "integer",
950
+ "minimum": 30000,
951
+ "maximum": 600000,
952
+ "default": 180000,
953
+ "description": "Bot 超时后异步补发观察窗口(毫秒)"
954
+ },
955
+ "lateReplyPollMs": {
956
+ "type": "integer",
957
+ "minimum": 500,
958
+ "maximum": 10000,
959
+ "default": 2000,
960
+ "description": "Bot 异步补发轮询间隔(毫秒)"
961
+ },
962
+ "card": {
963
+ "type": "object",
964
+ "description": "该账户 Bot 卡片回包策略(覆盖 channels.wecom.bot.card)",
965
+ "additionalProperties": false,
966
+ "properties": {
967
+ "enabled": {
968
+ "type": "boolean",
969
+ "default": false,
970
+ "description": "是否启用该账户 Bot 卡片回包"
971
+ },
972
+ "mode": {
973
+ "type": "string",
974
+ "enum": [
975
+ "markdown",
976
+ "template_card"
977
+ ],
978
+ "default": "markdown",
979
+ "description": "卡片模式:markdown / template_card"
980
+ },
981
+ "title": {
982
+ "type": "string",
983
+ "description": "卡片标题"
984
+ },
985
+ "subtitle": {
986
+ "type": "string",
987
+ "description": "卡片副标题"
988
+ },
989
+ "footer": {
990
+ "type": "string",
991
+ "description": "卡片底部说明"
992
+ },
993
+ "maxContentLength": {
994
+ "type": "integer",
995
+ "minimum": 200,
996
+ "maximum": 4000,
997
+ "default": 1400,
998
+ "description": "卡片正文最大长度(超出自动截断)"
999
+ },
1000
+ "responseUrlEnabled": {
1001
+ "type": "boolean",
1002
+ "default": true,
1003
+ "description": "是否在 response_url 层启用卡片发送"
1004
+ },
1005
+ "webhookBotEnabled": {
1006
+ "type": "boolean",
1007
+ "default": true,
1008
+ "description": "是否在 webhook_bot 层启用卡片发送"
1009
+ }
1010
+ }
1011
+ },
1012
+ "outboundProxy": {
1013
+ "type": "string",
1014
+ "description": "可选:该账户 Bot 回调媒体下载/回包专用代理(覆盖 channels.wecom.bot/outboundProxy)"
1015
+ },
1016
+ "proxyUrl": {
1017
+ "type": "string",
1018
+ "description": "兼容字段:等价 outboundProxy"
1019
+ },
1020
+ "proxy": {
1021
+ "type": "string",
1022
+ "description": "兼容字段:等价 outboundProxy"
1023
+ }
1024
+ }
640
1025
  },
641
1026
  "outboundProxy": {
642
1027
  "type": "string",
@@ -661,13 +1046,58 @@
661
1046
  "allowFromRejectMessage": {
662
1047
  "type": "string",
663
1048
  "description": "可选:该账户发送者未授权时的拒绝文案(覆盖 channels.wecom.allowFromRejectMessage)"
1049
+ },
1050
+ "dm": {
1051
+ "type": "object",
1052
+ "description": "可选:该账户私聊策略(覆盖 channels.wecom.dm)",
1053
+ "additionalProperties": false,
1054
+ "properties": {
1055
+ "mode": {
1056
+ "type": "string",
1057
+ "enum": [
1058
+ "open",
1059
+ "allowlist",
1060
+ "deny"
1061
+ ],
1062
+ "default": "open",
1063
+ "description": "私聊策略:open=开放,allowlist=白名单,deny=关闭"
1064
+ },
1065
+ "allowFrom": {
1066
+ "type": "array",
1067
+ "description": "私聊白名单(mode=allowlist 时生效)",
1068
+ "items": {
1069
+ "type": "string",
1070
+ "minLength": 1
1071
+ }
1072
+ },
1073
+ "rejectMessage": {
1074
+ "type": "string",
1075
+ "description": "私聊被拒绝时的提示文案"
1076
+ }
1077
+ }
1078
+ },
1079
+ "events": {
1080
+ "type": "object",
1081
+ "description": "可选:该账户事件策略(覆盖 channels.wecom.events)",
1082
+ "additionalProperties": false,
1083
+ "properties": {
1084
+ "enabled": {
1085
+ "type": "boolean",
1086
+ "default": true,
1087
+ "description": "是否处理该账户事件消息(MsgType=event)"
1088
+ },
1089
+ "enterAgentWelcomeEnabled": {
1090
+ "type": "boolean",
1091
+ "default": false,
1092
+ "description": "是否在 enter_agent 事件自动回复欢迎语"
1093
+ },
1094
+ "enterAgentWelcomeText": {
1095
+ "type": "string",
1096
+ "description": "该账户 enter_agent 自动欢迎语文本"
1097
+ }
1098
+ }
664
1099
  }
665
- },
666
- "required": [
667
- "corpId",
668
- "corpSecret",
669
- "agentId"
670
- ]
1100
+ }
671
1101
  }
672
1102
  }
673
1103
  }
@@ -688,12 +1118,39 @@
688
1118
  "encodingAesKey": {
689
1119
  "sensitive": true
690
1120
  },
1121
+ "agent.corpSecret": {
1122
+ "sensitive": true
1123
+ },
1124
+ "agent.callbackToken": {
1125
+ "sensitive": true
1126
+ },
1127
+ "agent.token": {
1128
+ "sensitive": true
1129
+ },
1130
+ "agent.callbackAesKey": {
1131
+ "sensitive": true
1132
+ },
1133
+ "agent.encodingAesKey": {
1134
+ "sensitive": true
1135
+ },
691
1136
  "bot.token": {
692
1137
  "sensitive": true
693
1138
  },
694
1139
  "bot.encodingAesKey": {
695
1140
  "sensitive": true
696
1141
  },
1142
+ "accounts.*.bot.token": {
1143
+ "sensitive": true
1144
+ },
1145
+ "accounts.*.bot.callbackToken": {
1146
+ "sensitive": true
1147
+ },
1148
+ "accounts.*.bot.encodingAesKey": {
1149
+ "sensitive": true
1150
+ },
1151
+ "accounts.*.bot.callbackAesKey": {
1152
+ "sensitive": true
1153
+ },
697
1154
  "webhookBot.key": {
698
1155
  "sensitive": true
699
1156
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dingxiang-me/openclaw-wechat",
3
- "version": "1.4.1",
3
+ "version": "1.7.2",
4
4
  "type": "module",
5
5
  "description": "WeCom (企业微信) channel plugin for OpenClaw (自建应用回调 + 发送 API).",
6
6
  "license": "MIT",
@@ -33,17 +33,28 @@
33
33
  "qiwei",
34
34
  "wxwork"
35
35
  ]
36
+ },
37
+ "install": {
38
+ "defaultChoice": "npm",
39
+ "npmSpec": "@dingxiang-me/openclaw-wechat"
36
40
  }
37
41
  },
38
42
  "scripts": {
39
43
  "lint": "npm run test:syntax",
40
- "test:syntax": "find src -name '*.js' -print0 | xargs -0 -n1 node -c",
44
+ "test:syntax": "find src scripts tests -type f \\( -name '*.js' -o -name '*.mjs' \\) -print0 | xargs -0 -n1 node -c",
41
45
  "test": "npm run test:syntax && node --test tests/*.test.mjs",
46
+ "test:e2e": "node --test tests/e2e/*.test.mjs",
42
47
  "test:e2e:remote": "node --test tests/e2e/*.test.mjs",
48
+ "test:e2e:matrix": "node --test tests/e2e/remote-wecom.matrix.test.mjs",
49
+ "test:e2e:prepare-browser": "bash ./tests/e2e/prepare-browser-sandbox.sh",
50
+ "test:e2e:collect-pdf": "bash ./tests/e2e/collect-browser-pdf.sh",
43
51
  "wecom:selfcheck": "node ./scripts/wecom-selfcheck.mjs",
44
52
  "wecom:agent:selfcheck": "node ./scripts/wecom-agent-selfcheck.mjs",
45
53
  "wecom:bot:selfcheck": "node ./scripts/wecom-bot-selfcheck.mjs",
46
54
  "wecom:remote:e2e": "node ./scripts/wecom-remote-e2e.mjs",
55
+ "wecom:e2e:scenario": "node ./scripts/wecom-e2e-scenario.mjs",
56
+ "wecom:e2e:full": "node ./scripts/wecom-e2e-scenario.mjs --scenario full-smoke --prepare-browser --collect-pdf",
57
+ "wecom:e2e:compat": "node ./scripts/wecom-e2e-scenario.mjs --scenario compat-smoke",
47
58
  "wecom:smoke": "bash ./scripts/wecom-smoke.sh"
48
59
  },
49
60
  "dependencies": {