Skip to content

feat(channel) yuanbao - #72756

Merged
sliverp merged 3 commits into
openclaw:mainfrom
loongfay:main
Apr 27, 2026
Merged

sliverp merged 3 commits into
openclaw:mainfrom
loongfay:main

Conversation

@loongfay

Copy link
Copy Markdown
Contributor

feat(channel): add Yuanbao IM channel plugin

Summary

  • Problem: OpenClaw had no integration with Tencent Yuanbao (元宝), a major AI assistant platform in China. Users who wanted to connect their AI agents to Yuanbao's IM bot ecosystem had no supported channel.
  • Why it matters: Yuanbao is a significant messaging/AI platform with a growing user base. Adding this channel expands OpenClaw's reach into the Chinese AI assistant market and enables users to deploy bots that interact with Yuanbao users via both direct messages and group chats.
  • What changed: Added a full-featured bundled channel plugin at extensions/yuanbao/ implementing WebSocket-based bidirectional communication with the Yuanbao bot platform, including Protobuf wire protocol encoding/decoding, HMAC-SHA256 authentication, media upload via Tencent COS, a 13-layer middleware inbound pipeline, message debouncing, multi-account support, group chat features, agent tools, sticker search, and comprehensive documentation.
  • What did NOT change (scope boundary): No core changes. No modifications to src/plugin-sdk/, src/channels/, or any other existing extension. The plugin uses only the public Plugin SDK surface (defineBundledChannelEntry, createChatChannelPlugin, createChannelInboundDebouncer, createChannelReplyPipeline, createScopedDmSecurityResolver, createComputedAccountStatusAdapter). The only non-extension file touched is the runtime sidecar registration in scripts/lib/bundled-runtime-sidecar-paths.json and the channel docs at docs/channels/yuanbao.md.

Change Type (select all)

  • Feature

Regression Test Plan

N/A — new feature, not a bug fix.

  • Coverage level that should have caught this:
    • Unit test
  • Target test or file: 24 colocated *.test.ts files under extensions/yuanbao/src/
  • Scenario the test should lock in: Message parsing, pipeline middleware behavior, target resolution, content extraction, quote handling, chat history, sticker cache, TTL DB, handler dispatch, and all 13 pipeline middleware stages.
  • Why this is the smallest reliable guardrail: Unit tests cover each middleware and handler in isolation; integration with the real Yuanbao platform requires live credentials.
  • Existing test that already covers this (if any): N/A (new plugin)
  • If no new test is added, why not: 24 test files are included.

User-visible / Behavior Changes

  • New channel available: yuanbao channel can now be configured via openclaw config set channels.yuanbao.appKey <key> and channels.yuanbao.appSecret <secret>.
  • CLI setup: openclaw setup includes a Yuanbao setup flow for interactive token/credential configuration.
  • Supported message types (inbound): Text, image, file, audio/voice, video, sticker/custom face, custom elements (link cards).
  • Supported message types (outbound): Text (Markdown), image, file, audio, video, sticker.
  • Group chat: @-mention gating (configurable), group member queries, group info queries.
  • Agent tools: query_session_members (search/list group members), group info query.
  • DM access control: Four policies — open (default), allowlist, pairing, disabled.
  • Multi-account: Multiple bot accounts can be configured under channels.yuanbao.accounts.<id>.
  • Media: Upload to Tencent COS, download from HTTP/local paths, configurable size limit (default 20 MB).
  • Streaming: Block-level streaming for AI replies (configurable).
  • Outbound strategies: merge-text (buffered aggregation) or immediate (per-item).
  • Overflow handling: split (continue in chunks) or stop (truncate).
  • Reply quoting: Configurable (off / first / all).
  • Heartbeat: RUNNING/FINISH heartbeat signals sent to the platform during reply generation.

Diagram

Yuanbao Platform (WebSocket: wss://bot-wss.yuanbao.tencent.com/wss/connection)
        ↕  Protobuf (conn-codec: AuthBind/Ping/Push | biz-codec: Send/Recv/GroupQuery)
[access/ws/client.ts]  YuanbaoWsClient (connect → auth → heartbeat → auto-reconnect)
        ↓  push event
[access/ws/gateway.ts]  startYuanbaoWsGateway (message dispatch entry)
        ↓  decoded message
[business/inbound/]  handleInboundMessage
        ↓  system callbacks → direct handling (recall, etc.)
        ↓  normal messages → debouncer (session-level serialization)
[dispatcher/debouncer/]  flush
        ↓
[business/pipeline/]  13-layer onion middleware:
  extractContent → skipSelf → skipPlaceholder → resolveQuote →
  guardCommand → resolveMention → rewriteBody → downloadMedia →
  resolveRoute → resolveTrace → buildContext → prepareSender → dispatchReply
        ↓
[business/outbound/]  queue + heartbeat controller
        ↓
[infra/transport.ts]  WS send (C2C / Group)
        ↓
Yuanbao Platform

Environment

  • OS: macOS / Linux
  • Runtime/container: Node 22+
  • Model/provider: Any configured provider
  • Integration/channel: Yuanbao (requires bot credentials from Yuanbao developer portal)
  • Relevant config (redacted):
    channels:
      yuanbao:
        appKey: "<redacted>"
        appSecret: "<redacted>"

Steps

  1. Configure Yuanbao credentials: openclaw config set channels.yuanbao.appKey <key> and openclaw config set channels.yuanbao.appSecret <secret>
  2. Start gateway: openclaw gateway run
  3. Send a direct message to the bot from the Yuanbao app
  4. Send a message in a group chat where the bot is a member, @-mentioning the bot

Expected

  • Bot connects via WebSocket, authenticates, and maintains heartbeat
  • Direct messages receive AI-generated replies
  • Group messages with @-mention trigger AI replies; messages without @-mention are ignored (default requireMention: true)
  • Media messages (images, files, audio, video) are downloaded and processed
  • Reply quoting works according to configured replyToMode

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S labels Apr 27, 2026
@greptile-apps

greptile-apps Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR registers Yuanbao as an official external channel plugin by adding its entry to the catalog JSON, updating docs, and adding contract + integration tests. The documentation and test structure are well-formed and mirror the WeCom precedent.

  • The Yuanbao install block in official-external-channel-catalog.json is missing both an exact version tag and expectedIntegrity. The existing policy test ("keeps official external catalog npm sources exactly pinned") iterates all source: "external" entries and asserts pinState === "exact-with-integrity" with no warnings — this assertion will fail as-is, blocking CI.

Confidence Score: 2/5

Not safe to merge — a deterministic CI test failure exists in the official catalog pinning policy check.

A P0 finding: the missing version pin and integrity hash on the Yuanbao catalog entry will cause the 'keeps official external catalog npm sources exactly pinned' test to fail unconditionally. This is a known existing test that enforces a hard policy on all external entries.

scripts/lib/official-external-channel-catalog.json — the install block for openclaw-plugin-yuanbao must be updated with a pinned version and expectedIntegrity before the test suite can pass.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: scripts/lib/official-external-channel-catalog.json
Line: 44-47

Comment:
**Missing version pin and integrity hash will break the pinning policy CI test**

`test/official-channel-catalog.test.ts` has a dedicated test (`"keeps official external catalog npm sources exactly pinned"`) that iterates every `source: "external"` entry and asserts `installSource.warnings` is `[]` and `installSource.npm?.pinState === "exact-with-integrity"`. The Yuanbao install block has neither an exact version tag nor `expectedIntegrity`, so `describePluginInstallSource` will produce warnings `["npm-spec-floating", "npm-spec-missing-integrity"]` and set `pinState` to `"floating-without-integrity"` — both assertions fail.

The WeCom entry next to it shows the required shape:

```json
"install": {
  "npmSpec": "openclaw-plugin-yuanbao@<exact-version>",
  "defaultChoice": "npm",
  "expectedIntegrity": "sha512-<base64-hash>"
}
```

Add an exact version and the `expectedIntegrity` once the package is published, or the test suite will not pass.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: scripts/lib/official-external-channel-catalog.json
Line: 34

Comment:
**`channel.id` uses the npm package name instead of a short semantic identifier**

Every other external entry in this catalog uses a short, human-readable id (`"wecom"`) that is independent of the npm package name. The Yuanbao entry sets `id` to `"openclaw-plugin-yuanbao"`, which is the full package name. This drives the `channelId` values in the contract test and `channel.id` comparisons. Consider using `"yuanbao"` to stay consistent with the established convention.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat(channel) yuanbao" | Re-trigger Greptile

@sliverp
sliverp merged commit 3120401 into openclaw:main Apr 27, 2026
10 checks passed
@sliverp

sliverp commented Apr 27, 2026

Copy link
Copy Markdown
Member

Landed via temp rebase onto main.

  • Gate: pnpm format:docs:check, lint:docs, docs:check-mdx, docs:check-i18n-glossary, docs:check-links, lint, build, test
  • Land commit: ab83e67
  • Merge commit: 3120401

Thanks @loongfay!

ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* feat(channel) yuanbao

* feat(channel) yuanbao

* docs(changelog): note Yuanbao channel plugin (openclaw#72756) (thanks @loongfay)

---------

Co-authored-by: loongzhao <[email protected]>
Co-authored-by: sliverp <[email protected]>
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
* feat(channel) yuanbao

* feat(channel) yuanbao

* docs(changelog): note Yuanbao channel plugin (openclaw#72756) (thanks @loongfay)

---------

Co-authored-by: loongzhao <[email protected]>
Co-authored-by: sliverp <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* feat(channel) yuanbao

* feat(channel) yuanbao

* docs(changelog): note Yuanbao channel plugin (openclaw#72756) (thanks @loongfay)

---------

Co-authored-by: loongzhao <[email protected]>
Co-authored-by: sliverp <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* feat(channel) yuanbao

* feat(channel) yuanbao

* docs(changelog): note Yuanbao channel plugin (openclaw#72756) (thanks @loongfay)

---------

Co-authored-by: loongzhao <[email protected]>
Co-authored-by: sliverp <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* feat(channel) yuanbao

* feat(channel) yuanbao

* docs(changelog): note Yuanbao channel plugin (openclaw#72756) (thanks @loongfay)

---------

Co-authored-by: loongzhao <[email protected]>
Co-authored-by: sliverp <[email protected]>
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
* feat(channel) yuanbao

* feat(channel) yuanbao

* docs(changelog): note Yuanbao channel plugin (openclaw#72756) (thanks @loongfay)

---------

Co-authored-by: loongzhao <[email protected]>
Co-authored-by: sliverp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants