Skip to content

微信:读群公告(matewechat_group_notice),群接龙显示完整名单 - #65

Merged
NginxL merged 3 commits into
mainfrom
feat/wechat-group-notice
Dec 6, 2026
Merged

NginxL merged 3 commits into
mainfrom
feat/wechat-group-notice

Conversation

@NginxL

@NginxL NginxL commented Dec 6, 2026

Copy link
Copy Markdown
Owner

做了什么

1. 新工具 matewechat_group_notice(只读)

  • 参数 chat(群的会话 id,…@chatroom),返回群公告正文、发布人(名字和 id)、发布时间;不是群、群里没有公告时直接说明。
  • 内置组件:matewechat-native 新增操作 group_notice,用协议库 wechat-protocol 2.7.0 的公开接口 NativeClient::group_detail_raw + decode_group_detail(微信的 getchatroominfodetail),10 秒超时;公告正文不写日志。企业微信群(@im.chatroom / @qy_g)协议库不支持,会说明读不到。
  • AgentWechat 模式:读 GET /groups/{id} 里保存的 announcement(只有正文,没有发布人和时间,工具会注明)。
  • 清单 agent_tools 加上它,/agent 能用;给助手的说明(assistant/instructions.md)补了用法和「公告里可能有账号密码,只用到问的部分」。

2. 群接龙(appmsg type 53)显示成「[接龙] 标题…\n1. 张三\n2. 李四」

  • 结构照 thisnick/agent-wechat(MIT)wechat-core/src/group_notes.rs(提交 aba33f7)从官方客户端样本得出的形态:可见文本是 <title>;<extinfo><solitaire_info> 里的 <solitaire> 用 UTF-16 偏移区间(tt 标题、ex 例子行、tl 补充说明、每条 <i><r>)指向标题,每条的原文在 <c>。
  • 各部分都读得出时按结构拼出完整接龙;有任何一部分读不出(缺 solitaire_info、不是 XML、区间越界、DTD 等)就原样用 <title>。以前落到默认分支显示成「[链接] …」。
  • AgentWechat 模式同样显示「[接龙] …」:用它给的 body(就是标题全文),没有时用 summary(kind=group_note)的条目拼。
  • 已入库的旧接龙消息不回填。

怎么验证的

  • bash scripts/test.sh:根 950、飞书 419、微信 190 全部通过(打包校验要等发版时升版本号)。
  • cargo test --locked(native/matewechat-native):20 个通过,新增 4 个接龙单测(含上游手数的 UTF-16 区间用例、例子行、标题缺名单时取 <c>、八种读不出的情形回落到标题)。
  • 新测试在 main 代码上都会失败:去掉 "53" 分支后 4 个原生单测失败;Python 新测试在 main 上 4 个失败/报错 + 平台工具清单断言失败。
  • 本地编译的组件冒烟:hello 返回 version 0.1.12;未登录时 group_notice 返回 signed_out。

没做什么

  • 没有写公告、发消息的能力;不需要新权限,没有新开关。
  • 企业微信群读不到公告(协议库限制)。
  • 旧的接龙消息不回填。

🤖 Generated with Claude Code

NginxL and others added 3 commits December 6, 2026 11:28
…otes (接龙) show their whole list

- matewechat-native 0.1.12: group_notice (wechat-protocol's public group_detail_raw / decode_group_detail, read
  only); a Group Note (app message 53) is "[接龙] …" with its numbered list, written out from its
  <extinfo><solitaire_info> (UTF-16 ranges into <title>, the shape agent-wechat reads), else its <title> as it is.
- matewechat_group_notice: the text, who published it and when; through AgentWechat the copy it keeps.
- Through AgentWechat a Group Note is "[接龙] …" too (its body, else its group_note summary).
- The assistant's instructions say both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r AgentWechat's saved notice (review 1)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- 新工具 matewechat_group_notice(只读):读一个群现在的群公告,返回正文、发布人、发布时间;不是群、没有公告时说明。
- 群接龙显示成「[接龙] 标题…」加完整编号名单(以前显示成「[链接] …」);已入库的旧消息不回填。
- 微信组件钉到 matewechat-native 0.1.12(release matewechat-native-v0.1.12,SHA-256 a5cedb2d…0930c,8365440 字节)。
- 不新增权限,不新增以用户身份发的消息,没有新开关。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant