Feat: 发送图文ark卡片 (#355)

* feat(onebot): implement send tuwen ark

* test: add unit tests for send_ark action

* test(onebot): update canonical action docs count expectation to 191

* refactor(protocol,onebot): update 0xdc2_34 ark implementation and test coverage

- Rename action send_ark -> send_tuwen_ark to distinguish from structmsg and contact-share arks.
- Clarify SSO command mapping (OidbSvcTrpcTcp.0xdc2_34) and default param behavior in comments/docs.
- Adjust peerType, field3, and previewUrl to pb_optional to preserve 0/empty values during proton encoding.
- Update OneBot handler, tests, and auto-generated MCP tool catalog specs.

* style(protocol): fix indentation in rich-body-decoder tests
This commit is contained in:
H3CoF6 authored and GitHub committed 2026-08-20 12:12:39 +08:00
1 parent 62256ee816
commit 8fbddf67bf
11 files changed
+734 -137

No files matched your search

@@ -8,7 +8,7 @@
// reads {1:bussness_error_code, 5:ark_json}.
// Both return a server-built ark JSON string (the share card payload).
import type { pb, uint_32 } from '@snowluma/proton';
import type { pb, pb_optional, uint_32 } from '@snowluma/proton';
export interface OidbBuddyRecommendArkReq {
uin?: pb<1, uint_32>;
@@ -28,3 +28,43 @@ export interface OidbGroupRecommendArkResp {
errCode?: pb<1, uint_32>;
arkJson?: pb<5, string>;
}
// 0xdc2_34 — send a custom 图文 (URL-share) ark card to a C2C peer or group.
// Field layout RE'd from QQ Android 9.3.25 captures. Default SSO: OidbSvcTrpcTcp.0xdc2_34.
// appId = 100446242 is fixed for this ark type.
// targetId (UIN or group_id) appears at AppInfo[11] AND Meta[2].
// Meta.peerType: 0 = C2C, 1 = group.
// peerType, field3, and previewUrl are pb_optional — proton preserves 0/empty on wire.
export interface Oidb0xdc2CardField5 {
field1?: pb<1, uint_32>;
}
export interface Oidb0xdc2CardContent {
flag?: pb<1, uint_32>;
title?: pb<10, string>;
desc?: pb<11, string>;
summary?: pb<12, string>;
jumpUrl?: pb<13, string>;
previewUrl?: pb_optional<14, string>;
}
export interface Oidb0xdc2AppInfo {
appId?: pb<1, uint_32>;
field2?: pb<2, uint_32>;
field3?: pb_optional<3, uint_32>;
field5?: pb<5, Oidb0xdc2CardField5>;
targetId?: pb<11, uint_32>;
content?: pb<12, Oidb0xdc2CardContent>;
}
export interface Oidb0xdc2Meta {
peerType?: pb_optional<1, uint_32>;
targetId?: pb<2, uint_32>;
}
export interface Oidb0xdc2_34Req {
appInfo?: pb<1, Oidb0xdc2AppInfo>;
meta?: pb<2, Oidb0xdc2Meta>;
}
export interface Oidb0xdc2_34Resp {}