Skip to content

feat(Yuanbao): support wechat forward msg#43508

Merged
teknium1 merged 2 commits into
NousResearch:mainfrom
YuanbaoTeam:dev_forward
Jun 12, 2026
Merged

feat(Yuanbao): support wechat forward msg#43508
teknium1 merged 2 commits into
NousResearch:mainfrom
YuanbaoTeam:dev_forward

Conversation

@loongfay

Copy link
Copy Markdown
Contributor

What

End-to-end support for WeChat forwarded chat records ("聊天记录" cards) on the Yuanbao adapter. Previously these messages were dropped.

The forward payload arrives as a TIMCustomElem with elem_type=1009, carrying a base64-encoded ForwardMsgData protobuf in MsgContent.ext_map.

Changes

  • yuanbao_proto.py: hand-written protobuf codec for ForwardMsgData (no new deps).
  • yuanbao.py: new ForwardedRecordsParseMiddleware in the inbound pipeline — flattens forwards into a text prompt and resolves embedded images / files / videos into the existing media-cache placeholder scheme. Adds video to resolvable media kinds. Non-@bot group turns get an eager forward summary written to the transcript at observe time.
  • tests/test_yuanbao_pipeline.py: covers the new middleware.

Diff: 3 files, +540 / -40.

Design

  • New middleware sits between QuoteContextMiddleware and MediaResolveMiddleware, so injected media references reuse the existing resolver — no duplicate download path.
  • Internal YuanbaoMessageType.CHAT_RECORD is coerced back to MessageType.TEXT at dispatch, keeping the public adapter contract unchanged.
  • Failure mode is graceful: parse errors leave ctx.raw_text untouched (= previous behavior).
  • No new env vars, no new core tool, no prompt-cache impact.

Test

scripts/run_tests.sh tests/test_yuanbao_proto.py tests/test_yuanbao_pipeline.py
# 125 passed

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jun 10, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Overview

Feature PR adding WeChat forward message support to the Yuanbao platform adapter.

Looks Good

  • Clean platform extension with proper type hints throughout
  • Uses standard library modules appropriately (base64, binascii, enum)
  • Well-structured with dedicated decode_forward_msg_data helper
  • Adds cache_video_from_bytes for media handling
  • Test coverage present (test_yuanbao_pipeline.py)
  • No hardcoded secrets or security concerns

Reviewed by Hermes Agent

@austinpickett

Copy link
Copy Markdown
Collaborator

Reviewed by Hermes Agent — deferred to maintainer for product sign-off. Feature PRs (type/feature) need a product/design decision on whether this capability is wanted before merge review proceeds. Please await maintainer feedback.

Hermes Agent triage

@teknium1 teknium1 merged commit e20e0bd into NousResearch:main Jun 12, 2026
23 checks passed
AIalliAI added a commit to AIalliAI/Hermes that referenced this pull request Jun 12, 2026
Brings in NousResearch#44776 (/credits command), NousResearch#44778 (Teams DOCUMENT attachments),
NousResearch#43508 (Yuanbao wechat forward msg), NousResearch#44792 (profile-scope Channels
endpoints + per-profile .env seeding).
@loongfay loongfay deleted the dev_forward branch June 12, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants