@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-wechat",
3
3
  "name": "OpenClaw-Wechat",
4
- "version": "2.0.1",
4
+ "version": "2.3.0",
5
5
  "description": "WeCom (企业微信) channel plugin for OpenClaw (自建应用回调 + 发送 API).",
6
6
  "channels": [
7
7
  "wecom"
@@ -13,7 +13,7 @@
13
13
  "type": "object",
14
14
  "additionalProperties": false,
15
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|defaultAccount|tools|accounts)$)[A-Za-z0-9_-]+$": {
16
+ "^(?!(name|enabled|botId|botid|secret|corpId|corpSecret|agentId|callbackToken|token|callbackAesKey|encodingAesKey|webhookPath|agent|bot|delivery|webhookBot|stream|observability|outboundProxy|network|apiBaseUrl|webhooks|allowFrom|allowFromRejectMessage|groupPolicy|groupAllowFrom|groupAllowFromRejectMessage|adminUsers|commandAllowlist|commandBlockMessage|commands|workspaceTemplate|groupChat|groups|dynamicAgent|dynamicAgents|dm|debounce|streaming|voiceTranscription|defaultAccount|tools|accounts)$)[A-Za-z0-9_-]+$": {
17
17
  "type": "object",
18
18
  "description": "兼容旧配置:inline 多账户(推荐迁移到 channels.wecom.accounts.<id>)"
19
19
  }
@@ -290,7 +290,7 @@
290
290
  },
291
291
  "delivery": {
292
292
  "type": "object",
293
- "description": "Bot 模式回包兜底策略(按层降级)",
293
+ "description": "WeCom 可靠投递策略(回包兜底 + Pending Reply + 配额感知)",
294
294
  "additionalProperties": false,
295
295
  "properties": {
296
296
  "fallback": {
@@ -299,15 +299,16 @@
299
299
  "properties": {
300
300
  "enabled": {
301
301
  "type": "boolean",
302
- "default": false,
303
- "description": "是否启用多层回包兜底(默认关闭,保持兼容)"
302
+ "default": true,
303
+ "description": "是否启用多层回包兜底"
304
304
  },
305
305
  "order": {
306
306
  "type": "array",
307
- "description": "回包层级顺序(active_stream/response_url/webhook_bot/agent_push)",
307
+ "description": "回包层级顺序(long_connection/active_stream/response_url/webhook_bot/agent_push)",
308
308
  "items": {
309
309
  "type": "string",
310
310
  "enum": [
311
+ "long_connection",
311
312
  "active_stream",
312
313
  "response_url",
313
314
  "webhook_bot",
@@ -315,6 +316,7 @@
315
316
  ]
316
317
  },
317
318
  "default": [
319
+ "long_connection",
318
320
  "active_stream",
319
321
  "response_url",
320
322
  "webhook_bot",
@@ -322,9 +324,123 @@
322
324
  ]
323
325
  }
324
326
  }
327
+ },
328
+ "pendingReply": {
329
+ "type": "object",
330
+ "description": "最终回复投递失败后的待补发队列",
331
+ "additionalProperties": false,
332
+ "properties": {
333
+ "enabled": {
334
+ "type": "boolean",
335
+ "default": true,
336
+ "description": "是否启用 Pending Reply 自动补发"
337
+ },
338
+ "maxRetries": {
339
+ "type": "integer",
340
+ "minimum": 1,
341
+ "maximum": 10,
342
+ "default": 3,
343
+ "description": "单条待补发消息的最大重试次数"
344
+ },
345
+ "retryBackoffMs": {
346
+ "type": "integer",
347
+ "minimum": 1000,
348
+ "maximum": 600000,
349
+ "default": 15000,
350
+ "description": "待补发重试基准退避时间(毫秒)"
351
+ },
352
+ "expireMs": {
353
+ "type": "integer",
354
+ "minimum": 30000,
355
+ "maximum": 86400000,
356
+ "default": 600000,
357
+ "description": "待补发消息过期时间(毫秒)"
358
+ },
359
+ "persist": {
360
+ "type": "boolean",
361
+ "default": true,
362
+ "description": "是否在 gateway 重启后恢复 Pending Reply / delivery 状态"
363
+ },
364
+ "storeFile": {
365
+ "type": "string",
366
+ "description": "可选:可靠投递状态持久化文件路径(默认写入 OPENCLAW_STATE_DIR/wecom/reliable-delivery.json)"
367
+ }
368
+ }
369
+ },
370
+ "reasoning": {
371
+ "type": "object",
372
+ "description": "推理/思考内容展示策略",
373
+ "additionalProperties": false,
374
+ "properties": {
375
+ "mode": {
376
+ "type": "string",
377
+ "enum": [
378
+ "separate",
379
+ "append",
380
+ "hidden"
381
+ ],
382
+ "default": "separate",
383
+ "description": "推理内容展示方式:separate=单独显示,append=合并进最终回复,hidden=隐藏"
384
+ },
385
+ "sendThinkingMessage": {
386
+ "type": "boolean",
387
+ "default": true,
388
+ "description": "兼容字段:等价于 mode=separate / hidden"
389
+ },
390
+ "includeInFinalAnswer": {
391
+ "type": "boolean",
392
+ "default": false,
393
+ "description": "兼容字段:为 true 时等价于 mode=append"
394
+ },
395
+ "title": {
396
+ "type": "string",
397
+ "default": "思考过程",
398
+ "description": "append 模式下的推理标题"
399
+ },
400
+ "maxChars": {
401
+ "type": "integer",
402
+ "minimum": 64,
403
+ "maximum": 8000,
404
+ "default": 1200,
405
+ "description": "保留的最大推理字符数"
406
+ }
407
+ }
408
+ },
409
+ "replyFormat": {
410
+ "type": "string",
411
+ "enum": [
412
+ "auto",
413
+ "text",
414
+ "markdown"
415
+ ],
416
+ "default": "auto",
417
+ "description": "最终回复格式:auto=按链路自动选择,text=强制纯文本,markdown=优先使用 markdown 能力"
418
+ },
419
+ "quotaTracking": {
420
+ "type": "object",
421
+ "description": "主动发送额度与 24h 窗口感知",
422
+ "additionalProperties": false,
423
+ "properties": {
424
+ "enabled": {
425
+ "type": "boolean",
426
+ "default": true,
427
+ "description": "是否跟踪 24h 回复窗口与主动发送额度状态"
428
+ }
429
+ }
325
430
  }
326
431
  }
327
432
  },
433
+ "botId": {
434
+ "type": "string",
435
+ "minLength": 1,
436
+ "description": "兼容字段:等价 channels.wecom.bot.longConnection.botId"
437
+ },
438
+ "secret": {
439
+ "type": "string",
440
+ "minLength": 1,
441
+ "description": "兼容字段:等价 channels.wecom.bot.longConnection.secret",
442
+ "x-sensitive": true
443
+ },
328
444
  "webhookBot": {
329
445
  "type": "object",
330
446
  "description": "Webhook Bot 出站回包配置(fallback layer)",
@@ -406,6 +522,33 @@
406
522
  "type": "string",
407
523
  "description": "可选:WeCom 出站 API 代理(如 http://127.0.0.1:7890)"
408
524
  },
525
+ "apiBaseUrl": {
526
+ "type": "string",
527
+ "description": "可选:自定义 WeCom API Base URL(默认 https://qyapi.weixin.qq.com)"
528
+ },
529
+ "network": {
530
+ "type": "object",
531
+ "description": "兼容字段:网络配置别名",
532
+ "additionalProperties": false,
533
+ "properties": {
534
+ "egressProxyUrl": {
535
+ "type": "string",
536
+ "description": "兼容字段:等价 outboundProxy"
537
+ },
538
+ "proxyUrl": {
539
+ "type": "string",
540
+ "description": "兼容字段:等价 outboundProxy"
541
+ },
542
+ "proxy": {
543
+ "type": "string",
544
+ "description": "兼容字段:等价 outboundProxy"
545
+ },
546
+ "apiBaseUrl": {
547
+ "type": "string",
548
+ "description": "兼容字段:等价 apiBaseUrl"
549
+ }
550
+ }
551
+ },
409
552
  "defaultAccount": {
410
553
  "type": "string",
411
554
  "minLength": 1,
@@ -448,6 +591,28 @@
448
591
  "type": "string",
449
592
  "description": "发送者未授权时的拒绝提示文案"
450
593
  },
594
+ "groupPolicy": {
595
+ "type": "string",
596
+ "enum": [
597
+ "open",
598
+ "allowlist",
599
+ "deny",
600
+ "disabled"
601
+ ],
602
+ "description": "可选:群聊准入策略。open=开放,allowlist=仅白名单成员可触发,deny/disabled=关闭群聊处理。"
603
+ },
604
+ "groupAllowFrom": {
605
+ "type": "array",
606
+ "description": "可选:群聊发送者允许列表(空=不限制,支持 '*')",
607
+ "items": {
608
+ "type": "string",
609
+ "minLength": 1
610
+ }
611
+ },
612
+ "groupAllowFromRejectMessage": {
613
+ "type": "string",
614
+ "description": "群聊发送者未授权时的拒绝提示文案"
615
+ },
451
616
  "adminUsers": {
452
617
  "type": "array",
453
618
  "description": "管理员用户 ID(可绕过指令白名单)",
@@ -510,6 +675,26 @@
510
675
  "default": true,
511
676
  "description": "是否启用群聊消息处理"
512
677
  },
678
+ "policy": {
679
+ "type": "string",
680
+ "enum": [
681
+ "open",
682
+ "allowlist",
683
+ "deny",
684
+ "disabled"
685
+ ],
686
+ "description": "群聊准入策略:open=开放,allowlist=仅白名单成员可触发,deny/disabled=关闭群聊处理"
687
+ },
688
+ "groupPolicy": {
689
+ "type": "string",
690
+ "enum": [
691
+ "open",
692
+ "allowlist",
693
+ "deny",
694
+ "disabled"
695
+ ],
696
+ "description": "兼容字段:等价 policy"
697
+ },
513
698
  "triggerMode": {
514
699
  "type": "string",
515
700
  "enum": [
@@ -543,6 +728,97 @@
543
728
  }
544
729
  }
545
730
  },
731
+ "groups": {
732
+ "type": "object",
733
+ "description": "按群 chatId 定义覆盖规则:触发方式、授权成员、拒绝文案等",
734
+ "additionalProperties": {
735
+ "type": "object",
736
+ "additionalProperties": false,
737
+ "properties": {
738
+ "enabled": {
739
+ "type": "boolean",
740
+ "description": "该群是否启用消息处理"
741
+ },
742
+ "policy": {
743
+ "type": "string",
744
+ "enum": [
745
+ "open",
746
+ "allowlist",
747
+ "deny",
748
+ "disabled"
749
+ ],
750
+ "description": "该群准入策略:open=开放,allowlist=仅白名单成员可触发,deny/disabled=关闭群聊处理"
751
+ },
752
+ "groupPolicy": {
753
+ "type": "string",
754
+ "enum": [
755
+ "open",
756
+ "allowlist",
757
+ "deny",
758
+ "disabled"
759
+ ],
760
+ "description": "兼容字段:等价 policy"
761
+ },
762
+ "triggerMode": {
763
+ "type": "string",
764
+ "enum": [
765
+ "direct",
766
+ "mention",
767
+ "keyword"
768
+ ],
769
+ "description": "该群触发模式:direct=直接触发,mention=@触发,keyword=关键词触发"
770
+ },
771
+ "requireMention": {
772
+ "type": "boolean",
773
+ "description": "兼容字段:等价于 triggerMode=mention"
774
+ },
775
+ "mentionPatterns": {
776
+ "type": "array",
777
+ "description": "该群提及匹配关键字",
778
+ "items": {
779
+ "type": "string",
780
+ "minLength": 1
781
+ }
782
+ },
783
+ "triggerKeywords": {
784
+ "type": "array",
785
+ "description": "该群关键词触发列表",
786
+ "items": {
787
+ "type": "string",
788
+ "minLength": 1
789
+ }
790
+ },
791
+ "allowFrom": {
792
+ "type": "array",
793
+ "description": "该群允许触发机器人的成员列表(覆盖 groupAllowFrom)",
794
+ "items": {
795
+ "type": "string",
796
+ "minLength": 1
797
+ }
798
+ },
799
+ "groupAllowFrom": {
800
+ "type": "array",
801
+ "description": "兼容字段:等价 allowFrom",
802
+ "items": {
803
+ "type": "string",
804
+ "minLength": 1
805
+ }
806
+ },
807
+ "rejectMessage": {
808
+ "type": "string",
809
+ "description": "该群成员未授权时的提示文案"
810
+ },
811
+ "groupAllowFromRejectMessage": {
812
+ "type": "string",
813
+ "description": "兼容字段:等价 rejectMessage"
814
+ },
815
+ "blockMessage": {
816
+ "type": "string",
817
+ "description": "兼容字段:等价 rejectMessage"
818
+ }
819
+ }
820
+ }
821
+ },
546
822
  "dynamicAgent": {
547
823
  "type": "object",
548
824
  "description": "动态 Agent 路由策略(按用户/群/提及映射到指定 agent)",
@@ -672,10 +948,11 @@
672
948
  "enum": [
673
949
  "open",
674
950
  "allowlist",
951
+ "pairing",
675
952
  "deny"
676
953
  ],
677
954
  "default": "open",
678
- "description": "私聊策略:open=开放,allowlist=白名单,deny=关闭"
955
+ "description": "私聊策略:open=开放,allowlist=白名单,pairing=首次私聊需审批,deny=关闭"
679
956
  },
680
957
  "rejectMessage": {
681
958
  "type": "string",
@@ -688,7 +965,7 @@
688
965
  },
689
966
  "allowFrom": {
690
967
  "type": "array",
691
- "description": "私聊白名单(mode=allowlist 时生效)",
968
+ "description": "私聊白名单(mode=allowlist/pairing 时作为显式放行名单)",
692
969
  "items": {
693
970
  "type": "string",
694
971
  "minLength": 1
@@ -1143,10 +1420,48 @@
1143
1420
  }
1144
1421
  }
1145
1422
  },
1423
+ "botId": {
1424
+ "type": "string",
1425
+ "minLength": 1,
1426
+ "description": "兼容字段:等价 accounts.<id>.bot.longConnection.botId"
1427
+ },
1428
+ "secret": {
1429
+ "type": "string",
1430
+ "minLength": 1,
1431
+ "description": "兼容字段:等价 accounts.<id>.bot.longConnection.secret",
1432
+ "x-sensitive": true
1433
+ },
1146
1434
  "outboundProxy": {
1147
1435
  "type": "string",
1148
1436
  "description": "可选:该账户专用 WeCom 出站 API 代理(覆盖 channels.wecom.outboundProxy)"
1149
1437
  },
1438
+ "apiBaseUrl": {
1439
+ "type": "string",
1440
+ "description": "可选:该账户专用 WeCom API Base URL(覆盖 channels.wecom.apiBaseUrl)"
1441
+ },
1442
+ "network": {
1443
+ "type": "object",
1444
+ "description": "兼容字段:该账户网络配置别名",
1445
+ "additionalProperties": false,
1446
+ "properties": {
1447
+ "egressProxyUrl": {
1448
+ "type": "string",
1449
+ "description": "兼容字段:等价 outboundProxy"
1450
+ },
1451
+ "proxyUrl": {
1452
+ "type": "string",
1453
+ "description": "兼容字段:等价 outboundProxy"
1454
+ },
1455
+ "proxy": {
1456
+ "type": "string",
1457
+ "description": "兼容字段:等价 outboundProxy"
1458
+ },
1459
+ "apiBaseUrl": {
1460
+ "type": "string",
1461
+ "description": "兼容字段:等价 apiBaseUrl"
1462
+ }
1463
+ }
1464
+ },
1150
1465
  "tools": {
1151
1466
  "type": "object",
1152
1467
  "description": "该账户专用 OpenClaw 工具能力开关(覆盖 channels.wecom.tools)",
@@ -1184,6 +1499,28 @@
1184
1499
  "type": "string",
1185
1500
  "description": "可选:该账户发送者未授权时的拒绝文案(覆盖 channels.wecom.allowFromRejectMessage)"
1186
1501
  },
1502
+ "groupPolicy": {
1503
+ "type": "string",
1504
+ "enum": [
1505
+ "open",
1506
+ "allowlist",
1507
+ "deny",
1508
+ "disabled"
1509
+ ],
1510
+ "description": "可选:该账户专用群聊准入策略(覆盖 channels.wecom.groupPolicy)"
1511
+ },
1512
+ "groupAllowFrom": {
1513
+ "type": "array",
1514
+ "description": "可选:该账户专用群聊发送者允许列表(覆盖 channels.wecom.groupAllowFrom)",
1515
+ "items": {
1516
+ "type": "string",
1517
+ "minLength": 1
1518
+ }
1519
+ },
1520
+ "groupAllowFromRejectMessage": {
1521
+ "type": "string",
1522
+ "description": "可选:该账户群聊发送者未授权时的拒绝文案(覆盖 channels.wecom.groupAllowFromRejectMessage)"
1523
+ },
1187
1524
  "dm": {
1188
1525
  "type": "object",
1189
1526
  "description": "可选:该账户私聊策略(覆盖 channels.wecom.dm)",
@@ -1194,14 +1531,15 @@
1194
1531
  "enum": [
1195
1532
  "open",
1196
1533
  "allowlist",
1534
+ "pairing",
1197
1535
  "deny"
1198
1536
  ],
1199
1537
  "default": "open",
1200
- "description": "私聊策略:open=开放,allowlist=白名单,deny=关闭"
1538
+ "description": "私聊策略:open=开放,allowlist=白名单,pairing=首次私聊需审批,deny=关闭"
1201
1539
  },
1202
1540
  "allowFrom": {
1203
1541
  "type": "array",
1204
- "description": "私聊白名单(mode=allowlist 时生效)",
1542
+ "description": "私聊白名单(mode=allowlist/pairing 时作为显式放行名单)",
1205
1543
  "items": {
1206
1544
  "type": "string",
1207
1545
  "minLength": 1
@@ -1213,6 +1551,160 @@
1213
1551
  }
1214
1552
  }
1215
1553
  },
1554
+ "groupChat": {
1555
+ "type": "object",
1556
+ "description": "可选:该账户群聊触发策略(覆盖 channels.wecom.groupChat)",
1557
+ "additionalProperties": false,
1558
+ "properties": {
1559
+ "enabled": {
1560
+ "type": "boolean",
1561
+ "default": true,
1562
+ "description": "是否启用该账户群聊消息处理"
1563
+ },
1564
+ "policy": {
1565
+ "type": "string",
1566
+ "enum": [
1567
+ "open",
1568
+ "allowlist",
1569
+ "deny",
1570
+ "disabled"
1571
+ ],
1572
+ "description": "该账户群聊准入策略"
1573
+ },
1574
+ "groupPolicy": {
1575
+ "type": "string",
1576
+ "enum": [
1577
+ "open",
1578
+ "allowlist",
1579
+ "deny",
1580
+ "disabled"
1581
+ ],
1582
+ "description": "兼容字段:等价 policy"
1583
+ },
1584
+ "triggerMode": {
1585
+ "type": "string",
1586
+ "enum": [
1587
+ "direct",
1588
+ "mention",
1589
+ "keyword"
1590
+ ],
1591
+ "default": "direct",
1592
+ "description": "该账户群聊触发模式"
1593
+ },
1594
+ "requireMention": {
1595
+ "type": "boolean",
1596
+ "default": false,
1597
+ "description": "兼容字段:等价于 triggerMode=mention"
1598
+ },
1599
+ "mentionPatterns": {
1600
+ "type": "array",
1601
+ "description": "该账户群聊提及匹配关键字",
1602
+ "items": {
1603
+ "type": "string",
1604
+ "minLength": 1
1605
+ }
1606
+ },
1607
+ "triggerKeywords": {
1608
+ "type": "array",
1609
+ "description": "该账户群聊关键词触发列表",
1610
+ "items": {
1611
+ "type": "string",
1612
+ "minLength": 1
1613
+ }
1614
+ }
1615
+ }
1616
+ },
1617
+ "groups": {
1618
+ "type": "object",
1619
+ "description": "可选:该账户按群 chatId 定义覆盖规则",
1620
+ "additionalProperties": {
1621
+ "type": "object",
1622
+ "additionalProperties": false,
1623
+ "properties": {
1624
+ "enabled": {
1625
+ "type": "boolean",
1626
+ "description": "该群是否启用消息处理"
1627
+ },
1628
+ "policy": {
1629
+ "type": "string",
1630
+ "enum": [
1631
+ "open",
1632
+ "allowlist",
1633
+ "deny",
1634
+ "disabled"
1635
+ ],
1636
+ "description": "该群准入策略:open=开放,allowlist=仅白名单成员可触发,deny/disabled=关闭群聊处理"
1637
+ },
1638
+ "groupPolicy": {
1639
+ "type": "string",
1640
+ "enum": [
1641
+ "open",
1642
+ "allowlist",
1643
+ "deny",
1644
+ "disabled"
1645
+ ],
1646
+ "description": "兼容字段:等价 policy"
1647
+ },
1648
+ "triggerMode": {
1649
+ "type": "string",
1650
+ "enum": [
1651
+ "direct",
1652
+ "mention",
1653
+ "keyword"
1654
+ ],
1655
+ "description": "该群触发模式"
1656
+ },
1657
+ "requireMention": {
1658
+ "type": "boolean",
1659
+ "description": "兼容字段:等价于 triggerMode=mention"
1660
+ },
1661
+ "mentionPatterns": {
1662
+ "type": "array",
1663
+ "description": "该群提及匹配关键字",
1664
+ "items": {
1665
+ "type": "string",
1666
+ "minLength": 1
1667
+ }
1668
+ },
1669
+ "triggerKeywords": {
1670
+ "type": "array",
1671
+ "description": "该群关键词触发列表",
1672
+ "items": {
1673
+ "type": "string",
1674
+ "minLength": 1
1675
+ }
1676
+ },
1677
+ "allowFrom": {
1678
+ "type": "array",
1679
+ "description": "该群允许触发机器人的成员列表(覆盖 groupAllowFrom)",
1680
+ "items": {
1681
+ "type": "string",
1682
+ "minLength": 1
1683
+ }
1684
+ },
1685
+ "groupAllowFrom": {
1686
+ "type": "array",
1687
+ "description": "兼容字段:等价 allowFrom",
1688
+ "items": {
1689
+ "type": "string",
1690
+ "minLength": 1
1691
+ }
1692
+ },
1693
+ "rejectMessage": {
1694
+ "type": "string",
1695
+ "description": "该群成员未授权时的提示文案"
1696
+ },
1697
+ "groupAllowFromRejectMessage": {
1698
+ "type": "string",
1699
+ "description": "兼容字段:等价 rejectMessage"
1700
+ },
1701
+ "blockMessage": {
1702
+ "type": "string",
1703
+ "description": "兼容字段:等价 rejectMessage"
1704
+ }
1705
+ }
1706
+ }
1707
+ },
1216
1708
  "events": {
1217
1709
  "type": "object",
1218
1710
  "description": "可选:该账户事件策略(覆盖 channels.wecom.events)",
@@ -1305,10 +1797,202 @@
1305
1797
  "id": "wecom",
1306
1798
  "label": "企业微信 WeCom",
1307
1799
  "selectionLabel": "企业微信 WeCom(自建应用/Bot)",
1800
+ "detailLabel": "企业微信自建应用 / Bot",
1308
1801
  "docsPath": "/channels/wecom",
1309
1802
  "docsLabel": "wecom",
1310
1803
  "blurb": "企业微信消息通道(自建应用回调 + Bot 回调 + 发送 API)。",
1311
1804
  "order": 80,
1805
+ "systemImage": "building.2.crop.circle",
1806
+ "quickstartAllowFrom": true,
1807
+ "quickstart": {
1808
+ "recommendedMode": "bot_long_connection",
1809
+ "defaultGroupProfile": "inherit",
1810
+ "supportsSetupPlan": true,
1811
+ "supportsWizard": true,
1812
+ "supportsRunChecks": true,
1813
+ "supportsActions": true,
1814
+ "supportsMigration": true,
1815
+ "supportsRepairPlan": true,
1816
+ "supportsConfirmRepair": true,
1817
+ "supportsDoctor": true,
1818
+ "supportsExternalInstaller": true,
1819
+ "installerSpec": "@dingxiang-me/openclaw-wecom-cli",
1820
+ "installerCommand": "npx -y @dingxiang-me/openclaw-wecom-cli install",
1821
+ "applyRepairCommand": "npm run wecom:quickstart -- --run-checks --apply-repair",
1822
+ "confirmRepairCommand": "npm run wecom:quickstart -- --run-checks --confirm-repair",
1823
+ "doctorCommand": "npm run wecom:doctor -- --json",
1824
+ "migrationCommand": "npm run wecom:migrate -- --json",
1825
+ "runChecksCommand": "npm run wecom:quickstart -- --run-checks",
1826
+ "forceChecksCommand": "npm run wecom:quickstart -- --run-checks --force-checks",
1827
+ "setupCommand": "npm run wecom:quickstart -- --json",
1828
+ "wizardCommand": "npm run wecom:quickstart -- --wizard",
1829
+ "writeCommand": "npm run wecom:quickstart -- --write",
1830
+ "modes": [
1831
+ {
1832
+ "id": "bot_long_connection",
1833
+ "label": "Bot 长连接",
1834
+ "recommended": true,
1835
+ "requiresPublicWebhook": false,
1836
+ "supportsPairing": true,
1837
+ "docsAnchor": "#bot-long-connection",
1838
+ "summary": "最快跑通对话;无需公网 callback,优先推荐。",
1839
+ "firstRunGoal": "先把 Bot 收消息、回消息和长连接健康跑通。",
1840
+ "requiredAdminSteps": [
1841
+ "在企业微信 Bot 后台启用长连接并拿到 BotID / Secret。"
1842
+ ],
1843
+ "successChecks": [
1844
+ {
1845
+ "id": "bot_long_connection-check-1",
1846
+ "command": "npm run wecom:bot:selfcheck -- --account default",
1847
+ "summary": "检查 1: npm run wecom:bot:selfcheck -- --account default"
1848
+ },
1849
+ {
1850
+ "id": "bot_long_connection-check-2",
1851
+ "command": "npm run wecom:bot:longconn:probe -- --json",
1852
+ "summary": "检查 2: npm run wecom:bot:longconn:probe -- --json"
1853
+ }
1854
+ ],
1855
+ "requiredConfigPaths": [
1856
+ "channels.wecom.bot.enabled",
1857
+ "channels.wecom.bot.longConnection.enabled",
1858
+ "channels.wecom.bot.longConnection.botId",
1859
+ "channels.wecom.bot.longConnection.secret"
1860
+ ],
1861
+ "checks": [
1862
+ "npm run wecom:bot:selfcheck -- --account default",
1863
+ "npm run wecom:bot:longconn:probe -- --json"
1864
+ ]
1865
+ },
1866
+ {
1867
+ "id": "agent_callback",
1868
+ "label": "自建应用回调",
1869
+ "recommended": false,
1870
+ "requiresPublicWebhook": true,
1871
+ "supportsPairing": true,
1872
+ "docsAnchor": "#callback-url",
1873
+ "summary": "适合需要主动发送、自建应用菜单和 Agent API 的场景。",
1874
+ "firstRunGoal": "先把自建应用 callback、主动发送和公网回调验证跑通。",
1875
+ "requiredAdminSteps": [
1876
+ "在企业微信自建应用后台配置回调 URL、Token 和 EncodingAESKey。",
1877
+ "为 callback 路径准备稳定公网入口并完成 URL 验证。"
1878
+ ],
1879
+ "successChecks": [
1880
+ {
1881
+ "id": "agent_callback-check-1",
1882
+ "command": "npm run wecom:agent:selfcheck -- --account default",
1883
+ "summary": "检查 1: npm run wecom:agent:selfcheck -- --account default"
1884
+ },
1885
+ {
1886
+ "id": "agent_callback-check-2",
1887
+ "command": "npm run wecom:selfcheck -- --account default",
1888
+ "summary": "检查 2: npm run wecom:selfcheck -- --account default"
1889
+ }
1890
+ ],
1891
+ "requiredConfigPaths": [
1892
+ "channels.wecom.corpId",
1893
+ "channels.wecom.corpSecret",
1894
+ "channels.wecom.agentId",
1895
+ "channels.wecom.callbackToken",
1896
+ "channels.wecom.callbackAesKey",
1897
+ "channels.wecom.webhookPath"
1898
+ ],
1899
+ "checks": [
1900
+ "npm run wecom:agent:selfcheck -- --account default",
1901
+ "npm run wecom:selfcheck -- --account default"
1902
+ ]
1903
+ },
1904
+ {
1905
+ "id": "hybrid",
1906
+ "label": "Bot + Agent 双通道",
1907
+ "recommended": false,
1908
+ "requiresPublicWebhook": true,
1909
+ "supportsPairing": true,
1910
+ "docsAnchor": "#callback-url",
1911
+ "summary": "同时保留 Bot 长连接的接入顺滑和 Agent 的主动发送能力。",
1912
+ "firstRunGoal": "先同时打通 Bot 对话入口和 Agent 主动发送链路。",
1913
+ "requiredAdminSteps": [
1914
+ "在企业微信自建应用后台配置回调 URL、Token 和 EncodingAESKey。",
1915
+ "在企业微信 Bot 后台启用长连接并拿到 BotID / Secret。"
1916
+ ],
1917
+ "successChecks": [
1918
+ {
1919
+ "id": "hybrid-check-1",
1920
+ "command": "npm run wecom:agent:selfcheck -- --account default",
1921
+ "summary": "检查 1: npm run wecom:agent:selfcheck -- --account default"
1922
+ },
1923
+ {
1924
+ "id": "hybrid-check-2",
1925
+ "command": "npm run wecom:bot:selfcheck -- --account default",
1926
+ "summary": "检查 2: npm run wecom:bot:selfcheck -- --account default"
1927
+ }
1928
+ ],
1929
+ "requiredConfigPaths": [
1930
+ "channels.wecom.corpId",
1931
+ "channels.wecom.corpSecret",
1932
+ "channels.wecom.agentId",
1933
+ "channels.wecom.callbackToken",
1934
+ "channels.wecom.callbackAesKey",
1935
+ "channels.wecom.bot.enabled",
1936
+ "channels.wecom.bot.longConnection.enabled",
1937
+ "channels.wecom.bot.longConnection.botId",
1938
+ "channels.wecom.bot.longConnection.secret"
1939
+ ],
1940
+ "checks": [
1941
+ "npm run wecom:agent:selfcheck -- --account default",
1942
+ "npm run wecom:bot:selfcheck -- --account default"
1943
+ ]
1944
+ }
1945
+ ],
1946
+ "groupProfiles": [
1947
+ {
1948
+ "id": "inherit",
1949
+ "label": "保持默认",
1950
+ "summary": "不额外写入群聊策略,保留当前默认行为。",
1951
+ "recommendedForModes": [
1952
+ "bot_long_connection",
1953
+ "agent_callback",
1954
+ "hybrid"
1955
+ ]
1956
+ },
1957
+ {
1958
+ "id": "mention_only",
1959
+ "label": "仅 @ 触发",
1960
+ "summary": "群里保持开放,但只在 @ 机器人时触发。",
1961
+ "recommendedForModes": [
1962
+ "bot_long_connection",
1963
+ "hybrid"
1964
+ ]
1965
+ },
1966
+ {
1967
+ "id": "open_direct",
1968
+ "label": "群聊直出",
1969
+ "summary": "群里所有成员都可直接触发,无需 @。",
1970
+ "recommendedForModes": [
1971
+ "agent_callback"
1972
+ ]
1973
+ },
1974
+ {
1975
+ "id": "allowlist_template",
1976
+ "label": "群白名单模板",
1977
+ "summary": "预置 allowlist、按群覆盖和拒绝文案,适合值班群/运营群。",
1978
+ "recommendedForModes": [
1979
+ "agent_callback",
1980
+ "hybrid",
1981
+ "bot_long_connection"
1982
+ ]
1983
+ },
1984
+ {
1985
+ "id": "deny",
1986
+ "label": "关闭群聊",
1987
+ "summary": "显式关闭群聊处理,只保留私聊/点对点路径。",
1988
+ "recommendedForModes": [
1989
+ "bot_long_connection",
1990
+ "agent_callback",
1991
+ "hybrid"
1992
+ ]
1993
+ }
1994
+ ]
1995
+ },
1312
1996
  "aliases": [
1313
1997
  "wework",
1314
1998
  "qiwei",