openclaw-plugin-yuanbao 2.13.1 → 2.13.3

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 (267) hide show
  1. package/README.md +407 -58
  2. package/dist/api.d.ts +4 -0
  3. package/dist/api.js +4 -0
  4. package/dist/index.js +5 -0
  5. package/dist/src/access/api.d.ts +8 -0
  6. package/dist/src/access/api.js +8 -0
  7. package/dist/src/access/http/bot-id-cache.d.ts +12 -0
  8. package/dist/src/access/http/bot-id-cache.js +12 -0
  9. package/dist/src/access/http/main.d.ts +12 -0
  10. package/dist/src/access/http/main.js +12 -0
  11. package/dist/src/access/http/request.d.ts +1 -0
  12. package/dist/src/access/http/request.js +10 -2
  13. package/dist/src/access/ws/biz-codec.d.ts +25 -0
  14. package/dist/src/access/ws/biz-codec.js +29 -0
  15. package/dist/src/access/ws/client.d.ts +31 -0
  16. package/dist/src/access/ws/client.js +73 -11
  17. package/dist/src/access/ws/conn-codec.d.ts +42 -0
  18. package/dist/src/access/ws/conn-codec.js +44 -0
  19. package/dist/src/access/ws/gateway.d.ts +1 -0
  20. package/dist/src/access/ws/gateway.js +27 -0
  21. package/dist/src/access/ws/runtime.d.ts +20 -0
  22. package/dist/src/access/ws/runtime.js +12 -1
  23. package/dist/src/access/ws/types.d.ts +33 -0
  24. package/dist/src/access/ws/types.js +7 -0
  25. package/dist/src/accounts.d.ts +17 -0
  26. package/dist/src/accounts.js +41 -1
  27. package/dist/src/business/actions/deliver.d.ts +14 -0
  28. package/dist/src/business/actions/deliver.js +12 -0
  29. package/dist/src/business/actions/handler.d.ts +21 -0
  30. package/dist/src/business/actions/handler.js +33 -0
  31. package/dist/src/business/actions/index.d.ts +16 -0
  32. package/dist/src/business/actions/index.js +24 -0
  33. package/dist/src/business/actions/media/send.d.ts +14 -0
  34. package/dist/src/business/actions/media/send.js +14 -0
  35. package/dist/src/business/actions/resolve-target.d.ts +29 -0
  36. package/dist/src/business/actions/resolve-target.js +25 -0
  37. package/dist/src/business/actions/sticker/init-builtin-stickers.d.ts +10 -0
  38. package/dist/src/business/actions/sticker/init-builtin-stickers.js +10 -0
  39. package/dist/src/business/actions/sticker/send.d.ts +19 -0
  40. package/dist/src/business/actions/sticker/send.js +19 -0
  41. package/dist/src/business/actions/sticker/sticker-cache.d.ts +28 -0
  42. package/dist/src/business/actions/sticker/sticker-cache.js +43 -2
  43. package/dist/src/business/actions/sticker/sticker-types.d.ts +8 -0
  44. package/dist/src/business/actions/sticker/sticker-types.js +3 -0
  45. package/dist/src/business/actions/text/send.d.ts +11 -0
  46. package/dist/src/business/actions/text/send.js +11 -0
  47. package/dist/src/business/commands/command-sync/index.d.ts +1 -0
  48. package/dist/src/business/commands/command-sync/index.js +3 -0
  49. package/dist/src/business/commands/log-upload/cos-upload.d.ts +11 -0
  50. package/dist/src/business/commands/log-upload/cos-upload.js +28 -0
  51. package/dist/src/business/commands/log-upload/extractor.js +15 -0
  52. package/dist/src/business/commands/log-upload/index.js +1 -0
  53. package/dist/src/business/commands/log-upload/perform.d.ts +12 -0
  54. package/dist/src/business/commands/log-upload/perform.js +18 -0
  55. package/dist/src/business/commands/upgrade/env.d.ts +15 -0
  56. package/dist/src/business/commands/upgrade/env.js +17 -0
  57. package/dist/src/business/commands/upgrade/index.d.ts +9 -0
  58. package/dist/src/business/commands/upgrade/index.js +13 -0
  59. package/dist/src/business/commands/upgrade/upgrade.d.ts +3 -0
  60. package/dist/src/business/commands/upgrade/upgrade.js +47 -0
  61. package/dist/src/business/commands/upgrade/utils.d.ts +31 -0
  62. package/dist/src/business/commands/upgrade/utils.js +45 -0
  63. package/dist/src/business/inbound/index.d.ts +13 -0
  64. package/dist/src/business/inbound/index.js +15 -0
  65. package/dist/src/business/messaging/callbacks/recall.d.ts +18 -0
  66. package/dist/src/business/messaging/callbacks/recall.js +19 -1
  67. package/dist/src/business/messaging/chat-history.d.ts +16 -0
  68. package/dist/src/business/messaging/chat-history.js +14 -0
  69. package/dist/src/business/messaging/chat-history.test.d.ts +3 -0
  70. package/dist/src/business/messaging/chat-history.test.js +7 -0
  71. package/dist/src/business/messaging/context.d.ts +5 -0
  72. package/dist/src/business/messaging/context.js +4 -0
  73. package/dist/src/business/messaging/directory.d.ts +15 -0
  74. package/dist/src/business/messaging/directory.js +26 -0
  75. package/dist/src/business/messaging/extract.d.ts +10 -0
  76. package/dist/src/business/messaging/extract.js +11 -0
  77. package/dist/src/business/messaging/extract.test.d.ts +3 -0
  78. package/dist/src/business/messaging/extract.test.js +3 -0
  79. package/dist/src/business/messaging/handlers/custom/index.d.ts +11 -0
  80. package/dist/src/business/messaging/handlers/custom/index.js +24 -0
  81. package/dist/src/business/messaging/handlers/custom/link-card.d.ts +12 -0
  82. package/dist/src/business/messaging/handlers/custom/link-card.js +13 -0
  83. package/dist/src/business/messaging/handlers/custom.d.ts +5 -0
  84. package/dist/src/business/messaging/handlers/custom.js +5 -0
  85. package/dist/src/business/messaging/handlers/custom.test.d.ts +5 -0
  86. package/dist/src/business/messaging/handlers/custom.test.js +8 -3
  87. package/dist/src/business/messaging/handlers/face.d.ts +1 -0
  88. package/dist/src/business/messaging/handlers/face.js +2 -0
  89. package/dist/src/business/messaging/handlers/face.test.d.ts +5 -0
  90. package/dist/src/business/messaging/handlers/face.test.js +5 -0
  91. package/dist/src/business/messaging/handlers/file.d.ts +6 -0
  92. package/dist/src/business/messaging/handlers/file.js +13 -0
  93. package/dist/src/business/messaging/handlers/image.d.ts +6 -0
  94. package/dist/src/business/messaging/handlers/image.js +17 -1
  95. package/dist/src/business/messaging/handlers/image.test.d.ts +5 -0
  96. package/dist/src/business/messaging/handlers/image.test.js +6 -0
  97. package/dist/src/business/messaging/handlers/index.d.ts +1 -0
  98. package/dist/src/business/messaging/handlers/index.js +9 -0
  99. package/dist/src/business/messaging/handlers/index.test.d.ts +5 -0
  100. package/dist/src/business/messaging/handlers/index.test.js +5 -0
  101. package/dist/src/business/messaging/handlers/sound.d.ts +6 -0
  102. package/dist/src/business/messaging/handlers/sound.js +10 -0
  103. package/dist/src/business/messaging/handlers/text.d.ts +5 -0
  104. package/dist/src/business/messaging/handlers/text.js +11 -0
  105. package/dist/src/business/messaging/handlers/text.test.d.ts +5 -0
  106. package/dist/src/business/messaging/handlers/text.test.js +6 -0
  107. package/dist/src/business/messaging/handlers/types.d.ts +35 -0
  108. package/dist/src/business/messaging/handlers/types.js +6 -0
  109. package/dist/src/business/messaging/handlers/video.d.ts +5 -0
  110. package/dist/src/business/messaging/handlers/video.js +12 -0
  111. package/dist/src/business/messaging/index.d.ts +1 -0
  112. package/dist/src/business/messaging/index.js +3 -0
  113. package/dist/src/business/messaging/mention.d.ts +27 -0
  114. package/dist/src/business/messaging/mention.js +27 -0
  115. package/dist/src/business/messaging/quote.d.ts +19 -0
  116. package/dist/src/business/messaging/quote.js +24 -0
  117. package/dist/src/business/messaging/quote.test.d.ts +3 -0
  118. package/dist/src/business/messaging/quote.test.js +4 -0
  119. package/dist/src/business/messaging/system-callbacks.d.ts +21 -0
  120. package/dist/src/business/messaging/system-callbacks.js +22 -0
  121. package/dist/src/business/messaging/targets.d.ts +28 -0
  122. package/dist/src/business/messaging/targets.js +37 -2
  123. package/dist/src/business/messaging/targets.test.d.ts +5 -0
  124. package/dist/src/business/messaging/targets.test.js +10 -0
  125. package/dist/src/business/outbound/create-sender.d.ts +1 -0
  126. package/dist/src/business/outbound/create-sender.js +4 -0
  127. package/dist/src/business/outbound/heartbeat.d.ts +3 -0
  128. package/dist/src/business/outbound/heartbeat.js +3 -0
  129. package/dist/src/business/outbound/index.d.ts +3 -0
  130. package/dist/src/business/outbound/index.js +3 -0
  131. package/dist/src/business/outbound/queue.d.ts +3 -0
  132. package/dist/src/business/outbound/queue.js +25 -8
  133. package/dist/src/business/outbound/types.d.ts +11 -0
  134. package/dist/src/business/outbound/types.js +5 -0
  135. package/dist/src/business/pipeline/create.d.ts +5 -0
  136. package/dist/src/business/pipeline/create.js +27 -17
  137. package/dist/src/business/pipeline/engine.d.ts +10 -0
  138. package/dist/src/business/pipeline/engine.js +11 -0
  139. package/dist/src/business/pipeline/engine.test.d.ts +3 -0
  140. package/dist/src/business/pipeline/engine.test.js +7 -0
  141. package/dist/src/business/pipeline/index.d.ts +5 -0
  142. package/dist/src/business/pipeline/index.js +5 -0
  143. package/dist/src/business/pipeline/middlewares/build-context.d.ts +4 -0
  144. package/dist/src/business/pipeline/middlewares/build-context.js +8 -0
  145. package/dist/src/business/pipeline/middlewares/build-context.test.d.ts +3 -0
  146. package/dist/src/business/pipeline/middlewares/build-context.test.js +4 -0
  147. package/dist/src/business/pipeline/middlewares/dispatch-reply.d.ts +7 -0
  148. package/dist/src/business/pipeline/middlewares/dispatch-reply.js +34 -1
  149. package/dist/src/business/pipeline/middlewares/dispatch-reply.test.d.ts +3 -0
  150. package/dist/src/business/pipeline/middlewares/dispatch-reply.test.js +12 -0
  151. package/dist/src/business/pipeline/middlewares/download-media.d.ts +4 -0
  152. package/dist/src/business/pipeline/middlewares/download-media.js +10 -0
  153. package/dist/src/business/pipeline/middlewares/download-media.test.d.ts +3 -0
  154. package/dist/src/business/pipeline/middlewares/download-media.test.js +3 -0
  155. package/dist/src/business/pipeline/middlewares/extract-content.d.ts +3 -0
  156. package/dist/src/business/pipeline/middlewares/extract-content.js +6 -0
  157. package/dist/src/business/pipeline/middlewares/extract-content.test.d.ts +3 -0
  158. package/dist/src/business/pipeline/middlewares/extract-content.test.js +5 -0
  159. package/dist/src/business/pipeline/middlewares/guard-command.d.ts +4 -0
  160. package/dist/src/business/pipeline/middlewares/guard-command.js +6 -1
  161. package/dist/src/business/pipeline/middlewares/guard-command.test.d.ts +3 -0
  162. package/dist/src/business/pipeline/middlewares/guard-command.test.js +4 -0
  163. package/dist/src/business/pipeline/middlewares/guard-group-command.d.ts +6 -0
  164. package/dist/src/business/pipeline/middlewares/guard-group-command.js +8 -1
  165. package/dist/src/business/pipeline/middlewares/guard-group-command.test.d.ts +3 -0
  166. package/dist/src/business/pipeline/middlewares/guard-group-command.test.js +4 -0
  167. package/dist/src/business/pipeline/middlewares/guard-send-access.d.ts +15 -0
  168. package/dist/src/business/pipeline/middlewares/guard-send-access.js +33 -0
  169. package/dist/src/business/pipeline/middlewares/guard-send-access.test.d.ts +3 -0
  170. package/dist/src/business/pipeline/middlewares/guard-send-access.test.js +7 -2
  171. package/dist/src/business/pipeline/middlewares/guard-special-command.d.ts +3 -0
  172. package/dist/src/business/pipeline/middlewares/guard-special-command.js +19 -3
  173. package/dist/src/business/pipeline/middlewares/guard-special-command.test.d.ts +3 -0
  174. package/dist/src/business/pipeline/middlewares/guard-special-command.test.js +4 -0
  175. package/dist/src/business/pipeline/middlewares/index.d.ts +3 -0
  176. package/dist/src/business/pipeline/middlewares/index.js +3 -0
  177. package/dist/src/business/pipeline/middlewares/prepare-sender.d.ts +3 -0
  178. package/dist/src/business/pipeline/middlewares/prepare-sender.js +6 -1
  179. package/dist/src/business/pipeline/middlewares/prepare-sender.test.d.ts +3 -0
  180. package/dist/src/business/pipeline/middlewares/prepare-sender.test.js +3 -0
  181. package/dist/src/business/pipeline/middlewares/record-member.d.ts +4 -0
  182. package/dist/src/business/pipeline/middlewares/record-member.js +4 -0
  183. package/dist/src/business/pipeline/middlewares/record-member.test.d.ts +3 -0
  184. package/dist/src/business/pipeline/middlewares/record-member.test.js +3 -0
  185. package/dist/src/business/pipeline/middlewares/resolve-mention.d.ts +6 -0
  186. package/dist/src/business/pipeline/middlewares/resolve-mention.js +9 -1
  187. package/dist/src/business/pipeline/middlewares/resolve-mention.test.d.ts +3 -0
  188. package/dist/src/business/pipeline/middlewares/resolve-mention.test.js +3 -0
  189. package/dist/src/business/pipeline/middlewares/resolve-quote.d.ts +3 -0
  190. package/dist/src/business/pipeline/middlewares/resolve-quote.js +3 -0
  191. package/dist/src/business/pipeline/middlewares/resolve-quote.test.d.ts +3 -0
  192. package/dist/src/business/pipeline/middlewares/resolve-quote.test.js +3 -0
  193. package/dist/src/business/pipeline/middlewares/resolve-route.d.ts +3 -0
  194. package/dist/src/business/pipeline/middlewares/resolve-route.js +4 -0
  195. package/dist/src/business/pipeline/middlewares/resolve-route.test.d.ts +3 -0
  196. package/dist/src/business/pipeline/middlewares/resolve-route.test.js +3 -0
  197. package/dist/src/business/pipeline/middlewares/resolve-trace.d.ts +4 -0
  198. package/dist/src/business/pipeline/middlewares/resolve-trace.js +5 -0
  199. package/dist/src/business/pipeline/middlewares/rewrite-body.d.ts +3 -0
  200. package/dist/src/business/pipeline/middlewares/rewrite-body.js +10 -0
  201. package/dist/src/business/pipeline/middlewares/rewrite-body.test.d.ts +3 -0
  202. package/dist/src/business/pipeline/middlewares/rewrite-body.test.js +4 -0
  203. package/dist/src/business/pipeline/middlewares/skip-placeholder.d.ts +6 -0
  204. package/dist/src/business/pipeline/middlewares/skip-placeholder.js +13 -0
  205. package/dist/src/business/pipeline/middlewares/skip-placeholder.test.d.ts +3 -0
  206. package/dist/src/business/pipeline/middlewares/skip-placeholder.test.js +3 -0
  207. package/dist/src/business/pipeline/middlewares/skip-self.d.ts +3 -0
  208. package/dist/src/business/pipeline/middlewares/skip-self.js +4 -1
  209. package/dist/src/business/pipeline/middlewares/skip-self.test.d.ts +3 -0
  210. package/dist/src/business/pipeline/middlewares/skip-self.test.js +3 -0
  211. package/dist/src/business/pipeline/test-helpers/mock-ctx.d.ts +10 -0
  212. package/dist/src/business/pipeline/test-helpers/mock-ctx.js +11 -0
  213. package/dist/src/business/pipeline/types.d.ts +9 -0
  214. package/dist/src/business/pipeline/types.js +4 -0
  215. package/dist/src/business/tools/group.d.ts +14 -0
  216. package/dist/src/business/tools/group.js +31 -0
  217. package/dist/src/business/tools/index.d.ts +13 -0
  218. package/dist/src/business/tools/index.js +18 -0
  219. package/dist/src/business/tools/member.d.ts +15 -0
  220. package/dist/src/business/tools/member.js +46 -0
  221. package/dist/src/business/tools/remind.d.ts +7 -0
  222. package/dist/src/business/tools/remind.js +518 -182
  223. package/dist/src/business/trace/context.d.ts +18 -1
  224. package/dist/src/business/trace/context.js +17 -1
  225. package/dist/src/business/utils/markdown.d.ts +12 -0
  226. package/dist/src/business/utils/markdown.js +62 -15
  227. package/dist/src/business/utils/media.d.ts +10 -0
  228. package/dist/src/business/utils/media.js +43 -1
  229. package/dist/src/business/utils/utils.d.ts +35 -2
  230. package/dist/src/business/utils/utils.js +33 -2
  231. package/dist/src/business/utils/utils.test.d.ts +5 -0
  232. package/dist/src/business/utils/utils.test.js +6 -0
  233. package/dist/src/channel-shared.d.ts +18 -1
  234. package/dist/src/channel-shared.js +18 -1
  235. package/dist/src/channel.d.ts +7 -0
  236. package/dist/src/channel.js +16 -0
  237. package/dist/src/channel.setup.d.ts +8 -0
  238. package/dist/src/channel.setup.js +8 -0
  239. package/dist/src/config-schema.d.ts +14 -0
  240. package/dist/src/config-schema.js +14 -0
  241. package/dist/src/dispatcher/debouncer/index.d.ts +1 -0
  242. package/dist/src/dispatcher/debouncer/index.js +13 -0
  243. package/dist/src/dispatcher/queue/session-abort-manager.d.ts +18 -0
  244. package/dist/src/dispatcher/queue/session-abort-manager.js +18 -0
  245. package/dist/src/dispatcher/queue/session-queue.d.ts +19 -0
  246. package/dist/src/dispatcher/queue/session-queue.js +22 -0
  247. package/dist/src/infra/cache/member.d.ts +3 -0
  248. package/dist/src/infra/cache/member.js +18 -0
  249. package/dist/src/infra/cache/ttl-db.d.ts +5 -0
  250. package/dist/src/infra/cache/ttl-db.js +6 -1
  251. package/dist/src/infra/cache/ttl-db.test.d.ts +3 -0
  252. package/dist/src/infra/cache/ttl-db.test.js +5 -0
  253. package/dist/src/infra/env.d.ts +12 -0
  254. package/dist/src/infra/env.js +32 -1
  255. package/dist/src/infra/transport.d.ts +7 -0
  256. package/dist/src/infra/transport.js +12 -0
  257. package/dist/src/logger.d.ts +5 -0
  258. package/dist/src/logger.js +6 -0
  259. package/dist/src/runtime.d.ts +6 -0
  260. package/dist/src/setup-core.d.ts +6 -0
  261. package/dist/src/setup-core.js +10 -0
  262. package/dist/src/setup-surface.d.ts +6 -0
  263. package/dist/src/setup-surface.js +7 -0
  264. package/dist/src/types.d.ts +16 -0
  265. package/dist/src/types.js +1 -0
  266. package/openclaw.plugin.json +1 -1
  267. package/package.json +22 -43
package/README.md CHANGED
@@ -1,58 +1,407 @@
1
- # openclaw-plugin-yuanbao
2
-
3
- [![npm version](https://img.shields.io/npm/v/openclaw-plugin-yuanbao.svg)](https://www.npmjs.com/package/openclaw-plugin-yuanbao)
4
-
5
- 腾讯元宝智能机器人频道插件,让你的 OpenClaw 机器人能够接入元宝 Bot 通道,支持私聊和群聊。
6
-
7
- ## ✨ 功能特性
8
-
9
- | 能力 | 描述 |
10
- |------|------|
11
- | 💬 群聊互动 | 在元宝派群组中,成员 @元宝Bot 即可触发 AI 回复 |
12
- | 🧠 长期记忆 | 记住与创建者的历史对话,越聊越懂你 |
13
- | 随时在线 | 云端部署,7×24 小时在线服务派友 |
14
- | 🔍 联网搜索 | 自动接入 Web Search,回答实时信息 |
15
-
16
- ## 🚀 快速开始
17
-
18
- ### 1. 安装插件
19
-
20
- ```bash
21
- openclaw plugins install openclaw-plugin-yuanbao
22
- ```
23
-
24
- ### 2. 配置通道
25
-
26
- ```bash
27
- openclaw channels add
28
- ```
29
-
30
- 根据提示输入:
31
- - **AppID**: 元宝 APP APP ID
32
- - **AppSecret**: 元宝 APP 的密钥
33
-
34
- ### 3. 开始使用
35
-
36
- 配置完成后,用户可以:
37
- - **私聊** - 直接向机器人发送消息
38
- - **群聊** - @机器人 或回复机器人消息触发对话
39
-
40
- ## 🛠️ Bot 常用命令
41
-
42
- ```
43
- /yuanbaobot-upgrade # 升级元宝插件(需机器人主人权限)
44
- /issue-log # 提交问题日志
45
- ```
46
-
47
- ## ❓ 常见问题
48
-
49
- ### 连接失败
50
- - 检查 `AppID` 和 `AppSecret` 是否正确
51
-
52
- ## 📚 相关文档
53
- - [元宝官网](https://yuanbao.tencent.com)
54
-
55
- ## 🔧 系统要求
56
-
57
- - OpenClaw >= 2026.3.22
58
- - Node.js >= 18
1
+ ---
2
+ summary: "Yuanbao bot overview, features, and configuration"
3
+ read_when:
4
+ - You want to connect a Yuanbao bot
5
+ - You are configuring the Yuanbao channel
6
+ title: Yuanbao
7
+ ---
8
+
9
+ # Yuanbao
10
+
11
+ Tencent Yuanbao is Tencent's AI assistant platform. The OpenClaw channel plugin
12
+ connects Yuanbao bots to OpenClaw over WebSocket so they can interact with users
13
+ through direct messages and group chats.
14
+
15
+ **Status:** production-ready for bot DMs + group chats. WebSocket is the only supported connection mode.
16
+
17
+ ---
18
+
19
+ ## Quick start
20
+
21
+ > **Requires OpenClaw 2026.4.10 or above.** Run `openclaw --version` to check. Upgrade with `openclaw update`.
22
+
23
+ ### 1. Add the Yuanbao channel with your credentials
24
+
25
+ ```bash
26
+ openclaw channels add --channel yuanbao --token "appKey:appSecret"
27
+ ```
28
+
29
+ The `--token` value uses colon-separated `appKey:appSecret` format. You can obtain these from the Yuanbao app by creating a robot in your application settings.
30
+
31
+ ### 2. Restart the gateway to apply the changes
32
+
33
+ ```bash
34
+ openclaw gateway restart
35
+ ```
36
+
37
+ ### Interactive setup (alternative)
38
+
39
+ You can also use the interactive wizard:
40
+
41
+ ```bash
42
+ openclaw channels login --channel yuanbao
43
+ ```
44
+
45
+ Follow the prompts to enter your App ID and App Secret.
46
+
47
+ ---
48
+
49
+ ## Access control
50
+
51
+ ### Direct messages
52
+
53
+ Configure `dmPolicy` to control who can DM the bot:
54
+
55
+ - `"pairing"` — unknown users receive a pairing code; approve via CLI
56
+ - `"allowlist"` — only users listed in `allowFrom` can chat
57
+ - `"open"` allow all users (default)
58
+ - `"disabled"` disable all DMs
59
+
60
+ **Approve a pairing request:**
61
+
62
+ ```bash
63
+ openclaw pairing list yuanbao
64
+ openclaw pairing approve yuanbao <CODE>
65
+ ```
66
+
67
+ ### Group chats
68
+
69
+ **Mention requirement** (`channels.yuanbao.requireMention`):
70
+
71
+ - `true` — require @mention (default)
72
+ - `false` — respond without @mention
73
+
74
+ Replying to the bot's message in a group chat is treated as an implicit mention.
75
+
76
+ ---
77
+
78
+ ## Configuration examples
79
+
80
+ ### Basic setup with open DM policy
81
+
82
+ ```json5
83
+ {
84
+ channels: {
85
+ yuanbao: {
86
+ appKey: "your_app_key",
87
+ appSecret: "your_app_secret",
88
+ dm: {
89
+ policy: "open",
90
+ },
91
+ },
92
+ },
93
+ }
94
+ ```
95
+
96
+ ### Restrict DMs to specific users
97
+
98
+ ```json5
99
+ {
100
+ channels: {
101
+ yuanbao: {
102
+ appKey: "your_app_key",
103
+ appSecret: "your_app_secret",
104
+ dm: {
105
+ policy: "allowlist",
106
+ allowFrom: ["user_id_1", "user_id_2"],
107
+ },
108
+ },
109
+ },
110
+ }
111
+ ```
112
+
113
+ ### Disable @mention requirement in groups
114
+
115
+ ```json5
116
+ {
117
+ channels: {
118
+ yuanbao: {
119
+ requireMention: false,
120
+ },
121
+ },
122
+ }
123
+ ```
124
+
125
+ ### Optimize outbound message delivery
126
+
127
+ ```json5
128
+ {
129
+ channels: {
130
+ yuanbao: {
131
+ // Send each chunk immediately without buffering
132
+ outboundQueueStrategy: "immediate",
133
+ },
134
+ },
135
+ }
136
+ ```
137
+
138
+ ### Tune merge-text strategy
139
+
140
+ ```json5
141
+ {
142
+ channels: {
143
+ yuanbao: {
144
+ outboundQueueStrategy: "merge-text",
145
+ minChars: 2800, // buffer until this many chars
146
+ maxChars: 3000, // force split above this limit
147
+ idleMs: 5000, // auto-flush after idle timeout (ms)
148
+ },
149
+ },
150
+ }
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Common commands
156
+
157
+ | Command | Description |
158
+ | ---------- | --------------------------- |
159
+ | `/help` | Show available commands |
160
+ | `/status` | Show bot status |
161
+ | `/new` | Start a new session |
162
+ | `/stop` | Stop the current run |
163
+ | `/restart` | Restart OpenClaw |
164
+ | `/compact` | Compact the session context |
165
+
166
+ > Yuanbao supports native slash-command menus. Commands are synced to the platform automatically when the gateway starts.
167
+
168
+ ---
169
+
170
+ ## Troubleshooting
171
+
172
+ ### Bot does not respond in group chats
173
+
174
+ 1. Ensure the bot is added to the group
175
+ 2. Ensure you @mention the bot (required by default)
176
+ 3. Check logs: `openclaw logs --follow`
177
+
178
+ ### Bot does not receive messages
179
+
180
+ 1. Ensure the bot is created and approved in the Yuanbao app
181
+ 2. Ensure `appKey` and `appSecret` are correctly configured
182
+ 3. Ensure the gateway is running: `openclaw gateway status`
183
+ 4. Check logs: `openclaw logs --follow`
184
+
185
+ ### Bot sends empty or fallback replies
186
+
187
+ 1. Check if the AI model is returning valid content
188
+ 2. The default fallback reply is: "暂时无法解答,你可以换个问题问问我哦"
189
+ 3. Customize it via `channels.yuanbao.fallbackReply`
190
+
191
+ ### App Secret leaked
192
+
193
+ 1. Reset the App Secret in YuanBao APP
194
+ 2. Update the value in your config
195
+ 3. Restart the gateway: `openclaw gateway restart`
196
+
197
+ ---
198
+
199
+ ## Advanced configuration
200
+
201
+ ### Multiple accounts
202
+
203
+ ```json5
204
+ {
205
+ channels: {
206
+ yuanbao: {
207
+ defaultAccount: "main",
208
+ accounts: {
209
+ main: {
210
+ appKey: "key_xxx",
211
+ appSecret: "secret_xxx",
212
+ name: "Primary bot",
213
+ },
214
+ backup: {
215
+ appKey: "key_yyy",
216
+ appSecret: "secret_yyy",
217
+ name: "Backup bot",
218
+ enabled: false,
219
+ },
220
+ },
221
+ },
222
+ },
223
+ }
224
+ ```
225
+
226
+ `defaultAccount` controls which account is used when outbound APIs do not specify an `accountId`.
227
+
228
+ ### Message limits
229
+
230
+ - `maxChars` — single message max character count (default: `3000` chars)
231
+ - `mediaMaxMb` — media upload/download limit (default: `20` MB)
232
+ - `overflowPolicy` — behavior when message exceeds limit: `"split"` (default) or `"stop"`
233
+
234
+ ### Streaming
235
+
236
+ Yuanbao supports block-level streaming output. When enabled, the bot sends text in chunks as it generates.
237
+
238
+ ```json5
239
+ {
240
+ channels: {
241
+ yuanbao: {
242
+ disableBlockStreaming: false, // block streaming enabled (default)
243
+ },
244
+ },
245
+ }
246
+ ```
247
+
248
+ Set `disableBlockStreaming: true` to send the complete reply in one message.
249
+
250
+ ### Group chat history context
251
+
252
+ Control how many historical messages are included in the AI context for group chats:
253
+
254
+ ```json5
255
+ {
256
+ channels: {
257
+ yuanbao: {
258
+ historyLimit: 100, // default: 100, set 0 to disable
259
+ },
260
+ },
261
+ }
262
+ ```
263
+
264
+ ### Reply-to mode
265
+
266
+ Control how the bot quotes messages when replying in group chats:
267
+
268
+ ```json5
269
+ {
270
+ channels: {
271
+ yuanbao: {
272
+ replyToMode: "first", // "off" | "first" | "all" (default: "first")
273
+ },
274
+ },
275
+ }
276
+ ```
277
+
278
+ | Value | Behavior |
279
+ | --------- | -------------------------------------------------------- |
280
+ | `"off"` | No quote reply |
281
+ | `"first"` | Quote only the first reply per inbound message (default) |
282
+ | `"all"` | Quote every reply |
283
+
284
+ ### Markdown hint injection
285
+
286
+ By default, the bot injects instructions in the system prompt to prevent the AI model from wrapping the entire reply in markdown code blocks.
287
+
288
+ ```json5
289
+ {
290
+ channels: {
291
+ yuanbao: {
292
+ markdownHintEnabled: true, // default: true
293
+ },
294
+ },
295
+ }
296
+ ```
297
+
298
+ ### Debug mode
299
+
300
+ Enable unsanitized log output for specific bot IDs:
301
+
302
+ ```json5
303
+ {
304
+ channels: {
305
+ yuanbao: {
306
+ debugBotIds: ["bot_user_id_1", "bot_user_id_2"],
307
+ },
308
+ },
309
+ }
310
+ ```
311
+
312
+ ### Multi-agent routing
313
+
314
+ Use `bindings` to route Yuanbao DMs or groups to different agents.
315
+
316
+ ```json5
317
+ {
318
+ agents: {
319
+ list: [
320
+ { id: "main" },
321
+ { id: "agent-a", workspace: "/home/user/agent-a" },
322
+ { id: "agent-b", workspace: "/home/user/agent-b" },
323
+ ],
324
+ },
325
+ bindings: [
326
+ {
327
+ agentId: "agent-a",
328
+ match: {
329
+ channel: "yuanbao",
330
+ peer: { kind: "direct", id: "user_xxx" },
331
+ },
332
+ },
333
+ {
334
+ agentId: "agent-b",
335
+ match: {
336
+ channel: "yuanbao",
337
+ peer: { kind: "group", id: "group_zzz" },
338
+ },
339
+ },
340
+ ],
341
+ }
342
+ ```
343
+
344
+ Routing fields:
345
+
346
+ - `match.channel`: `"yuanbao"`
347
+ - `match.peer.kind`: `"direct"` (DM) or `"group"` (group chat)
348
+ - `match.peer.id`: user ID or group code
349
+
350
+ ---
351
+
352
+ ## Configuration reference
353
+
354
+ Full configuration: [Gateway configuration](/gateway/configuration)
355
+
356
+ | Setting | Description | Default |
357
+ | ------------------------------------------ | ------------------------------------------------- | -------------------------------------- |
358
+ | `channels.yuanbao.enabled` | Enable/disable the channel | `true` |
359
+ | `channels.yuanbao.defaultAccount` | Default account for outbound routing | `default` |
360
+ | `channels.yuanbao.accounts.<id>.appKey` | App Key (used for signing and ticket generation) | — |
361
+ | `channels.yuanbao.accounts.<id>.appSecret` | App Secret (used for signing) | — |
362
+ | `channels.yuanbao.accounts.<id>.token` | Pre-signed token (skips automatic ticket signing) | — |
363
+ | `channels.yuanbao.accounts.<id>.name` | Account display name | — |
364
+ | `channels.yuanbao.accounts.<id>.enabled` | Enable/disable a specific account | `true` |
365
+ | `channels.yuanbao.dm.policy` | DM policy | `open` |
366
+ | `channels.yuanbao.dm.allowFrom` | DM allowlist (user ID list) | — |
367
+ | `channels.yuanbao.requireMention` | Require @mention in groups | `true` |
368
+ | `channels.yuanbao.overflowPolicy` | Long message handling (`split` or `stop`) | `split` |
369
+ | `channels.yuanbao.replyToMode` | Group reply-to strategy (`off`, `first`, `all`) | `first` |
370
+ | `channels.yuanbao.outboundQueueStrategy` | Outbound strategy (`merge-text` or `immediate`) | `merge-text` |
371
+ | `channels.yuanbao.minChars` | Merge-text: min chars to trigger send | `2800` |
372
+ | `channels.yuanbao.maxChars` | Merge-text: max chars per message | `3000` |
373
+ | `channels.yuanbao.idleMs` | Merge-text: idle timeout before auto-flush (ms) | `5000` |
374
+ | `channels.yuanbao.mediaMaxMb` | Media size limit (MB) | `20` |
375
+ | `channels.yuanbao.historyLimit` | Group chat history context entries | `100` |
376
+ | `channels.yuanbao.disableBlockStreaming` | Disable block-level streaming output | `false` |
377
+ | `channels.yuanbao.fallbackReply` | Fallback reply when AI returns no content | `暂时无法解答,你可以换个问题问问我哦` |
378
+ | `channels.yuanbao.markdownHintEnabled` | Inject markdown anti-wrapping instructions | `true` |
379
+ | `channels.yuanbao.debugBotIds` | Debug whitelist bot IDs (unsanitized logs) | `[]` |
380
+
381
+ ---
382
+
383
+ ## Supported message types
384
+
385
+ ### Receive
386
+
387
+ - ✅ Text
388
+ - ✅ Images
389
+ - ✅ Files
390
+ - ✅ Audio / Voice
391
+ - ✅ Video
392
+ - ✅ Stickers / Custom emoji
393
+ - ✅ Custom elements (link cards, etc.)
394
+
395
+ ### Send
396
+
397
+ - ✅ Text (with markdown support)
398
+ - ✅ Images
399
+ - ✅ Files
400
+ - ✅ Audio
401
+ - ✅ Video
402
+ - ✅ Stickers
403
+
404
+ ### Threads and replies
405
+
406
+ - ✅ Quote replies (configurable via `replyToMode`)
407
+ - ❌ Thread replies (not supported by platform)
package/dist/api.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Aggregated export file
3
+ * 供 index.ts 通过 loadBundledEntryExportSync 懒加载引用
4
+ */
1
5
  export { yuanbaoPlugin } from "./src/channel.js";
2
6
  export { yuanbaoSetupPlugin } from "./src/channel.setup.js";
3
7
  export { initLogger } from "./src/logger.js";
package/dist/api.js CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Aggregated export file
3
+ * 供 index.ts 通过 loadBundledEntryExportSync 懒加载引用
4
+ */
1
5
  export { yuanbaoPlugin } from "./src/channel.js";
2
6
  export { yuanbaoSetupPlugin } from "./src/channel.setup.js";
3
7
  export { initLogger } from "./src/logger.js";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineBundledChannelEntry, loadBundledEntryExportSync, } from "openclaw/plugin-sdk/channel-entry-contract";
2
2
  import { YUANBAO_PLUGIN_ID } from "./src/channel-shared.js";
3
+ /** 懒加载注册工具 */
3
4
  function registerTools(api) {
4
5
  const register = loadBundledEntryExportSync(import.meta.url, {
5
6
  specifier: "./api.js",
@@ -7,6 +8,7 @@ function registerTools(api) {
7
8
  });
8
9
  register(api);
9
10
  }
11
+ /** Lazy-load and register all slash commands */
10
12
  function registerCommands(api) {
11
13
  const yuanbaoUpgradeCommand = loadBundledEntryExportSync(import.meta.url, { specifier: "./api.js", exportName: "yuanbaoUpgradeCommand" });
12
14
  const yuanbaobotUpgradeCommand = loadBundledEntryExportSync(import.meta.url, { specifier: "./api.js", exportName: "yuanbaobotUpgradeCommand" });
@@ -15,6 +17,7 @@ function registerCommands(api) {
15
17
  api.registerCommand(yuanbaobotUpgradeCommand);
16
18
  api.registerCommand(logUploadCommandDefinition);
17
19
  }
20
+ /** 懒加载初始化内置表情缓存 */
18
21
  function initBuiltinStickers() {
19
22
  const init = loadBundledEntryExportSync(import.meta.url, {
20
23
  specifier: "./api.js",
@@ -22,6 +25,7 @@ function initBuiltinStickers() {
22
25
  });
23
26
  init();
24
27
  }
28
+ /** 懒加载初始化环境变量 */
25
29
  function initEnv(api) {
26
30
  const init = loadBundledEntryExportSync(import.meta.url, {
27
31
  specifier: "./api.js",
@@ -29,6 +33,7 @@ function initEnv(api) {
29
33
  });
30
34
  init(api);
31
35
  }
36
+ /** 懒加载初始化日志 */
32
37
  function initLogger(api) {
33
38
  const init = loadBundledEntryExportSync(import.meta.url, {
34
39
  specifier: "./api.js",
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Yuanbao API client.
3
+ *
4
+ * Backward-compatible re-export entry point.
5
+ * Implementation split into:
6
+ * - http/request.ts — Types, token cache, signing, auth headers, HTTP utilities
7
+ * - http/main.ts — Business APIs (uploadInfo / downloadUrl)
8
+ */
1
9
  export type { SignTokenData, AuthHeaders, CosUploadConfig, Log } from "./http/request.js";
2
10
  export { clearSignTokenCache, clearAllSignTokenCache, getTokenStatus, verifySignature, getSignToken, forceRefreshSignToken, getAuthHeaders, yuanbaoPost, yuanbaoGet, } from "./http/request.js";
3
11
  export { apiGetUploadInfo, apiGetDownloadUrl } from "./http/main.js";
@@ -1,2 +1,10 @@
1
+ /**
2
+ * Yuanbao API client.
3
+ *
4
+ * Backward-compatible re-export entry point.
5
+ * Implementation split into:
6
+ * - http/request.ts — Types, token cache, signing, auth headers, HTTP utilities
7
+ * - http/main.ts — Business APIs (uploadInfo / downloadUrl)
8
+ */
1
9
  export { clearSignTokenCache, clearAllSignTokenCache, getTokenStatus, verifySignature, getSignToken, forceRefreshSignToken, getAuthHeaders, yuanbaoPost, yuanbaoGet, } from "./http/request.js";
2
10
  export { apiGetUploadInfo, apiGetDownloadUrl } from "./http/main.js";
@@ -1,3 +1,15 @@
1
+ /**
2
+ * Lightweight botId cache shared between the HTTP sign-token client and
3
+ * account resolution.
4
+ *
5
+ * Kept in its own module (rather than inlined in `request.ts`) so that
6
+ * `accounts.ts` — which is on the `openclaw setup` / `openclaw configure`
7
+ * code path — can look up a previously-resolved botId without statically
8
+ * pulling in the full HTTP/crypto/env runtime stack.
9
+ */
10
+ /** Read the last-known botId for an account, if any. */
1
11
  export declare function getCachedBotId(accountId: string): string | undefined;
12
+ /** Record a botId obtained during sign-token exchange. */
2
13
  export declare function setCachedBotId(accountId: string, botId: string | undefined): void;
14
+ /** Clear the cached botId (e.g. when tearing down an account). */
3
15
  export declare function clearCachedBotId(accountId: string): void;
@@ -1,14 +1,26 @@
1
+ /**
2
+ * Lightweight botId cache shared between the HTTP sign-token client and
3
+ * account resolution.
4
+ *
5
+ * Kept in its own module (rather than inlined in `request.ts`) so that
6
+ * `accounts.ts` — which is on the `openclaw setup` / `openclaw configure`
7
+ * code path — can look up a previously-resolved botId without statically
8
+ * pulling in the full HTTP/crypto/env runtime stack.
9
+ */
1
10
  const botIdCache = new Map();
11
+ /** Read the last-known botId for an account, if any. */
2
12
  export function getCachedBotId(accountId) {
3
13
  const value = botIdCache.get(accountId);
4
14
  return value && value.length > 0 ? value : undefined;
5
15
  }
16
+ /** Record a botId obtained during sign-token exchange. */
6
17
  export function setCachedBotId(accountId, botId) {
7
18
  if (!accountId || !botId) {
8
19
  return;
9
20
  }
10
21
  botIdCache.set(accountId, botId);
11
22
  }
23
+ /** Clear the cached botId (e.g. when tearing down an account). */
12
24
  export function clearCachedBotId(accountId) {
13
25
  botIdCache.delete(accountId);
14
26
  }
@@ -1,4 +1,16 @@
1
+ /**
2
+ * Yuanbao business API.
3
+ *
4
+ * Upload pre-sign config retrieval, resource download URL retrieval, etc.
5
+ * Auth and HTTP utilities are in request.ts.
6
+ */
1
7
  import type { ResolvedYuanbaoAccount } from "../../types.js";
2
8
  import type { Log, CosUploadConfig } from "./request.js";
9
+ /**
10
+ * Get COS upload pre-sign config.
11
+ */
3
12
  export declare function apiGetUploadInfo(account: ResolvedYuanbaoAccount, fileName: string, fileId: string, log?: Log): Promise<CosUploadConfig>;
13
+ /**
14
+ * Get COS download URL for a given resourceId.
15
+ */
4
16
  export declare function apiGetDownloadUrl(account: ResolvedYuanbaoAccount, resourceId: string, log?: Log): Promise<string>;
@@ -1,6 +1,15 @@
1
+ /**
2
+ * Yuanbao business API.
3
+ *
4
+ * Upload pre-sign config retrieval, resource download URL retrieval, etc.
5
+ * Auth and HTTP utilities are in request.ts.
6
+ */
1
7
  import { yuanbaoPost, yuanbaoGet } from "./request.js";
2
8
  const UPLOAD_INFO_PATH = "/api/resource/genUploadInfo";
3
9
  const DOWNLOAD_INFO_PATH = "/api/resource/v1/download";
10
+ /**
11
+ * Get COS upload pre-sign config.
12
+ */
4
13
  export async function apiGetUploadInfo(account, fileName, fileId, log) {
5
14
  const data = await yuanbaoPost(account, UPLOAD_INFO_PATH, { fileName, fileId, docFrom: "localDoc", docOpenId: "" }, log);
6
15
  if (!data.bucketName || !data.location) {
@@ -8,6 +17,9 @@ export async function apiGetUploadInfo(account, fileName, fileId, log) {
8
17
  }
9
18
  return data;
10
19
  }
20
+ /**
21
+ * Get COS download URL for a given resourceId.
22
+ */
11
23
  export async function apiGetDownloadUrl(account, resourceId, log) {
12
24
  const data = await yuanbaoGet(account, DOWNLOAD_INFO_PATH, { resourceId }, log);
13
25
  const downloadUrl = data.url ?? data.realUrl;
@@ -1,3 +1,4 @@
1
+ /** Yuanbao HTTP request base layer — token cache, signature, auth headers, and HTTP utilities. */
1
2
  import type { ResolvedYuanbaoAccount } from "../../types.js";
2
3
  export { getCachedBotId } from "./bot-id-cache.js";
3
4
  export type SignTokenData = {