From 5ea1c3a9613239309ce6219989ffb70dc12ec55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 20 May 2026 18:23:03 +0800 Subject: [PATCH] Remove bridge proto schemas and parity test Delete proto schema modules under packages/core/src/bridge/proto (action.ts, element.ts, highway.ts, longmsg.ts, message.ts, notify.ts, oidb-action.ts, oidb.ts) and the related test packages/core/tests/proton-parity.test.ts. These files contained protobuf schema definitions for the bridge layer; remove them as part of a cleanup/refactor. Update any imports or references to these modules to their new locations or replacements. --- packages/core/src/bridge/actions/extras.ts | 10 +- packages/core/src/bridge/actions/friend.ts | 2 +- .../core/src/bridge/actions/group-admin.ts | 2 +- .../core/src/bridge/actions/group-album.ts | 2 +- .../core/src/bridge/actions/group-file.ts | 6 +- .../core/src/bridge/actions/group-message.ts | 24 +- .../core/src/bridge/actions/interaction.ts | 2 +- packages/core/src/bridge/actions/misc.ts | 15 +- packages/core/src/bridge/actions/profile.ts | 27 +- packages/core/src/bridge/bridge-contacts.ts | 9 +- packages/core/src/bridge/bridge.ts | 6 +- packages/core/src/bridge/element-builder.ts | 10 +- packages/core/src/bridge/msg-push/context.ts | 15 +- .../src/bridge/msg-push/rich-body-decoder.ts | 43 +- packages/core/src/bridge/proto/action.ts | 100 -- packages/core/src/bridge/proto/element.ts | 428 ----- packages/core/src/bridge/proto/highway.ts | 343 ---- packages/core/src/bridge/proto/longmsg.ts | 68 - packages/core/src/bridge/proto/message.ts | 120 -- packages/core/src/bridge/proto/notify.ts | 245 --- packages/core/src/bridge/proto/oidb-action.ts | 1539 ----------------- packages/core/src/bridge/proto/oidb.ts | 161 -- .../bridge/proto/proton/oidb-actions/base.ts | 675 ++++++-- .../proto/proton/oidb-actions/group-album.ts | 255 ++- .../proto/proton/oidb-actions/group-file.ts | 212 ++- .../bridge/proto/proton/oidb-actions/media.ts | 282 ++- .../core/src/bridge/web-actions/cookies.ts | 2 +- packages/core/tests/actions/extras.test.ts | 4 +- .../core/tests/actions/forward-file.test.ts | 6 +- packages/core/tests/actions/forward.test.ts | 6 +- packages/core/tests/actions/friend.test.ts | 2 - .../core/tests/actions/group-admin.test.ts | 2 +- .../core/tests/actions/group-file.test.ts | 6 +- .../core/tests/actions/group-message.test.ts | 2 - .../core/tests/actions/interaction.test.ts | 2 +- packages/core/tests/actions/misc.test.ts | 2 +- packages/core/tests/actions/profile.test.ts | 21 +- .../core/tests/bridge-private-routing.test.ts | 30 +- .../core/tests/group-msg-emoji-like.test.ts | 6 +- packages/core/tests/highway/pipeline.test.ts | 26 +- packages/core/tests/message-parser.test.ts | 15 +- packages/core/tests/msg-push-handler.test.ts | 28 +- .../core/tests/observability-logs.test.ts | 13 +- packages/core/tests/proton-parity.test.ts | 815 --------- .../core/tests/web-actions/cookies.test.ts | 2 +- 45 files changed, 1361 insertions(+), 4230 deletions(-) delete mode 100644 packages/core/src/bridge/proto/action.ts delete mode 100644 packages/core/src/bridge/proto/element.ts delete mode 100644 packages/core/src/bridge/proto/highway.ts delete mode 100644 packages/core/src/bridge/proto/longmsg.ts delete mode 100644 packages/core/src/bridge/proto/message.ts delete mode 100644 packages/core/src/bridge/proto/notify.ts delete mode 100644 packages/core/src/bridge/proto/oidb-action.ts delete mode 100644 packages/core/src/bridge/proto/oidb.ts delete mode 100644 packages/core/tests/proton-parity.test.ts diff --git a/packages/core/src/bridge/actions/extras.ts b/packages/core/src/bridge/actions/extras.ts index 78ec9fde..b80b1af5 100644 --- a/packages/core/src/bridge/actions/extras.ts +++ b/packages/core/src/bridge/actions/extras.ts @@ -7,15 +7,17 @@ import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import type { Bridge } from '../bridge'; import { runOidb, makeOidbEnvelope } from '../bridge-oidb'; import { OidbBase } from '../proto/proton/oidb'; +import type { + OidbGroupTodo, + OidbStrangerStatusReq, + OidbStrangerStatusResp, +} from '../proto/proton/oidb-actions/base'; import type { OidbAiVoiceListReq, OidbAiVoiceListResp, OidbAiVoiceReq, OidbAiVoiceResp, - OidbGroupTodo, - OidbStrangerStatusReq, - OidbStrangerStatusResp, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/media'; import type { MediaIndexNode } from './shared'; // ─────────────── Group todo (0xF90) ─────────────── diff --git a/packages/core/src/bridge/actions/friend.ts b/packages/core/src/bridge/actions/friend.ts index 1a296311..3ca3a1cb 100644 --- a/packages/core/src/bridge/actions/friend.ts +++ b/packages/core/src/bridge/actions/friend.ts @@ -9,7 +9,7 @@ import type { OidbDeleteFriend, OidbFriendRequestAction, OidbSetFriendRemark, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/base'; import { OidbBase } from '../proto/proton/oidb'; export async function setFriendAddRequest(bridge: Bridge, uidOrFlag: string, approve: boolean): Promise { diff --git a/packages/core/src/bridge/actions/group-admin.ts b/packages/core/src/bridge/actions/group-admin.ts index 0a96922a..3ee61fab 100644 --- a/packages/core/src/bridge/actions/group-admin.ts +++ b/packages/core/src/bridge/actions/group-admin.ts @@ -23,7 +23,7 @@ import type { OidbRenameMember, OidbSetAdmin, OidbSpecialTitle, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/base'; // ─────────────── mute / un-mute ─────────────── diff --git a/packages/core/src/bridge/actions/group-album.ts b/packages/core/src/bridge/actions/group-album.ts index 75c8e135..27bf922d 100644 --- a/packages/core/src/bridge/actions/group-album.ts +++ b/packages/core/src/bridge/actions/group-album.ts @@ -17,7 +17,7 @@ import type { DoQunLikeResponse, DeleteMediasRequest, DeleteMediasResponse, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/group-album'; export interface GroupAlbumMediaResult { mediaList: any[]; diff --git a/packages/core/src/bridge/actions/group-file.ts b/packages/core/src/bridge/actions/group-file.ts index 5aaacf10..0e54081d 100644 --- a/packages/core/src/bridge/actions/group-file.ts +++ b/packages/core/src/bridge/actions/group-file.ts @@ -20,13 +20,15 @@ import type { OidbGroupFileViewReq, OidbGroupFileViewResp, OidbGroupSendFileReq, +} from '../proto/proton/oidb-actions/group-file'; +import type { OidbPrivateFileDownloadReq, OidbPrivateFileDownloadResp, OidbPrivateFileUploadReq, OidbPrivateFileUploadResp, NTV2RichMediaReq, NTV2RichMediaResp, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/media'; import type { FileUploadExt } from '../proto/proton/highway'; import { toHexUpper } from '../../utils/hex'; import { createLogger } from '../../utils/logger'; @@ -579,7 +581,7 @@ export async function uploadPrivateFile( // (or whether it returned nothing at all — which would point at // a request mismatch rather than a missing decoder). const rtpDump = Array.isArray(upload.rtpMediaPlatformUploadAddress) - ? JSON.stringify(upload.rtpMediaPlatformUploadAddress.map((e) => ({ + ? JSON.stringify(upload.rtpMediaPlatformUploadAddress.map((e: any) => ({ outIP: e.outIP, outPort: e.outPort, inIP: e.inIP, inPort: e.inPort, iPType: e.iPType, }))) diff --git a/packages/core/src/bridge/actions/group-message.ts b/packages/core/src/bridge/actions/group-message.ts index 048b0dc6..6c6786c3 100644 --- a/packages/core/src/bridge/actions/group-message.ts +++ b/packages/core/src/bridge/actions/group-message.ts @@ -4,24 +4,18 @@ // without producing a downstream observable event. import type { Bridge } from '../bridge'; -import { protoEncode } from '../../protobuf/decode'; import { runOidb, makeOidbEnvelope } from '../bridge-oidb'; -import { - C2CRecallRequestSchema, - GroupRecallRequestSchema, - SsoReadedReportReqSchema, -} from '../proto/oidb-action'; -import type { OidbEssence } from '../proto/proton/oidb-action'; +import type { C2CRecallRequest, GroupRecallRequest, OidbEssence, SsoReadedReportReq } from '../proto/proton/oidb-actions/base'; import { protobuf_encode } from '@snowluma/proton'; import { OidbBase } from '../proto/proton/oidb'; export async function recallGroupMessage(bridge: Bridge, groupId: number, sequence: number): Promise { - const request = protoEncode({ + const request = protobuf_encode({ type: 1, groupUin: groupId, info: { sequence, random: 0, field3: 0 }, settings: { field1: 0 }, - }, GroupRecallRequestSchema); + }); const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoGroupRecallMsg', request); if (!result.success) throw new Error(result.errorMessage || 'recall group message failed'); } @@ -31,7 +25,7 @@ export async function recallPrivateMessage( msgSeq: number, random: number, timestamp: number, ): Promise { const targetUid = await bridge.resolveUserUid(userUin); - const request = protoEncode({ + const request = protobuf_encode({ type: 1, targetUid, info: { @@ -44,7 +38,7 @@ export async function recallPrivateMessage( }, settings: { field1: false, field2: false }, field6: false, - }, C2CRecallRequestSchema); + }); const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoC2CRecallMsg', request); if (!result.success) throw new Error(result.errorMessage || 'recall private message failed'); } @@ -57,7 +51,7 @@ export async function markPrivateMessageRead( ): Promise { const uid = await bridge.resolveUserUid(userId); - const request = protoEncode({ + const request = protobuf_encode({ c2cList: [ { uid, @@ -65,7 +59,7 @@ export async function markPrivateMessageRead( lastReadSeq: BigInt(msgSeq), }, ], - }, SsoReadedReportReqSchema); + }); const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoReadedReport', request); @@ -79,14 +73,14 @@ export async function markGroupMessageRead( groupId: number, msgSeq: number, ): Promise { - const request = protoEncode({ + const request = protobuf_encode({ groupList: [ { groupUin: BigInt(groupId), lastReadSeq: BigInt(msgSeq), }, ], - }, SsoReadedReportReqSchema); + }); const result = await bridge.sendRawPacket('trpc.msg.msg_svc.MsgService.SsoReadedReport', request); diff --git a/packages/core/src/bridge/actions/interaction.ts b/packages/core/src/bridge/actions/interaction.ts index c72c31a3..c71d512c 100644 --- a/packages/core/src/bridge/actions/interaction.ts +++ b/packages/core/src/bridge/actions/interaction.ts @@ -11,7 +11,7 @@ import type { OidbGroupReaction, OidbLike, OidbPoke, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/base'; import { OidbBase } from '../proto/proton/oidb'; export async function sendPoke(bridge: Bridge, isGroup: boolean, peerUin: number, targetUin?: number): Promise { diff --git a/packages/core/src/bridge/actions/misc.ts b/packages/core/src/bridge/actions/misc.ts index 6ea2e22c..ff20c3ba 100644 --- a/packages/core/src/bridge/actions/misc.ts +++ b/packages/core/src/bridge/actions/misc.ts @@ -3,20 +3,17 @@ // related siblings, lift the whole group out into its own file. import type { Bridge } from '../bridge'; -import { protoDecode, protoEncode } from '../../protobuf/decode'; import { runOidb, makeOidbEnvelope } from '../bridge-oidb'; -import { - MiniAppShareReqSchema, - MiniAppShareRespSchema, -} from '../proto/oidb-action'; import type { + MiniAppShareReq, + MiniAppShareResp, Oidb0x112eReq, Oidb0x112eResp, Oidb0x990Req, Oidb0x990Resp, Oidb0xeb7Req, Oidb0xeb7Resp, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/base'; import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import { OidbBase } from '../proto/proton/oidb'; @@ -64,7 +61,7 @@ export async function getMiniAppArk( throw new Error(`unsupported type: ${type}, only support bili and weibo`); } - const request = protoEncode({ + const request = protobuf_encode({ sdkVersion: 'V1_PC_MINISDK_99.99.99_1_APP_A', body: { appid, @@ -74,7 +71,7 @@ export async function getMiniAppArk( jumpUrl, iconUrl, }, - }, MiniAppShareReqSchema); + }); const result = await bridge.sendRawPacket('LightAppSvc.mini_app_share.AdaptShareInfo', request); @@ -82,7 +79,7 @@ export async function getMiniAppArk( throw new Error(result.errorMessage || 'get mini app ark failed'); } - const decoded = protoDecode(result.responseData, MiniAppShareRespSchema); + const decoded = protobuf_decode(result.responseData); const jsonStr = decoded?.body?.jsonStr; if (!jsonStr) { diff --git a/packages/core/src/bridge/actions/profile.ts b/packages/core/src/bridge/actions/profile.ts index 96520d2c..a4789292 100644 --- a/packages/core/src/bridge/actions/profile.ts +++ b/packages/core/src/bridge/actions/profile.ts @@ -3,18 +3,13 @@ // All of these read/write fields on the self-uin via OIDB. import type { Bridge } from '../bridge'; -import { protoDecode, protoEncode } from '../../protobuf/decode'; import { runOidb, makeOidbEnvelope } from '../bridge-oidb'; import { fetchHighwaySession, uploadHighwayHttp } from '../highway/highway-client'; import { computeHashes, loadBinarySource } from '../highway/utils'; -import { - FaceroamOpReqSchema, - FaceroamOpRespSchema, - GroupAvatarExtraSchema, - SetStatusReqSchema, - SetStatusRespSchema, -} from '../proto/oidb-action'; import type { + FaceroamOpReq, + FaceroamOpResp, + GroupAvatarExtra, Oidb0x112aReq, Oidb0x112aResp, Oidb0x7edReq, @@ -24,7 +19,9 @@ import type { Oidb0xe17Req, Oidb0xe17Resp, OidbSetProfile, -} from '../proto/proton/oidb-action'; + SetStatusReq, + SetStatusResp, +} from '../proto/proton/oidb-actions/base'; import { resolveSelfUid } from './shared'; import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import { OidbBase } from '../proto/proton/oidb'; @@ -69,7 +66,7 @@ async function dispatchSetStatus( customExt?: { faceId: number; text: string; faceType: number }; }, ): Promise { - const request = protoEncode(value, SetStatusReqSchema); + const request = protobuf_encode(value); const result = await bridge.sendRawPacket('trpc.qq_new_tech.status_svc.StatusService.SetStatus', request); @@ -78,7 +75,7 @@ async function dispatchSetStatus( } if (result.responseData && result.responseData.length > 0) { - const resp = protoDecode(result.responseData, SetStatusRespSchema); + const resp = protobuf_decode(result.responseData); if (!resp) { throw new Error(result.errorMessage || 'set online status failed (network/timeout)'); } @@ -193,13 +190,13 @@ export async function setGroupAvatar( const hashes = computeHashes(loaded.bytes); const session = await fetchHighwaySession(bridge); - const extra = protoEncode({ + const extra = protobuf_encode({ type: 101, groupUin: groupId, field3: { field1: 1 }, field5: 3, field6: 1, - }, GroupAvatarExtraSchema); + }); await uploadHighwayHttp(bridge, session, 3000, loaded.bytes, hashes.md5, extra); } @@ -290,12 +287,12 @@ export async function fetchCustomFace(bridge: Bridge, count: number = 10): Promi field3: 1, field6: 1, }; - const request = protoEncode(req, FaceroamOpReqSchema); + const request = protobuf_encode(req); const result = await bridge.sendRawPacket('Faceroam.OpReq', request); if (!result.success || !result.gotResponse || !result.responseData) { throw new Error(result.errorMessage || 'fetch custom face failed'); } - const resp = protoDecode(result.responseData, FaceroamOpRespSchema); + const resp = protobuf_decode(result.responseData); if (!resp || (resp as any).retCode !== 0) { throw new Error(`fetch custom face error: ${(resp as any)?.message || 'unknown'}`); } diff --git a/packages/core/src/bridge/bridge-contacts.ts b/packages/core/src/bridge/bridge-contacts.ts index c2ae5d3e..7c63537f 100644 --- a/packages/core/src/bridge/bridge-contacts.ts +++ b/packages/core/src/bridge/bridge-contacts.ts @@ -3,9 +3,7 @@ import type { Bridge } from './bridge'; import type { DownloadRKeyInfo } from './bridge'; import type { FriendInfo, QQGroupInfo, GroupMemberInfo, UserProfileInfo, GroupRequestInfo } from './qq-info'; -import { protoDecode } from '../protobuf/decode'; import { runOidb, makeOidbEnvelope } from './bridge-oidb'; -import { AvatarInfoSchema } from './proto/oidb-action'; import type { OidbSvcTrpcTcp0xFD4_1Response, OidbSvcTrpcTcp0xFE5_2Response, @@ -20,9 +18,12 @@ import type { OidbUserInfoRequest, OidbUserInfoResponse, OidbGroupRequestList, + AvatarInfo, +} from './proto/proton/oidb-actions/base'; +import type { NTV2RichMediaReq, NTV2RichMediaResp, -} from './proto/proton/oidb-action'; +} from './proto/proton/oidb-actions/media'; import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; // --------------------------------------------------------------------------- @@ -261,7 +262,7 @@ export async function fetchUserProfile(bridge: Bridge, uin: number): Promise(avatarBytes); if (av?.url) info.avatar = av.url + '640'; } diff --git a/packages/core/src/bridge/bridge.ts b/packages/core/src/bridge/bridge.ts index 74b945c4..d6ca03fd 100644 --- a/packages/core/src/bridge/bridge.ts +++ b/packages/core/src/bridge/bridge.ts @@ -386,7 +386,7 @@ export class Bridge implements BridgeInterface { if (!response) { throw new Error('failed to decode SendMessageResponse'); } - if (response.result !== undefined && response.result !== 0) { + if (response.result != null && response.result !== 0) { throw new Error(`send group message rejected: result=${response.result} err=${response.errMsg ?? ''}`); } @@ -455,7 +455,7 @@ export class Bridge implements BridgeInterface { if (!response) { throw new Error('failed to decode SendMessageResponse'); } - if (response.result !== undefined && response.result !== 0) { + if (response.result != null && response.result !== 0) { throw new Error(`send private message rejected: result=${response.result} err=${response.errMsg ?? ''}`); } @@ -569,7 +569,7 @@ export class Bridge implements BridgeInterface { if (!response) { throw new Error('failed to decode SendMessageResponse'); } - if (response.result !== undefined && response.result !== 0) { + if (response.result != null && response.result !== 0) { throw new Error(`send c2c file message rejected: result=${response.result} err=${response.errMsg ?? ''}`); } diff --git a/packages/core/src/bridge/element-builder.ts b/packages/core/src/bridge/element-builder.ts index 96e7e78d..844e4b43 100644 --- a/packages/core/src/bridge/element-builder.ts +++ b/packages/core/src/bridge/element-builder.ts @@ -1,25 +1,21 @@ // Element Builder — converts internal MessageElement[] into proto Elem objects -// for encoding with protoEncode(SendMessageRequestSchema). +// for encoding with protobuf_encode. // Port of src/bridge/src/bridge_messages.cpp build_send_elems() import type { Bridge } from './bridge'; import type { MessageElement } from './events'; -import type { ProtoDecoded } from '../protobuf/decode'; import { protobuf_encode } from '@snowluma/proton'; -import { - ElemSchema, -} from './proto/element'; import type { MentionExtraSend, MarkdownData, } from './proto/proton/action'; -import type { GroupFileExtra } from './proto/proton/element'; +import type { Elem, GroupFileExtra } from './proto/proton/element'; import { uploadImageMsgInfo } from './highway/image-upload'; import { uploadPttMsgInfo } from './highway/ptt-upload'; import { uploadVideoMsgInfo } from './highway/video-upload'; import { hexToBytes } from './highway/pipeline'; -type ProtoElem = Partial>; +type ProtoElem = Partial; export interface SendContext { bridge: Bridge; diff --git a/packages/core/src/bridge/msg-push/context.ts b/packages/core/src/bridge/msg-push/context.ts index 556be152..2f9f31de 100644 --- a/packages/core/src/bridge/msg-push/context.ts +++ b/packages/core/src/bridge/msg-push/context.ts @@ -2,17 +2,14 @@ // One unified shape: notice decoders pick from `content`, message decoders // pick from `body` / `responseHead`. Decoders ignore fields they don't need. -import { protoDecode } from '../../protobuf/decode'; -import type { ProtoDecoded } from '../../protobuf/decode'; -import { - PushMsgSchema, MessageBodySchema, ResponseHeadSchema, ContentHeadSchema, -} from '../proto/message'; +import { protobuf_decode } from '@snowluma/proton'; +import type { ContentHead, MessageBody, PushMsg, ResponseHead } from '../proto/proton/message'; import type { PacketInfo } from '../../protocol/types'; import type { IdentityService } from '../identity-service'; -export type PushMsgBody = ProtoDecoded; -export type PushMsgResponseHead = ProtoDecoded; -export type PushMsgContentHead = ProtoDecoded; +export type PushMsgBody = MessageBody; +export type PushMsgResponseHead = ResponseHead; +export type PushMsgContentHead = ContentHead; export interface MsgPushHead { readonly msgType: number; @@ -36,7 +33,7 @@ export interface MsgPushContext { export function buildContext(pkt: PacketInfo, identity: IdentityService): MsgPushContext | null { if (pkt.body.length === 0) return null; - const push = protoDecode(Buffer.from(pkt.body), PushMsgSchema); + const push = protobuf_decode(Buffer.from(pkt.body)); if (!push?.message) return null; const msg = push.message; diff --git a/packages/core/src/bridge/msg-push/rich-body-decoder.ts b/packages/core/src/bridge/msg-push/rich-body-decoder.ts index c980d23b..579f5b12 100644 --- a/packages/core/src/bridge/msg-push/rich-body-decoder.ts +++ b/packages/core/src/bridge/msg-push/rich-body-decoder.ts @@ -4,23 +4,24 @@ // lookups, no I/O. The single small interface `decodeRichBody` hides // ~400 lines of per-element-type decoding behind it. -import { protoDecode } from '../../protobuf/decode'; -import type { ProtoDecoded } from '../../protobuf/decode'; -import { ElemSchema } from '../proto/element'; -import { - MentionExtraSchema, QFaceExtraSchema, QSmallFaceExtraSchema, - MsgInfoSchema, GroupFileExtraSchema, NotOnlineImageSchema, -} from '../proto/element'; -import { - MessageBodySchema, RichTextSchema, FileExtraSchema, -} from '../proto/message'; +import { protobuf_decode } from '@snowluma/proton'; +import type { + Elem, + GroupFileExtra, + MentionExtra, + MsgInfo, + NotOnlineImage, + QFaceExtra, + QSmallFaceExtra, +} from '../proto/proton/element'; +import type { FileExtra, MessageBody, RichText } from '../proto/proton/message'; import type { MessageElement } from '../events'; import { toHexUpper } from '../../utils/hex'; import { decompressData, makeImageUrl } from './helpers'; -type ElemDecoded = ProtoDecoded; -type RichTextDecoded = ProtoDecoded; -export type PushMsgBody = ProtoDecoded; +type ElemDecoded = Elem; +type RichTextDecoded = RichText; +export type PushMsgBody = MessageBody; export function decodeRichBody(body: PushMsgBody | undefined, isGroup: boolean): MessageElement[] { const elements: MessageElement[] = []; @@ -50,9 +51,9 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { // Text (with possible @ detection) if (elem.text) { const t = elem.text; - let mention: ProtoDecoded | null = null; + let mention: MentionExtra | null = null; if (t.pbReserve && t.pbReserve.length > 0) { - mention = protoDecode(t.pbReserve, MentionExtraSchema); + mention = protobuf_decode(t.pbReserve); } const hasAttr6 = t.attr6Buf && t.attr6Buf.length > 11; const hasMention = mention && (mention.type === 1 || mention.type === 2); @@ -172,7 +173,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { const val = te.elemValue; const len = (val[1] << 8) | val[2]; if (val.length >= 3 + len) { - const extra = protoDecode(val.subarray(3, 3 + len), GroupFileExtraSchema); + const extra = protobuf_decode(val.subarray(3, 3 + len)); if (extra?.inner?.info) { const info = extra.inner.info; result.push({ @@ -243,7 +244,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { if ((b & 0x80) === 0) break; } if (pos + length <= pb.length) { - const img = protoDecode(pb.subarray(pos, pos + length), NotOnlineImageSchema); + const img = protobuf_decode(pb.subarray(pos, pos + length)); if (img) { const me: MessageElement = { type: 'image', fileId: img.filePath ?? '', @@ -260,7 +261,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { skipNext = true; } else if (ce.pbElem && (svcType === 48 || bizType === 10 || bizType === 20 || bizType === 11 || bizType === 21 || bizType === 12 || bizType === 22)) { // NTQQ new protocol image/record/video - const info = protoDecode(ce.pbElem, MsgInfoSchema); + const info = protobuf_decode(ce.pbElem); if (info?.msgInfoBody && info.msgInfoBody.length > 0) { const body = info.msgInfoBody[0]; if (body.index?.info) { @@ -368,11 +369,11 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { } } else if (svcType === 33 && ce.pbElem) { // Small face - const extra = protoDecode(ce.pbElem, QSmallFaceExtraSchema); + const extra = protobuf_decode(ce.pbElem); if (extra) result.push({ type: 'face', faceId: extra.faceId ?? 0 }); } else if (svcType === 37 && ce.pbElem) { // Big face - const extra = protoDecode(ce.pbElem, QFaceExtraSchema); + const extra = protobuf_decode(ce.pbElem); if (extra?.qsid !== undefined) result.push({ type: 'face', faceId: extra.qsid }); skipNext = true; } @@ -443,7 +444,7 @@ function extractMsgContent(msgContent: Uint8Array, elements: MessageElement[]): // "incomplete metadata". After consolidating FileExtra to wrap // `NotOnlineFile` (Lagrange.Core's `FileExtra { File: NotOnlineFile }`), // this reads the right tags. - const extra = protoDecode(msgContent, FileExtraSchema); + const extra = protobuf_decode(msgContent); if (!extra?.file) return; const f = extra.file; if (!f.fileUuid) return; diff --git a/packages/core/src/bridge/proto/action.ts b/packages/core/src/bridge/proto/action.ts deleted file mode 100644 index f50ce46b..00000000 --- a/packages/core/src/bridge/proto/action.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type { ProtoSchema } from '../../protobuf/decode'; -import { ElemSchema } from './element'; - -// --- Routing --- - -export const RoutingC2CSchema = { - uin: { field: 1, type: 'uint32' as const }, - uid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const RoutingGroupSchema = { - groupCode: { field: 1, type: 'uint64' as const }, -} satisfies ProtoSchema; - -// `Trans0x211` is the c2c-file scene's routing header (Lagrange.Core -// `Routing/Trans0X211.cs`). See proton/action.ts:RoutingTrans0x211 -// for the rationale — c2c file sends *must* route through this slot, -// not `c2c`, or the server rejects them. -export const RoutingTrans0x211Schema = { - toUin: { field: 1, type: 'uint64' as const }, - ccCmd: { field: 2, type: 'uint32' as const }, - uid: { field: 8, type: 'string' as const }, -} satisfies ProtoSchema; - -export const RoutingHeadSchema = { - c2c: { field: 1, type: 'message' as const, schema: RoutingC2CSchema }, - grp: { field: 2, type: 'message' as const, schema: RoutingGroupSchema }, - trans0x211: { field: 15, type: 'message' as const, schema: RoutingTrans0x211Schema }, -} satisfies ProtoSchema; - -// --- Content Head (for send) --- - -export const SendContentHeadSchema = { - type: { field: 1, type: 'uint32' as const }, - subType: { field: 2, type: 'uint32' as const }, - c2cCmd: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- Message Control --- - -export const MessageControlSchema = { - msgFlag: { field: 1, type: 'int32' as const }, -} satisfies ProtoSchema; - -// --- RichText (for send — only elems) --- - -export const SendRichTextSchema = { - elems: { field: 2, type: 'repeated_message' as const, schema: ElemSchema }, -} satisfies ProtoSchema; - -// --- MessageBody (for send) --- - -export const SendMessageBodySchema = { - richText: { field: 1, type: 'message' as const, schema: SendRichTextSchema }, - // C2C file payload — serialised `FileExtra { file: NotOnlineFile }` - // bytes. See proton/action.ts:SendMessageBody for the WHY. - msgContent: { field: 2, type: 'bytes' as const }, -} satisfies ProtoSchema; - -// --- SendMessageRequest --- - -export const SendMessageRequestSchema = { - routingHead: { field: 1, type: 'message' as const, schema: RoutingHeadSchema }, - contentHead: { field: 2, type: 'message' as const, schema: SendContentHeadSchema }, - messageBody: { field: 3, type: 'message' as const, schema: SendMessageBodySchema }, - clientSequence: { field: 4, type: 'uint32' as const }, - random: { field: 5, type: 'uint32' as const }, - syncCookie: { field: 6, type: 'bytes' as const }, - via: { field: 8, type: 'uint32' as const }, - dataStatist: { field: 9, type: 'uint32' as const }, - ctrl: { field: 12, type: 'message' as const, schema: MessageControlSchema }, - multiSendSeq: { field: 14, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- SendMessageResponse --- - -export const SendMessageResponseSchema = { - result: { field: 1, type: 'int32' as const }, - errMsg: { field: 2, type: 'string' as const }, - timestamp1: { field: 3, type: 'uint32' as const }, - field10: { field: 10, type: 'uint32' as const }, - groupSequence: { field: 11, type: 'uint32' as const }, - timestamp2: { field: 12, type: 'uint32' as const }, - privateSequence: { field: 14, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- MentionExtra (for building @mention text element) --- - -export const MentionExtraSendSchema = { - type: { field: 3, type: 'int32' as const }, - uin: { field: 4, type: 'uint32' as const }, - field5: { field: 5, type: 'int32' as const }, - uid: { field: 9, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- MarkdownData --- - -export const MarkdownDataSchema = { - content: { field: 1, type: 'string' as const }, -} satisfies ProtoSchema; diff --git a/packages/core/src/bridge/proto/element.ts b/packages/core/src/bridge/proto/element.ts deleted file mode 100644 index 94f78dce..00000000 --- a/packages/core/src/bridge/proto/element.ts +++ /dev/null @@ -1,428 +0,0 @@ -// Proto schemas for QQ message elements. -// Port of src/bridge/include/bridge/proto/element.h - -import type { ProtoSchema } from '../../protobuf/decode'; - -// --- Nested / helper schemas --- - -export const CustomFacePbReserveSchema = { - subType: { field: 1, type: 'int32' as const }, - summary: { field: 9, type: 'string' as const }, -} satisfies ProtoSchema; - -export const NotOnlineImagePbReserve2Schema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'int32' as const }, - field4: { field: 4, type: 'int32' as const }, - field5: { field: 5, type: 'int32' as const }, - field7: { field: 7, type: 'string' as const }, -} satisfies ProtoSchema; - -export const NotOnlineImagePbReserveSchema = { - subType: { field: 1, type: 'int32' as const }, - field3: { field: 3, type: 'int32' as const }, - field4: { field: 4, type: 'int32' as const }, - summary: { field: 8, type: 'string' as const }, - field10: { field: 10, type: 'int32' as const }, - field20: { field: 20, type: 'message' as const, schema: NotOnlineImagePbReserve2Schema }, - url: { field: 30, type: 'string' as const }, - md5Str: { field: 31, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- Core element schemas --- - -export const TextElemSchema = { - str: { field: 1, type: 'string' as const }, - link: { field: 2, type: 'string' as const }, - attr6Buf: { field: 3, type: 'bytes' as const }, - attr7Buf: { field: 4, type: 'bytes' as const }, - buf: { field: 11, type: 'bytes' as const }, - pbReserve: { field: 12, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const FaceElemSchema = { - index: { field: 1, type: 'int32' as const }, - oldData: { field: 2, type: 'bytes' as const }, - buf: { field: 11, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const OnlineImageSchema = { - guid: { field: 1, type: 'bytes' as const }, - filePath: { field: 2, type: 'bytes' as const }, - oldVerSendFile: { field: 3, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const NotOnlineImageSchema = { - filePath: { field: 1, type: 'string' as const }, - fileLen: { field: 2, type: 'uint32' as const }, - downloadPath: { field: 3, type: 'string' as const }, - oldVerSendFile: { field: 4, type: 'bytes' as const }, - imgType: { field: 5, type: 'int32' as const }, - previewsImage: { field: 6, type: 'bytes' as const }, - picMd5: { field: 7, type: 'bytes' as const }, - picHeight: { field: 8, type: 'uint32' as const }, - picWidth: { field: 9, type: 'uint32' as const }, - resId: { field: 10, type: 'string' as const }, - flag: { field: 11, type: 'bytes' as const }, - thumbUrl: { field: 12, type: 'string' as const }, - original: { field: 13, type: 'int32' as const }, - bigUrl: { field: 14, type: 'string' as const }, - origUrl: { field: 15, type: 'string' as const }, - bizType: { field: 16, type: 'int32' as const }, - result: { field: 17, type: 'int32' as const }, - index: { field: 18, type: 'int32' as const }, - opFaceBuf: { field: 19, type: 'bytes' as const }, - oldPicMd5: { field: 20, type: 'bool' as const }, - thumbWidth: { field: 21, type: 'int32' as const }, - thumbHeight: { field: 22, type: 'int32' as const }, - fileId: { field: 23, type: 'int32' as const }, - showLen: { field: 24, type: 'uint32' as const }, - downloadLen: { field: 25, type: 'uint32' as const }, - x400Url: { field: 26, type: 'string' as const }, - x400Width: { field: 27, type: 'int32' as const }, - x400Height: { field: 28, type: 'int32' as const }, - pbRes: { field: 29, type: 'message' as const, schema: NotOnlineImagePbReserveSchema }, -} satisfies ProtoSchema; - -export const TransElemSchema = { - elemType: { field: 1, type: 'int32' as const }, - elemValue: { field: 2, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const MarketFaceSchema = { - faceName: { field: 1, type: 'string' as const }, - itemType: { field: 2, type: 'uint32' as const }, - faceInfo: { field: 3, type: 'uint32' as const }, - faceId: { field: 4, type: 'bytes' as const }, - tabId: { field: 5, type: 'uint32' as const }, - subType: { field: 6, type: 'uint32' as const }, - key: { field: 7, type: 'bytes' as const }, - param: { field: 8, type: 'bytes' as const }, - mediaType: { field: 9, type: 'uint32' as const }, - imageWidth: { field: 10, type: 'uint32' as const }, - imageHeight: { field: 11, type: 'uint32' as const }, - mobileParam: { field: 12, type: 'bytes' as const }, - pbReserve: { field: 13, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const CustomFaceSchema = { - guid: { field: 1, type: 'bytes' as const }, - filePath: { field: 2, type: 'string' as const }, - shortcut: { field: 3, type: 'string' as const }, - buffer: { field: 4, type: 'bytes' as const }, - flag: { field: 5, type: 'bytes' as const }, - oldData: { field: 6, type: 'bytes' as const }, - fileId: { field: 7, type: 'uint32' as const }, - serverIp: { field: 8, type: 'int32' as const }, - serverPort: { field: 9, type: 'int32' as const }, - fileType: { field: 10, type: 'int32' as const }, - signature: { field: 11, type: 'bytes' as const }, - useful: { field: 12, type: 'int32' as const }, - md5: { field: 13, type: 'bytes' as const }, - thumbUrl: { field: 14, type: 'string' as const }, - bigUrl: { field: 15, type: 'string' as const }, - origUrl: { field: 16, type: 'string' as const }, - bizType: { field: 17, type: 'int32' as const }, - repeatIndex: { field: 18, type: 'int32' as const }, - repeatImage: { field: 19, type: 'int32' as const }, - imageType: { field: 20, type: 'int32' as const }, - index: { field: 21, type: 'int32' as const }, - width: { field: 22, type: 'int32' as const }, - height: { field: 23, type: 'int32' as const }, - source: { field: 24, type: 'int32' as const }, - size: { field: 25, type: 'uint32' as const }, - origin: { field: 26, type: 'int32' as const }, - thumbWidth: { field: 27, type: 'int32' as const }, - thumbHeight: { field: 28, type: 'int32' as const }, - showLen: { field: 29, type: 'int32' as const }, - downloadLen: { field: 30, type: 'int32' as const }, - x400Url: { field: 31, type: 'string' as const }, - x400Width: { field: 32, type: 'int32' as const }, - x400Height: { field: 33, type: 'int32' as const }, - pbRes: { field: 34, type: 'message' as const, schema: CustomFacePbReserveSchema }, -} satisfies ProtoSchema; - -export const RichMsgSchema = { - template1: { field: 1, type: 'bytes' as const }, - serviceId: { field: 2, type: 'int32' as const }, - msgResId: { field: 3, type: 'bytes' as const }, - rand: { field: 4, type: 'int32' as const }, - seq: { field: 5, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const GroupFileElemSchema = { - filename: { field: 1, type: 'string' as const }, - fileSize: { field: 2, type: 'uint64' as const }, - fileId: { field: 3, type: 'string' as const }, - batchId: { field: 4, type: 'string' as const }, - fileKey: { field: 5, type: 'string' as const }, - mark: { field: 6, type: 'bytes' as const }, - sequence: { field: 7, type: 'uint64' as const }, - batchItemId: { field: 8, type: 'bytes' as const }, - feedMsgTime: { field: 9, type: 'int32' as const }, - pbReserve: { field: 10, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const ExtraInfoSchema = { - nick: { field: 1, type: 'bytes' as const }, - groupCard: { field: 2, type: 'bytes' as const }, - level: { field: 3, type: 'int32' as const }, - flags: { field: 4, type: 'int32' as const }, - groupMask: { field: 5, type: 'int32' as const }, - msgTailId: { field: 6, type: 'int32' as const }, - senderTitle: { field: 7, type: 'bytes' as const }, - apnsTips: { field: 8, type: 'bytes' as const }, - uin: { field: 9, type: 'uint64' as const }, - msgStateFlag: { field: 10, type: 'int32' as const }, - apnsSoundType: { field: 11, type: 'int32' as const }, - newGroupFlag: { field: 12, type: 'int32' as const }, -} satisfies ProtoSchema; - -export const VideoFileSchema = { - fileUuid: { field: 1, type: 'string' as const }, - fileMd5: { field: 2, type: 'bytes' as const }, - fileName: { field: 3, type: 'string' as const }, - fileFormat: { field: 4, type: 'int32' as const }, - fileTime: { field: 5, type: 'int32' as const }, - fileSize: { field: 6, type: 'int32' as const }, - thumbWidth: { field: 7, type: 'int32' as const }, - thumbHeight: { field: 8, type: 'int32' as const }, - thumbFileMd5: { field: 9, type: 'bytes' as const }, - source: { field: 10, type: 'bytes' as const }, - thumbFileSize:{ field: 11, type: 'int32' as const }, - busiType: { field: 12, type: 'int32' as const }, - fromChatType: { field: 13, type: 'int32' as const }, - toChatType: { field: 14, type: 'int32' as const }, - supportProgressive: { field: 15, type: 'bool' as const }, - fileWidth: { field: 16, type: 'int32' as const }, - fileHeight: { field: 17, type: 'int32' as const }, - subBusiType: { field: 18, type: 'int32' as const }, - videoAttr: { field: 19, type: 'int32' as const }, - pbReserve: { field: 24, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const SrcMsgSchema = { - origSeqs: { field: 1, type: 'repeated_uint32' as const }, - senderUin: { field: 2, type: 'uint64' as const }, - time: { field: 3, type: 'int32' as const }, - flag: { field: 4, type: 'int32' as const }, - elemsRaw: { field: 5, type: 'repeated_bytes' as const }, - type: { field: 6, type: 'int32' as const }, - richMsg: { field: 7, type: 'bytes' as const }, - pbReserve: { field: 8, type: 'bytes' as const }, - sourceMsg: { field: 9, type: 'bytes' as const }, - toUin: { field: 10, type: 'uint64' as const }, - troopName: { field: 11, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const LightAppElemSchema = { - data: { field: 1, type: 'bytes' as const }, - msgResid: { field: 2, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const CommonElemSchema = { - serviceType: { field: 1, type: 'int32' as const }, - pbElem: { field: 2, type: 'bytes' as const }, - businessType: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const GeneralFlagsSchema = { - bubbleDiyTextId: { field: 1, type: 'int32' as const }, - groupFlagNew: { field: 2, type: 'int32' as const }, - uin: { field: 3, type: 'uint64' as const }, - longTextFlag: { field: 6, type: 'int32' as const }, - longTextResId: { field: 7, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- Elem (union of all element types) --- - -export const ElemSchema = { - text: { field: 1, type: 'message' as const, schema: TextElemSchema }, - face: { field: 2, type: 'message' as const, schema: FaceElemSchema }, - onlineImage: { field: 3, type: 'message' as const, schema: OnlineImageSchema }, - notOnlineImage: { field: 4, type: 'message' as const, schema: NotOnlineImageSchema }, - transElem: { field: 5, type: 'message' as const, schema: TransElemSchema }, - marketFace: { field: 6, type: 'message' as const, schema: MarketFaceSchema }, - customFace: { field: 8, type: 'message' as const, schema: CustomFaceSchema }, - richMsg: { field: 12, type: 'message' as const, schema: RichMsgSchema }, - groupFile: { field: 13, type: 'message' as const, schema: GroupFileElemSchema }, - extraInfo: { field: 16, type: 'message' as const, schema: ExtraInfoSchema }, - videoFile: { field: 19, type: 'message' as const, schema: VideoFileSchema }, - generalFlags: { field: 37, type: 'message' as const, schema: GeneralFlagsSchema }, - srcMsg: { field: 45, type: 'message' as const, schema: SrcMsgSchema }, - lightApp: { field: 51, type: 'message' as const, schema: LightAppElemSchema }, - commonElem: { field: 53, type: 'message' as const, schema: CommonElemSchema }, -} satisfies ProtoSchema; - -// --- Extra decode types (for CommonElem.pbElem sub-messages) --- - -export const MentionExtraSchema = { - type: { field: 3, type: 'int32' as const }, - uin: { field: 4, type: 'uint32' as const }, - field5: { field: 5, type: 'int32' as const }, - uid: { field: 9, type: 'string' as const }, -} satisfies ProtoSchema; - -export const QFaceExtraSchema = { - packId: { field: 1, type: 'string' as const }, - stickerId: { field: 2, type: 'string' as const }, - qsid: { field: 3, type: 'int32' as const }, - sourceType: { field: 4, type: 'int32' as const }, - stickerType: { field: 5, type: 'int32' as const }, - resultId: { field: 6, type: 'string' as const }, - text: { field: 7, type: 'string' as const }, - randomType: { field: 9, type: 'int32' as const }, -} satisfies ProtoSchema; - -export const QSmallFaceExtraSchema = { - faceId: { field: 1, type: 'uint32' as const }, - preview: { field: 2, type: 'string' as const }, - preview2: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- NTQQ MsgInfo types (CommonElem service_type 48) --- - -export const FileTypeSchema = { - type: { field: 1, type: 'uint32' as const }, - picFormat: { field: 2, type: 'uint32' as const }, - videoFormat: { field: 3, type: 'uint32' as const }, - voiceFormat: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const FileInfoSchema = { - fileSize: { field: 1, type: 'uint32' as const }, - fileHash: { field: 2, type: 'string' as const }, - fileSha1: { field: 3, type: 'string' as const }, - fileName: { field: 4, type: 'string' as const }, - type: { field: 5, type: 'message' as const, schema: FileTypeSchema }, - width: { field: 6, type: 'uint32' as const }, - height: { field: 7, type: 'uint32' as const }, - time: { field: 8, type: 'uint32' as const }, - original: { field: 9, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const IndexNodeSchema = { - info: { field: 1, type: 'message' as const, schema: FileInfoSchema }, - fileUuid: { field: 2, type: 'string' as const }, - storeId: { field: 3, type: 'uint32' as const }, - uploadTime: { field: 4, type: 'uint32' as const }, - ttl: { field: 5, type: 'uint32' as const }, - subType: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const PicUrlExtInfoSchema = { - originalParameter: { field: 1, type: 'string' as const }, - bigParameter: { field: 2, type: 'string' as const }, - thumbParameter: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const PictureInfoSchema = { - urlPath: { field: 1, type: 'string' as const }, - ext: { field: 2, type: 'message' as const, schema: PicUrlExtInfoSchema }, - domain: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const PicExtDataSchema = { - subType: { field: 1, type: 'uint32' as const }, - textSummary: { field: 9, type: 'string' as const }, -} satisfies ProtoSchema; - -export const PicExtBizInfoSchema = { - bizType: { field: 1, type: 'uint32' as const }, - textSummary: { field: 2, type: 'string' as const }, - bytesPbReserveC2c: { field: 11, type: 'bytes' as const }, - extData: { field: 12, type: 'message' as const, schema: PicExtDataSchema }, - fromScene: { field: 1001, type: 'uint32' as const }, - toScene: { field: 1002, type: 'uint32' as const }, - oldFileId: { field: 1003, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const VideoExtBizInfoSchema = { - fromScene: { field: 1, type: 'uint32' as const }, - toScene: { field: 2, type: 'uint32' as const }, - bytesPbReserve: { field: 3, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const PttExtBizInfoSchema = { - srcUin: { field: 1, type: 'uint64' as const }, - pttScene: { field: 2, type: 'uint32' as const }, - pttType: { field: 3, type: 'uint32' as const }, - changeVoice: { field: 4, type: 'uint32' as const }, - waveform: { field: 5, type: 'bytes' as const }, - autoConvertText: { field: 6, type: 'uint32' as const }, - bytesReserve: { field: 11, type: 'bytes' as const }, - bytesPbReserve: { field: 12, type: 'bytes' as const }, - bytesGeneralFlags: { field: 13, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const ExtBizInfoSchema = { - pic: { field: 1, type: 'message' as const, schema: PicExtBizInfoSchema }, - video: { field: 2, type: 'message' as const, schema: VideoExtBizInfoSchema }, - ptt: { field: 3, type: 'message' as const, schema: PttExtBizInfoSchema }, - busiType: { field: 10, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const C2cSourceSchema = { - friendUid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const TroopSourceSchema = { - groupUin: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const HashSumSchema = { - bytesPbReserveC2c: { field: 201, type: 'message' as const, schema: C2cSourceSchema }, - troopSource: { field: 202, type: 'message' as const, schema: TroopSourceSchema }, -} satisfies ProtoSchema; - -export const MsgInfoBodySchema = { - index: { field: 1, type: 'message' as const, schema: IndexNodeSchema }, - picture: { field: 2, type: 'message' as const, schema: PictureInfoSchema }, - fileExist: { field: 5, type: 'bool' as const }, - hashSum: { field: 6, type: 'message' as const, schema: HashSumSchema }, -} satisfies ProtoSchema; - -export const MsgInfoSchema = { - msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: MsgInfoBodySchema }, - extBizInfo: { field: 2, type: 'message' as const, schema: ExtBizInfoSchema }, -} satisfies ProtoSchema; - -// --- GroupFileExtra (TransElem type=24) --- - -// Field numbers cross-checked against NapCat (component.ts:146) + -// acidify (GroupFileExtra.kt:Inner.Info). Old schema had fileSha at 5 -// / extInfoString at 6 / fileMd5 at 7 which mismatched the real wire -// shape — the server rejected the chat post with `result=79` because -// fileSha bytes were landing where it expected a uint32 (field 5). -// See proton/element.ts for the WHY comment. -export const GroupFileInfoSchema = { - busId: { field: 1, type: 'uint32' as const }, - fileId: { field: 2, type: 'string' as const }, - fileSize: { field: 3, type: 'uint64' as const }, - fileName: { field: 4, type: 'string' as const }, - field5: { field: 5, type: 'uint32' as const }, - fileSha: { field: 6, type: 'bytes' as const }, - extInfoString: { field: 7, type: 'string' as const }, - fileMd5: { field: 8, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const GroupFileExtraInnerSchema = { - info: { field: 2, type: 'message' as const, schema: GroupFileInfoSchema }, -} satisfies ProtoSchema; - -export const GroupFileExtraSchema = { - field1: { field: 1, type: 'uint32' as const }, - fileName: { field: 2, type: 'string' as const }, - display: { field: 3, type: 'string' as const }, - inner: { field: 7, type: 'message' as const, schema: GroupFileExtraInnerSchema }, -} satisfies ProtoSchema; - -// --- Preserve (for message receipt info) --- - -export const PreserveSchema = { - messageId: { field: 3, type: 'uint64' as const }, - senderUid: { field: 6, type: 'string' as const }, - receiverUid: { field: 7, type: 'string' as const }, - clientSequence: { field: 8, type: 'uint32' as const }, -} satisfies ProtoSchema; diff --git a/packages/core/src/bridge/proto/highway.ts b/packages/core/src/bridge/proto/highway.ts deleted file mode 100644 index 11a583e7..00000000 --- a/packages/core/src/bridge/proto/highway.ts +++ /dev/null @@ -1,343 +0,0 @@ -// Proto schemas for highway upload protocol. -// Port of src/bridge/include/bridge/proto/highway.h + action.h (HttpConn) - -import type { ProtoSchema } from '../../protobuf/decode'; -import { - IndexNodeSchema, - PictureInfoSchema, - HashSumSchema, - PicExtBizInfoSchema, - VideoExtBizInfoSchema, - PttExtBizInfoSchema, -} from '../proto/element'; - -// --- DataHighwayHead --- - -export const DataHighwayHeadSchema = { - version: { field: 1, type: 'uint32' as const }, - uin: { field: 2, type: 'string' as const }, - command: { field: 3, type: 'string' as const }, - seq: { field: 4, type: 'uint32' as const }, - retryTimes:{ field: 5, type: 'uint32' as const }, - appId: { field: 6, type: 'uint32' as const }, - dataFlag: { field: 7, type: 'uint32' as const }, - commandId: { field: 8, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const SegHeadSchema = { - serviceId: { field: 1, type: 'uint32' as const }, - filesize: { field: 2, type: 'uint64' as const }, - dataOffset: { field: 3, type: 'uint64' as const }, - dataLength: { field: 4, type: 'uint32' as const }, - retCode: { field: 5, type: 'uint32' as const }, - serviceTicket: { field: 6, type: 'bytes' as const }, - flag: { field: 7, type: 'uint32' as const }, - md5: { field: 8, type: 'bytes' as const }, - fileMd5: { field: 9, type: 'bytes' as const }, - cacheAddr: { field: 10, type: 'uint32' as const }, - cachePort: { field: 13, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const LoginSigHeadSchema = { - loginSigType: { field: 1, type: 'uint32' as const }, - appId: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const ReqDataHighwayHeadSchema = { - msgBaseHead: { field: 1, type: 'message' as const, schema: DataHighwayHeadSchema }, - msgSegHead: { field: 2, type: 'message' as const, schema: SegHeadSchema }, - bytesReqExtendInfo: { field: 3, type: 'bytes' as const }, - timestamp: { field: 4, type: 'uint64' as const }, - msgLoginSigHead: { field: 5, type: 'message' as const, schema: LoginSigHeadSchema }, -} satisfies ProtoSchema; - -export const RespDataHighwayHeadSchema = { - msgBaseHead: { field: 1, type: 'message' as const, schema: DataHighwayHeadSchema }, - msgSegHead: { field: 2, type: 'message' as const, schema: SegHeadSchema }, - errorCode: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- Highway extend (NTV2RichMediaHighwayExt) --- - -export const HighwayDomainSchema = { - isEnable: { field: 1, type: 'bool' as const }, - ip: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const HighwayIPv4Schema = { - domain: { field: 1, type: 'message' as const, schema: HighwayDomainSchema }, - port: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const HighwayNetworkSchema = { - ipv4s: { field: 1, type: 'repeated_message' as const, schema: HighwayIPv4Schema }, -} satisfies ProtoSchema; - -export const HighwayHashSchema = { - fileSha1: { field: 1, type: 'repeated_bytes' as const }, -} satisfies ProtoSchema; - -export const HighwayMsgInfoBodySchema = { - index: { field: 1, type: 'message' as const, schema: IndexNodeSchema }, - picture: { field: 2, type: 'message' as const, schema: PictureInfoSchema }, - fileExist: { field: 5, type: 'bool' as const }, - hashSum: { field: 6, type: 'message' as const, schema: HashSumSchema }, -} satisfies ProtoSchema; - -export const NTV2RichMediaHighwayExtSchema = { - fileUuid: { field: 1, type: 'string' as const }, - uKey: { field: 2, type: 'string' as const }, - network: { field: 5, type: 'message' as const, schema: HighwayNetworkSchema }, - msgInfoBody: { field: 6, type: 'repeated_message' as const, schema: HighwayMsgInfoBodySchema }, - blockSize: { field: 10, type: 'uint32' as const }, - hash: { field: 11, type: 'message' as const, schema: HighwayHashSchema }, -} satisfies ProtoSchema; - -// --- File upload extend (group/private file highway) --- - -export const FileUploadUrlSchema = { - unknown: { field: 1, type: 'int32' as const }, - host: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const FileUploadHostSchema = { - url: { field: 1, type: 'message' as const, schema: FileUploadUrlSchema }, - port: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const FileUploadHostConfigSchema = { - hosts: { field: 200, type: 'repeated_message' as const, schema: FileUploadHostSchema }, -} satisfies ProtoSchema; - -export const FileUploadNameInfoSchema = { - fileName: { field: 100, type: 'string' as const }, -} satisfies ProtoSchema; - -export const FileUploadClientInfoSchema = { - clientType: { field: 100, type: 'int32' as const }, - appId: { field: 200, type: 'string' as const }, - terminalType: { field: 300, type: 'int32' as const }, - clientVer: { field: 400, type: 'string' as const }, - unknown: { field: 600, type: 'int32' as const }, -} satisfies ProtoSchema; - -export const FileUploadFileEntrySchema = { - fileSize: { field: 100, type: 'uint64' as const }, - md5: { field: 200, type: 'bytes' as const }, - checkKey: { field: 300, type: 'bytes' as const }, - md5S2: { field: 400, type: 'bytes' as const }, - fileId: { field: 600, type: 'string' as const }, - uploadKey: { field: 700, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const FileUploadBusiInfoSchema = { - busId: { field: 1, type: 'int32' as const }, - senderUin: { field: 100, type: 'uint64' as const }, - receiverUin: { field: 200, type: 'uint64' as const }, - groupCode: { field: 400, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const FileUploadEntrySchema = { - busiBuff: { field: 100, type: 'message' as const, schema: FileUploadBusiInfoSchema }, - fileEntry: { field: 200, type: 'message' as const, schema: FileUploadFileEntrySchema }, - clientInfo: { field: 300, type: 'message' as const, schema: FileUploadClientInfoSchema }, - fileNameInfo: { field: 400, type: 'message' as const, schema: FileUploadNameInfoSchema }, - host: { field: 500, type: 'message' as const, schema: FileUploadHostConfigSchema }, -} satisfies ProtoSchema; - -export const FileUploadExtSchema = { - unknown1: { field: 1, type: 'int32' as const }, - unknown2: { field: 2, type: 'int32' as const }, - unknown3: { field: 3, type: 'int32' as const }, - entry: { field: 100, type: 'message' as const, schema: FileUploadEntrySchema }, - unknown200: { field: 200, type: 'int32' as const }, -} satisfies ProtoSchema; - -// --- Encodable MsgInfo (for embedding in message element) --- - -export const EncodableMediaExtBizInfoSchema = { - pic: { field: 1, type: 'message' as const, schema: PicExtBizInfoSchema }, - video: { field: 2, type: 'message' as const, schema: VideoExtBizInfoSchema }, - ptt: { field: 3, type: 'message' as const, schema: PttExtBizInfoSchema }, - busiType: { field: 10, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const EncodableMediaMsgInfoSchema = { - msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: HighwayMsgInfoBodySchema }, - extBizInfo: { field: 2, type: 'message' as const, schema: EncodableMediaExtBizInfoSchema }, -} satisfies ProtoSchema; - -// --- HttpConn.0x6ff_501 (highway session) --- - -export const HttpConnSchema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'int32' as const }, - field3: { field: 3, type: 'int32' as const }, - field4: { field: 4, type: 'int32' as const }, - field6: { field: 6, type: 'int32' as const }, - serviceTypes: { field: 7, type: 'repeated_uint32' as const }, - field9: { field: 9, type: 'int32' as const }, - field10: { field: 10, type: 'int32' as const }, - field11: { field: 11, type: 'int32' as const }, - ver: { field: 15, type: 'string' as const }, -} satisfies ProtoSchema; - -export const HttpConn0x6FF501RequestSchema = { - httpConn: { field: 0x501, type: 'message' as const, schema: HttpConnSchema }, -} satisfies ProtoSchema; - -export const ServerAddrSchema = { - type: { field: 1, type: 'uint32' as const }, - ip: { field: 2, type: 'uint32' as const }, // fixed32 as uint32 - port: { field: 3, type: 'uint32' as const }, - area: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const ServerInfoSchema = { - serviceType: { field: 1, type: 'uint32' as const }, - serverAddrs: { field: 2, type: 'repeated_message' as const, schema: ServerAddrSchema }, -} satisfies ProtoSchema; - -export const HttpConnResponseSchema = { - sigSession: { field: 1, type: 'bytes' as const }, - sessionKey: { field: 2, type: 'bytes' as const }, - serverInfos: { field: 3, type: 'repeated_message' as const, schema: ServerInfoSchema }, -} satisfies ProtoSchema; - -export const HttpConn0x6FF501ResponseSchema = { - httpConn: { field: 0x501, type: 'message' as const, schema: HttpConnResponseSchema }, -} satisfies ProtoSchema; - -// --- NTV2 Upload Request (for OIDB 0x11C4/0x11C5) --- - -export const NTV2FileTypeSchema = { - type: { field: 1, type: 'uint32' as const }, - picFormat: { field: 2, type: 'uint32' as const }, - videoFormat: { field: 3, type: 'uint32' as const }, - voiceFormat: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2FileInfoSchema = { - fileSize: { field: 1, type: 'uint32' as const }, - fileHash: { field: 2, type: 'string' as const }, - fileSha1: { field: 3, type: 'string' as const }, - fileName: { field: 4, type: 'string' as const }, - type: { field: 5, type: 'message' as const, schema: NTV2FileTypeSchema }, - width: { field: 6, type: 'uint32' as const }, - height: { field: 7, type: 'uint32' as const }, - time: { field: 8, type: 'uint32' as const }, - original: { field: 9, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2UploadInfoSchema = { - fileInfo: { field: 1, type: 'message' as const, schema: NTV2FileInfoSchema }, - subFileType: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// The NTV2 upload request + response carry the same ExtBizInfo shape that -// element-side incoming-message decoding uses. Pulling those schemas in -// directly (instead of redefining stub copies) keeps the round-trip -// `server response → finalizeMediaMsgInfo → commonElem.pbElem` from -// silently dropping fields the QQ NT server later validates against — -// the video `fromScene`/`toScene` drop was already responsible for c2c -// `result=79` rejections on `send_private_msg [{type:'video'}]`. -export const NTV2ExtBizInfoSchema = { - pic: { field: 1, type: 'message' as const, schema: PicExtBizInfoSchema }, - video: { field: 2, type: 'message' as const, schema: VideoExtBizInfoSchema }, - ptt: { field: 3, type: 'message' as const, schema: PttExtBizInfoSchema }, - busiType: { field: 10, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2UploadReqSchema = { - uploadInfo: { field: 1, type: 'repeated_message' as const, schema: NTV2UploadInfoSchema }, - tryFastUploadCompleted: { field: 2, type: 'bool' as const }, - srvSendMsg: { field: 3, type: 'bool' as const }, - clientRandomId: { field: 4, type: 'uint64' as const }, - compatQmsgSceneType: { field: 5, type: 'uint32' as const }, - extBizInfo: { field: 6, type: 'message' as const, schema: NTV2ExtBizInfoSchema }, - clientSeq: { field: 7, type: 'uint32' as const }, - noNeedCompatMsg: { field: 8, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const NTV2C2CUserInfoSchema = { - accountType: { field: 1, type: 'uint32' as const }, - targetUid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const NTV2GroupInfoSchema = { - groupUin: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2UploadSceneInfoSchema = { - requestType: { field: 101, type: 'uint32' as const }, - businessType: { field: 102, type: 'uint32' as const }, - sceneType: { field: 200, type: 'uint32' as const }, - c2c: { field: 201, type: 'message' as const, schema: NTV2C2CUserInfoSchema }, - group: { field: 202, type: 'message' as const, schema: NTV2GroupInfoSchema }, -} satisfies ProtoSchema; - -export const NTV2CommonHeadSchema = { - requestId: { field: 1, type: 'uint32' as const }, - command: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2ClientMetaSchema = { - agentType: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2UploadReqHeadSchema = { - common: { field: 1, type: 'message' as const, schema: NTV2CommonHeadSchema }, - scene: { field: 2, type: 'message' as const, schema: NTV2UploadSceneInfoSchema }, - client: { field: 3, type: 'message' as const, schema: NTV2ClientMetaSchema }, -} satisfies ProtoSchema; - -export const NTV2UploadRichMediaReqSchema = { - reqHead: { field: 1, type: 'message' as const, schema: NTV2UploadReqHeadSchema }, - upload: { field: 2, type: 'message' as const, schema: NTV2UploadReqSchema }, -} satisfies ProtoSchema; - -// --- NTV2 Upload Response --- - -export const NTV2IPv4Schema = { - outIp: { field: 1, type: 'uint32' as const }, - outPort: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2SubFileInfoRespSchema = { - subType: { field: 1, type: 'uint32' as const }, - uKey: { field: 2, type: 'string' as const }, - uKeyTtl: { field: 3, type: 'uint32' as const }, - ipv4s: { field: 4, type: 'repeated_message' as const, schema: NTV2IPv4Schema }, -} satisfies ProtoSchema; - -export const NTV2UploadRespMsgInfoSchema = { - msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: HighwayMsgInfoBodySchema }, - extBizInfo: { field: 2, type: 'message' as const, schema: NTV2ExtBizInfoSchema }, -} satisfies ProtoSchema; - -export const NTV2UploadRespBodySchema = { - uKey: { field: 1, type: 'string' as const }, - uKeyTtl: { field: 2, type: 'uint32' as const }, - ipv4s: { field: 3, type: 'repeated_message' as const, schema: NTV2IPv4Schema }, - msgSeq: { field: 5, type: 'uint64' as const }, - msgInfo: { field: 6, type: 'message' as const, schema: NTV2UploadRespMsgInfoSchema }, - subFileInfos: { field: 10, type: 'repeated_message' as const, schema: NTV2SubFileInfoRespSchema }, -} satisfies ProtoSchema; - -export const NTV2UploadRespHeadSchema = { - common: { field: 1, type: 'message' as const, schema: NTV2CommonHeadSchema }, - retCode: { field: 2, type: 'uint32' as const }, - message: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const NTV2UploadRichMediaRespSchema = { - respHead: { field: 1, type: 'message' as const, schema: NTV2UploadRespHeadSchema }, - upload: { field: 2, type: 'message' as const, schema: NTV2UploadRespBodySchema }, -} satisfies ProtoSchema; - -// (The legacy `GroupAvatarUploadExtSchema` definition that briefly -// lived here in PR #31 was removed: it was a residual artifact of an -// alternative `setGroupAvatar` implementation that got dropped during -// review — the canonical Lagrange-derived `GroupAvatarExtraSchema` -// further up this file is the one `actions/profile.setGroupAvatar` -// actually uses.) diff --git a/packages/core/src/bridge/proto/longmsg.ts b/packages/core/src/bridge/proto/longmsg.ts deleted file mode 100644 index 2ac29beb..00000000 --- a/packages/core/src/bridge/proto/longmsg.ts +++ /dev/null @@ -1,68 +0,0 @@ -import type { ProtoSchema } from '../../protobuf/decode'; -import { PushMsgBodySchema } from './message'; - -export const LongMsgUidSchema = { - uid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const LongMsgSettingsSchema = { - field1: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, - field4: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const SendLongMsgInfoSchema = { - type: { field: 1, type: 'uint32' as const }, - uid: { field: 2, type: 'message' as const, schema: LongMsgUidSchema }, - groupUin: { field: 3, type: 'uint32' as const }, - payload: { field: 4, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const SendLongMsgReqSchema = { - info: { field: 2, type: 'message' as const, schema: SendLongMsgInfoSchema }, - settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema }, -} satisfies ProtoSchema; - -export const SendLongMsgRespResultSchema = { - resId: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const SendLongMsgRespSchema = { - result: { field: 2, type: 'message' as const, schema: SendLongMsgRespResultSchema }, - settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema }, -} satisfies ProtoSchema; - -export const RecvLongMsgInfoSchema = { - uid: { field: 1, type: 'message' as const, schema: LongMsgUidSchema }, - resId: { field: 2, type: 'string' as const }, - acquire: { field: 3, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const RecvLongMsgReqSchema = { - info: { field: 1, type: 'message' as const, schema: RecvLongMsgInfoSchema }, - settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema }, -} satisfies ProtoSchema; - -export const RecvLongMsgRespResultSchema = { - resId: { field: 3, type: 'string' as const }, - payload: { field: 4, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const RecvLongMsgRespSchema = { - result: { field: 1, type: 'message' as const, schema: RecvLongMsgRespResultSchema }, - settings: { field: 15, type: 'message' as const, schema: LongMsgSettingsSchema }, -} satisfies ProtoSchema; - -export const LongMsgContentSchema = { - msgBody: { field: 1, type: 'repeated_message' as const, schema: PushMsgBodySchema }, -} satisfies ProtoSchema; - -export const LongMsgActionSchema = { - actionCommand: { field: 1, type: 'string' as const }, - actionData: { field: 2, type: 'message' as const, schema: LongMsgContentSchema }, -} satisfies ProtoSchema; - -export const LongMsgResultSchema = { - action: { field: 2, type: 'repeated_message' as const, schema: LongMsgActionSchema }, -} satisfies ProtoSchema; diff --git a/packages/core/src/bridge/proto/message.ts b/packages/core/src/bridge/proto/message.ts deleted file mode 100644 index 6b51a157..00000000 --- a/packages/core/src/bridge/proto/message.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Proto schemas for message envelopes (PushMsg). -// Port of src/bridge/include/bridge/proto/message.h - -import type { ProtoSchema } from '../../protobuf/decode'; -import { ElemSchema } from './element'; - -// --- ResponseHead.Grp --- - -export const ResponseGrpSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - memberName: { field: 2, type: 'string' as const }, - groupName: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const ResponseForwardSchema = { - friendName: { field: 6, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- ResponseHead --- - -export const ResponseHeadSchema = { - fromUin: { field: 1, type: 'uint32' as const }, - fromUid: { field: 2, type: 'string' as const }, - type: { field: 3, type: 'uint32' as const }, - sigMap: { field: 4, type: 'uint32' as const }, - toUin: { field: 5, type: 'uint32' as const }, - toUid: { field: 6, type: 'string' as const }, - forward: { field: 7, type: 'message' as const, schema: ResponseForwardSchema }, - grp: { field: 8, type: 'message' as const, schema: ResponseGrpSchema }, -} satisfies ProtoSchema; - -// --- ContentHead --- - -export const ContentHeadSchema = { - msgType: { field: 1, type: 'uint32' as const }, - subType: { field: 2, type: 'uint32' as const }, - divSeq: { field: 3, type: 'uint32' as const }, - msgId: { field: 4, type: 'uint32' as const }, - sequence: { field: 5, type: 'uint32' as const }, - timestamp: { field: 6, type: 'uint32' as const }, - field7: { field: 7, type: 'uint64' as const }, - newId: { field: 12, type: 'uint64' as const }, -} satisfies ProtoSchema; - -// --- Ptt (voice) --- - -export const PttSchema = { - fileType: { field: 1, type: 'uint32' as const }, - fileId: { field: 2, type: 'uint64' as const }, - fileUuid: { field: 3, type: 'bytes' as const }, - fileMd5: { field: 4, type: 'bytes' as const }, - fileName: { field: 5, type: 'string' as const }, - fileSize: { field: 6, type: 'uint32' as const }, - groupFileKey: { field: 10, type: 'string' as const }, - fileKey: { field: 14, type: 'bytes' as const }, - time: { field: 19, type: 'uint32' as const }, - format: { field: 29, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- NotOnlineFile (C2C file) --- - -// Field numbers per `dev/Lagrange.Core/.../Component/NotOnlineFile.cs`. -// fields 9 (subcmd), 50 (dangerEvel), 55 (expireTime) are required -// on c2c file SEND (the receiver ignores them); the identification -// fields (1/3/4/5/6/57) are read both directions. -export const NotOnlineFileSchema = { - fileType: { field: 1, type: 'uint32' as const }, - fileUuid: { field: 3, type: 'string' as const }, - fileMd5: { field: 4, type: 'bytes' as const }, - fileName: { field: 5, type: 'string' as const }, - fileSize: { field: 6, type: 'uint64' as const }, - subcmd: { field: 9, type: 'uint32' as const }, - dangerEvel: { field: 50, type: 'uint32' as const }, - expireTime: { field: 55, type: 'uint32' as const }, - fileHash: { field: 57, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- RichText --- - -export const RichTextSchema = { - elems: { field: 2, type: 'repeated_message' as const, schema: ElemSchema }, - notOnlineFile: { field: 3, type: 'message' as const, schema: NotOnlineFileSchema }, - ptt: { field: 4, type: 'message' as const, schema: PttSchema }, -} satisfies ProtoSchema; - -// --- MessageBody --- - -export const MessageBodySchema = { - richText: { field: 1, type: 'message' as const, schema: RichTextSchema }, - msgContent: { field: 2, type: 'bytes' as const }, -} satisfies ProtoSchema; - -// --- FileExtra (for C2C file in msg_content) --- -// -// `FileExtra { file: NotOnlineFile }` is the wrapper QQ-NT actually -// uses at `MessageBody.msgContent` for c2c file sends. The previous -// `FileExtraInfoSchema` had fileSize=1, fileName=2, fileMd5=3, -// fileUuid=4, fileHash=5 — every field at the wrong tag, so received -// c2c-file payloads silently failed to parse. Consolidated to the -// shared `NotOnlineFileSchema` (Lagrange.Core's `FileExtra.cs` does -// the same — `[ProtoMember(1)] public NotOnlineFile? File`). - -export const FileExtraSchema = { - file: { field: 1, type: 'message' as const, schema: NotOnlineFileSchema }, -} satisfies ProtoSchema; - -// --- PushMsgBody --- - -export const PushMsgBodySchema = { - responseHead: { field: 1, type: 'message' as const, schema: ResponseHeadSchema }, - contentHead: { field: 2, type: 'message' as const, schema: ContentHeadSchema }, - body: { field: 3, type: 'message' as const, schema: MessageBodySchema }, -} satisfies ProtoSchema; - -// --- PushMsg (top-level) --- - -export const PushMsgSchema = { - message: { field: 1, type: 'message' as const, schema: PushMsgBodySchema }, - status: { field: 3, type: 'int32' as const }, -} satisfies ProtoSchema; diff --git a/packages/core/src/bridge/proto/notify.ts b/packages/core/src/bridge/proto/notify.ts deleted file mode 100644 index 2121ddad..00000000 --- a/packages/core/src/bridge/proto/notify.ts +++ /dev/null @@ -1,245 +0,0 @@ -// Proto schemas for notification types. -// Port of src/bridge/include/bridge/proto/notify.h - -import type { ProtoSchema } from '../../protobuf/decode'; - -export const OperatorField1Schema = { - uid: { field: 1, type: 'string' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'bytes' as const }, - field4: { field: 4, type: 'uint32' as const }, - field5: { field: 5, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const OperatorInfoSchema = { - operatorField: { field: 1, type: 'message' as const, schema: OperatorField1Schema }, -} satisfies ProtoSchema; - -export const GroupChangeSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - flag: { field: 2, type: 'uint32' as const }, - memberUid: { field: 3, type: 'string' as const }, - decreaseType: { field: 4, type: 'uint32' as const }, - operatorBytes: { field: 5, type: 'bytes' as const }, - increaseType: { field: 6, type: 'uint32' as const }, - field7: { field: 7, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const GroupAdminExtraSchema = { - adminUid: { field: 1, type: 'string' as const }, - isPromote: { field: 2, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const GroupAdminBodySchema = { - extraDisable: { field: 1, type: 'message' as const, schema: GroupAdminExtraSchema }, - extraEnable: { field: 2, type: 'message' as const, schema: GroupAdminExtraSchema }, -} satisfies ProtoSchema; - -export const GroupAdminSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - flag: { field: 2, type: 'uint32' as const }, - isPromote: { field: 3, type: 'bool' as const }, - body: { field: 4, type: 'message' as const, schema: GroupAdminBodySchema }, -} satisfies ProtoSchema; - -export const InvitationInnerSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, - field4: { field: 4, type: 'uint32' as const }, - targetUid: { field: 5, type: 'string' as const }, - invitorUid: { field: 6, type: 'string' as const }, - field7: { field: 7, type: 'uint32' as const }, - field9: { field: 9, type: 'uint32' as const }, - field10: { field: 10, type: 'bytes' as const }, - field11: { field: 11, type: 'uint32' as const }, - field12: { field: 12, type: 'string' as const }, -} satisfies ProtoSchema; - -export const InvitationInfoSchema = { - inner: { field: 1, type: 'message' as const, schema: InvitationInnerSchema }, -} satisfies ProtoSchema; - -export const GroupInvitationSchema = { - cmd: { field: 1, type: 'int32' as const }, - info: { field: 2, type: 'message' as const, schema: InvitationInfoSchema }, -} satisfies ProtoSchema; - -export const GroupInviteSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, - field4: { field: 4, type: 'uint32' as const }, - invitorUid: { field: 5, type: 'string' as const }, - hashes: { field: 6, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const GroupJoinSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - targetUid: { field: 3, type: 'string' as const }, - field4: { field: 4, type: 'uint32' as const }, - field6: { field: 6, type: 'uint32' as const }, - field7: { field: 7, type: 'string' as const }, - field8: { field: 8, type: 'uint32' as const }, - field9: { field: 9, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const FriendRequestInfoSchema = { - targetUid: { field: 1, type: 'string' as const }, - sourceUid: { field: 2, type: 'string' as const }, - newSource: { field: 5, type: 'string' as const }, - message: { field: 10, type: 'string' as const }, - source: { field: 11, type: 'string' as const }, -} satisfies ProtoSchema; - -export const FriendRequestSchema = { - info: { field: 1, type: 'message' as const, schema: FriendRequestInfoSchema }, -} satisfies ProtoSchema; - -export const FriendRecallTipInfoSchema = { - tip: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const FriendRecallInfoSchema = { - fromUid: { field: 1, type: 'string' as const }, - toUid: { field: 2, type: 'string' as const }, - clientSequence: { field: 3, type: 'uint32' as const }, - newId: { field: 4, type: 'uint64' as const }, - time: { field: 5, type: 'uint32' as const }, - random: { field: 6, type: 'uint32' as const }, - pkgNum: { field: 7, type: 'uint32' as const }, - pkgIndex: { field: 8, type: 'uint32' as const }, - divSeq: { field: 9, type: 'uint32' as const }, - tipInfo: { field: 13, type: 'message' as const, schema: FriendRecallTipInfoSchema }, -} satisfies ProtoSchema; - -export const FriendRecallSchema = { - info: { field: 1, type: 'message' as const, schema: FriendRecallInfoSchema }, - instId: { field: 2, type: 'uint32' as const }, - appId: { field: 3, type: 'uint32' as const }, - longMessageFlag: { field: 4, type: 'uint32' as const }, - reserved: { field: 5, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const GroupMuteStateSchema = { - targetUid: { field: 1, type: 'string' as const }, - duration: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const GroupMuteDataSchema = { - timestamp: { field: 1, type: 'uint32' as const }, - type: { field: 2, type: 'uint32' as const }, - state: { field: 3, type: 'message' as const, schema: GroupMuteStateSchema }, -} satisfies ProtoSchema; - -export const GroupMuteSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - subType: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, - operatorUid: { field: 4, type: 'string' as const }, - data: { field: 5, type: 'message' as const, schema: GroupMuteDataSchema }, -} satisfies ProtoSchema; - -export const RecallMessageSchema = { - sequence: { field: 1, type: 'uint32' as const }, - time: { field: 2, type: 'uint32' as const }, - random: { field: 3, type: 'uint32' as const }, - type: { field: 4, type: 'uint32' as const }, - flag: { field: 5, type: 'uint32' as const }, - authorUid: { field: 6, type: 'string' as const }, -} satisfies ProtoSchema; - -export const GroupRecallTipInfoSchema = { - tip: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const GroupRecallSchema = { - operatorUid: { field: 1, type: 'string' as const }, - recallMessages: { field: 3, type: 'repeated_message' as const, schema: RecallMessageSchema }, - userDef: { field: 5, type: 'bytes' as const }, - groupType: { field: 6, type: 'int32' as const }, - opType: { field: 7, type: 'int32' as const }, - tipInfo: { field: 9, type: 'message' as const, schema: GroupRecallTipInfoSchema }, -} satisfies ProtoSchema; - -export const TemplParamSchema = { - name: { field: 1, type: 'string' as const }, - value: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const GeneralGrayTipInfoSchema = { - busiType: { field: 1, type: 'uint64' as const }, - busiId: { field: 2, type: 'uint64' as const }, - ctrlFlag: { field: 3, type: 'uint32' as const }, - c2cType: { field: 4, type: 'uint32' as const }, - serviceType: { field: 5, type: 'uint32' as const }, - templId: { field: 6, type: 'uint64' as const }, - msgTemplParam: { field: 7, type: 'repeated_message' as const, schema: TemplParamSchema }, - content: { field: 8, type: 'string' as const }, -} satisfies ProtoSchema; - -export const EssenceMessageSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - msgSequence: { field: 2, type: 'uint32' as const }, - random: { field: 3, type: 'uint32' as const }, - setFlag: { field: 4, type: 'uint32' as const }, - memberUin: { field: 5, type: 'uint32' as const }, - operatorUin: { field: 6, type: 'uint32' as const }, - timestamp: { field: 7, type: 'uint32' as const }, - msgSequence2: { field: 8, type: 'uint32' as const }, - operatorNickname: { field: 9, type: 'string' as const }, - memberNickname: { field: 10, type: 'string' as const }, - setFlag2: { field: 11, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NotifyMessageBodySchema = { - type: { field: 1, type: 'uint32' as const }, - groupUin: { field: 4, type: 'uint32' as const }, - eventParam: { field: 5, type: 'bytes' as const }, - recall: { field: 11, type: 'message' as const, schema: GroupRecallSchema }, - field13: { field: 13, type: 'uint32' as const }, - operatorUid: { field: 21, type: 'string' as const }, - generalGrayTip: { field: 26, type: 'message' as const, schema: GeneralGrayTipInfoSchema }, - essenceMessage: { field: 33, type: 'message' as const, schema: EssenceMessageSchema }, - msgSequence: { field: 37, type: 'uint32' as const }, - field39: { field: 39, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// ─── Event0x2DC subType=16: GroupMsgEmojiLike ────────────────────────────── -// -// QQ pushes a Group message emoji reaction (someone tapped an emoji on a -// message in a group). The payload nesting matches NapCat's transformer -// (packet/transformer/proto/message/message.ts → GroupReactNotify); the -// outermost message is preceded by a 7-byte prefix that must be stripped -// before decoding (see the call site). - -export const GroupReactionDataInnerDataTargetSchema = { - seq: { field: 1, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const GroupReactionDataContentSchema = { - code: { field: 1, type: 'string' as const }, - count: { field: 3, type: 'uint32' as const }, - operatorUid: { field: 4, type: 'string' as const }, - type: { field: 5, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const GroupReactionDataInnerDataSchema = { - groupReactionTarget: { field: 2, type: 'message' as const, schema: GroupReactionDataInnerDataTargetSchema }, - groupReactionDataContent: { field: 3, type: 'message' as const, schema: GroupReactionDataContentSchema }, -} satisfies ProtoSchema; - -export const GroupReactionDataInnerSchema = { - data: { field: 1, type: 'message' as const, schema: GroupReactionDataInnerDataSchema }, -} satisfies ProtoSchema; - -export const GroupReactionDataSchema = { - data: { field: 1, type: 'message' as const, schema: GroupReactionDataInnerSchema }, -} satisfies ProtoSchema; - -export const GroupReactNotifySchema = { - groupUin: { field: 4, type: 'uint64' as const }, - field13: { field: 13, type: 'uint32' as const }, - groupReactionData: { field: 44, type: 'message' as const, schema: GroupReactionDataSchema }, -} satisfies ProtoSchema; diff --git a/packages/core/src/bridge/proto/oidb-action.ts b/packages/core/src/bridge/proto/oidb-action.ts deleted file mode 100644 index 90b63484..00000000 --- a/packages/core/src/bridge/proto/oidb-action.ts +++ /dev/null @@ -1,1539 +0,0 @@ -// Proto schemas for OIDB action requests. -// Port of src/bridge/include/bridge/proto/oidb.h (action-related structs) -// and src/bridge/src/bridge.cpp (recall message structs) - -import type { ProtoSchema } from '../../protobuf/decode'; - -// --- 0x1253_1: Mute group member --- - -export const OidbMuteMemberBodySchema = { - targetUid: { field: 1, type: 'string' as const }, - duration: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbMuteMemberSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - type: { field: 2, type: 'uint32' as const }, - body: { field: 3, type: 'message' as const, schema: OidbMuteMemberBodySchema }, -} satisfies ProtoSchema; - -// --- 0x89A_0: Mute group all --- - -export const OidbMuteAllStateSchema = { - state: { field: 17, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbMuteAllSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - muteState: { field: 2, type: 'message' as const, schema: OidbMuteAllStateSchema }, -} satisfies ProtoSchema; - -// --- 0x89A_0: Set group add option --- - -export const Oidb0x89a_0AddOptionSettingsSchema = { - addType: { field: 16, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x89a_0AddOptionSchema = { - groupUin: { field: 1, type: 'uint64' as const }, - settings: { field: 2, type: 'message' as const, schema: Oidb0x89a_0AddOptionSettingsSchema }, - field12: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0x89A_0: Set group search --- - -export const Oidb0x89a_0SearchSchema = { - groupUin: { field: 1, type: 'uint64' as const }, - settings: { field: 2, type: 'bytes' as const }, - field12: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0x8A0_1: Kick group member --- - -export const OidbKickMemberSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - targetUid: { field: 3, type: 'string' as const }, - rejectAddRequest:{ field: 4, type: 'bool' as const }, - reason: { field: 5, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- 0x1097_1: Leave group --- - -export const OidbLeaveGroupSchema = { - groupUin: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0xB5D_44: Friend add request --- - -export const OidbFriendRequestActionSchema = { - accept: { field: 1, type: 'uint32' as const }, - targetUid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- 0x126B_0: Delete friend --- - -export const OidbDeleteFriendField2Field3Schema = { - field1: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbDeleteFriendField2Schema = { - field1: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'message' as const, schema: OidbDeleteFriendField2Field3Schema }, -} satisfies ProtoSchema; - -export const OidbDeleteFriendField1Schema = { - targetUid: { field: 1, type: 'string' as const }, - field2: { field: 2, type: 'message' as const, schema: OidbDeleteFriendField2Schema }, - block: { field: 3, type: 'bool' as const }, - field4: { field: 4, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbDeleteFriendSchema = { - field1: { field: 1, type: 'message' as const, schema: OidbDeleteFriendField1Schema }, -} satisfies ProtoSchema; - -// --- 0x10C8: Group request action --- - -export const OidbGroupRequestBodySchema = { - sequence: { field: 1, type: 'uint64' as const }, - eventType: { field: 2, type: 'uint32' as const }, - groupUin: { field: 3, type: 'uint32' as const }, - message: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupRequestActionSchema = { - accept: { field: 1, type: 'uint32' as const }, - body: { field: 2, type: 'message' as const, schema: OidbGroupRequestBodySchema }, -} satisfies ProtoSchema; - -// --- 0xED3_1: Poke --- - -export const OidbPokeSchema = { - uin: { field: 1, type: 'uint32' as const }, - groupUin: { field: 2, type: 'uint32' as const }, - friendUin: { field: 5, type: 'uint32' as const }, - ext: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0xEAC: Group essence --- - -export const OidbEssenceSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - sequence: { field: 2, type: 'uint32' as const }, - random: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0x1096_1: Set group admin --- - -export const OidbSetAdminSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - uid: { field: 2, type: 'string' as const }, - isAdmin: { field: 3, type: 'bool' as const }, -} satisfies ProtoSchema; - -// --- 0x8FC_3: Set group card (rename member) --- - -export const OidbRenameMemberBodySchema = { - targetUid: { field: 1, type: 'string' as const }, - targetName: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbRenameMemberSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - body: { field: 2, type: 'message' as const, schema: OidbRenameMemberBodySchema }, -} satisfies ProtoSchema; - -// --- 0x89A_15: Rename group --- - -export const OidbRenameGroupBodySchema = { - targetName: { field: 1, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbRenameGroupSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - body: { field: 2, type: 'message' as const, schema: OidbRenameGroupBodySchema }, -} satisfies ProtoSchema; - -// --- 0x8FC_2: Set group special title --- - -export const OidbSpecialTitleBodySchema = { - targetUid: { field: 1, type: 'string' as const }, - specialTitle:{ field: 5, type: 'string' as const }, - expireTime: { field: 6, type: 'int32' as const }, -} satisfies ProtoSchema; - -export const OidbSpecialTitleSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - body: { field: 2, type: 'message' as const, schema: OidbSpecialTitleBodySchema }, -} satisfies ProtoSchema; - -// --- 0x7E5_104: Send like --- - -export const OidbLikeSchema = { - targetUin: { field: 1, type: 'uint32' as const }, - count: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0x10C0_1 / 0x10C0_2: Group request list --- - -export const OidbGroupRequestListSchema = { - count: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0xFE1_2: User profile info --- - -export const OidbUserInfoKeySchema = { - key: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// Field 2 USED to be `field2: uint32 = 0`, but newer QQ NT versions -// reinterpret field 2 as `uid: string` / `openid: string` and reject -// the request with "one of uid/openid is invaild" when a varint 0 -// shows up there. NapCat's schema (Oidb.0XFE1_2.ts) only emits `uin` -// and `key[]`, so we match that exactly. -export const OidbUserInfoRequestSchema = { - uin: { field: 1, type: 'uint32' as const }, - keys: { field: 3, type: 'repeated_message' as const, schema: OidbUserInfoKeySchema }, -} satisfies ProtoSchema; - -export const OidbTwoNumberSchema = { - number1: { field: 1, type: 'uint32' as const }, - number2: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbBytePropertySchema = { - code: { field: 1, type: 'uint32' as const }, - value: { field: 2, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const OidbUserInfoPropertySchema = { - numberProperties: { field: 1, type: 'repeated_message' as const, schema: OidbTwoNumberSchema }, - bytesProperties: { field: 2, type: 'repeated_message' as const, schema: OidbBytePropertySchema }, -} satisfies ProtoSchema; - -export const OidbUserInfoResponseBodySchema = { - uid: { field: 1, type: 'string' as const }, - properties: { field: 2, type: 'message' as const, schema: OidbUserInfoPropertySchema }, - uin: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbUserInfoResponseSchema = { - body: { field: 1, type: 'message' as const, schema: OidbUserInfoResponseBodySchema }, -} satisfies ProtoSchema; - -export const AvatarInfoSchema = { - url: { field: 5, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- FD4_1: Friend list request body fields --- - -export const OidbFriendListNumberSchema = { - numbers: { field: 1, type: 'repeated_uint32' as const }, -} satisfies ProtoSchema; - -export const OidbFriendListBodyItemSchema = { - type: { field: 1, type: 'uint32' as const }, - number: { field: 2, type: 'message' as const, schema: OidbFriendListNumberSchema }, -} satisfies ProtoSchema; - -export const OidbFriendListNextUinSchema = { - uin: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbFriendListRequestSchema = { - friendCount: { field: 2, type: 'uint32' as const }, - field4: { field: 4, type: 'uint32' as const }, - nextUin: { field: 5, type: 'message' as const, schema: OidbFriendListNextUinSchema }, - field6: { field: 6, type: 'uint32' as const }, - field7: { field: 7, type: 'uint32' as const }, - body: { field: 10001, type: 'repeated_message' as const, schema: OidbFriendListBodyItemSchema }, - field10002: { field: 10002, type: 'repeated_uint32' as const }, - field10003: { field: 10003, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- FE5_2: Group list request body (config fields) --- - -export const OidbGroupListConfig1Schema = { - groupOwner: { field: 1, type: 'bool' as const }, - field2: { field: 2, type: 'bool' as const }, - memberMax: { field: 3, type: 'bool' as const }, - memberCount: { field: 4, type: 'bool' as const }, - groupName: { field: 5, type: 'bool' as const }, - field8: { field: 8, type: 'bool' as const }, - field9: { field: 9, type: 'bool' as const }, - field10: { field: 10, type: 'bool' as const }, - field11: { field: 11, type: 'bool' as const }, - field12: { field: 12, type: 'bool' as const }, - field13: { field: 13, type: 'bool' as const }, - field14: { field: 14, type: 'bool' as const }, - field15: { field: 15, type: 'bool' as const }, - field16: { field: 16, type: 'bool' as const }, - field17: { field: 17, type: 'bool' as const }, - field18: { field: 18, type: 'bool' as const }, - question: { field: 19, type: 'bool' as const }, - field20: { field: 20, type: 'bool' as const }, - field22: { field: 22, type: 'bool' as const }, - field23: { field: 23, type: 'bool' as const }, - field24: { field: 24, type: 'bool' as const }, - field25: { field: 25, type: 'bool' as const }, - field26: { field: 26, type: 'bool' as const }, - field27: { field: 27, type: 'bool' as const }, - field28: { field: 28, type: 'bool' as const }, - field29: { field: 29, type: 'bool' as const }, - field30: { field: 30, type: 'bool' as const }, - field31: { field: 31, type: 'bool' as const }, - field32: { field: 32, type: 'bool' as const }, - field5001: { field: 5001, type: 'bool' as const }, - field5002: { field: 5002, type: 'bool' as const }, - field5003: { field: 5003, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbGroupListConfig2Schema = { - field1: { field: 1, type: 'bool' as const }, - field2: { field: 2, type: 'bool' as const }, - field3: { field: 3, type: 'bool' as const }, - field4: { field: 4, type: 'bool' as const }, - field5: { field: 5, type: 'bool' as const }, - field6: { field: 6, type: 'bool' as const }, - field7: { field: 7, type: 'bool' as const }, - field8: { field: 8, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbGroupListConfig3Schema = { - field5: { field: 5, type: 'bool' as const }, - field6: { field: 6, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbGroupListConfigSchema = { - config1: { field: 1, type: 'message' as const, schema: OidbGroupListConfig1Schema }, - config2: { field: 2, type: 'message' as const, schema: OidbGroupListConfig2Schema }, - config3: { field: 3, type: 'message' as const, schema: OidbGroupListConfig3Schema }, -} satisfies ProtoSchema; - -export const OidbGroupListRequestSchema = { - config: { field: 1, type: 'message' as const, schema: OidbGroupListConfigSchema }, -} satisfies ProtoSchema; - -// --- FE7_3: Group member list request body --- - -export const OidbGroupMemberListBodySchema = { - memberName: { field: 10, type: 'bool' as const }, - memberCard: { field: 11, type: 'bool' as const }, - level: { field: 12, type: 'bool' as const }, - field13: { field: 13, type: 'bool' as const }, - field16: { field: 16, type: 'bool' as const }, - specialTitle: { field: 17, type: 'bool' as const }, - field18: { field: 18, type: 'bool' as const }, - field20: { field: 20, type: 'bool' as const }, - field21: { field: 21, type: 'bool' as const }, - joinTimestamp: { field: 100, type: 'bool' as const }, - lastMsgTimestamp: { field: 101, type: 'bool' as const }, - shutUpTimestamp: { field: 102, type: 'bool' as const }, - field103: { field: 103, type: 'bool' as const }, - field104: { field: 104, type: 'bool' as const }, - field105: { field: 105, type: 'bool' as const }, - field106: { field: 106, type: 'bool' as const }, - permission: { field: 107, type: 'bool' as const }, - field200: { field: 200, type: 'bool' as const }, - field201: { field: 201, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbGroupMemberListRequestSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, - body: { field: 4, type: 'message' as const, schema: OidbGroupMemberListBodySchema }, - token: { field: 15, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- Group recall message (trpc.msg.msg_svc.MsgService.SsoGroupRecallMsg) --- - -export const GroupRecallInfoSchema = { - sequence: { field: 1, type: 'uint32' as const }, - random: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const GroupRecallSettingsSchema = { - field1: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const GroupRecallRequestSchema = { - type: { field: 1, type: 'uint32' as const }, - groupUin: { field: 2, type: 'uint32' as const }, - info: { field: 3, type: 'message' as const, schema: GroupRecallInfoSchema }, - settings: { field: 4, type: 'message' as const, schema: GroupRecallSettingsSchema }, -} satisfies ProtoSchema; - -// --- C2C (private) recall message (trpc.msg.msg_svc.MsgService.SsoC2CRecallMsg) --- - -export const C2CRecallInfoSchema = { - clientSequence: { field: 1, type: 'uint32' as const }, - random: { field: 2, type: 'uint32' as const }, - messageId: { field: 3, type: 'uint64' as const }, - timestamp: { field: 4, type: 'uint32' as const }, - field5: { field: 5, type: 'uint32' as const }, - messageSequence: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const C2CRecallSettingsSchema = { - field1: { field: 1, type: 'bool' as const }, - field2: { field: 2, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const C2CRecallRequestSchema = { - type: { field: 1, type: 'uint32' as const }, - targetUid:{ field: 3, type: 'string' as const }, - info: { field: 4, type: 'message' as const, schema: C2CRecallInfoSchema }, - settings: { field: 5, type: 'message' as const, schema: C2CRecallSettingsSchema }, - field6: { field: 6, type: 'bool' as const }, -} satisfies ProtoSchema; - -// --- 0x9082_1: Set group reaction --- - -export const OidbGroupReactionSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - sequence: { field: 2, type: 'uint32' as const }, - code: { field: 3, type: 'string' as const }, - // 1 = legacy QQ face (short numeric id like "76"), 2 = unicode emoji - // (decimal codepoint string like "128516" for 😄). Omitting this - // field used to make unicode reactions fail server-side because the - // server defaulted to type=1 and couldn't resolve a 6-digit code. - type: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -// --- 0x6D8_1: Group file list --- - -export const OidbGroupFileListReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - appId: { field: 2, type: 'uint32' as const }, - targetDirectory: { field: 3, type: 'string' as const }, - fileCount: { field: 5, type: 'uint32' as const }, - sortBy: { field: 9, type: 'uint32' as const }, - startIndex: { field: 13, type: 'uint32' as const }, - field17: { field: 17, type: 'uint32' as const }, - field18: { field: 18, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileViewReqSchema = { - list: { field: 2, type: 'message' as const, schema: OidbGroupFileListReqSchema }, -} satisfies ProtoSchema; - -export const OidbGroupFileListFolderRespSchema = { - folderId: { field: 1, type: 'string' as const }, - parentDirectoryId: { field: 2, type: 'string' as const }, - folderName: { field: 3, type: 'string' as const }, - createTime: { field: 4, type: 'uint32' as const }, - modifiedTime: { field: 5, type: 'uint32' as const }, - creatorUin: { field: 6, type: 'uint32' as const }, - creatorName: { field: 7, type: 'string' as const }, - totalFileCount: { field: 8, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileListFileRespSchema = { - fileId: { field: 1, type: 'string' as const }, - fileName: { field: 2, type: 'string' as const }, - fileSize: { field: 3, type: 'uint64' as const }, - busId: { field: 4, type: 'uint32' as const }, - uploadedTime: { field: 6, type: 'uint32' as const }, - expireTime: { field: 7, type: 'uint32' as const }, - modifiedTime: { field: 8, type: 'uint32' as const }, - downloadedTimes: { field: 9, type: 'uint32' as const }, - uploaderName: { field: 14, type: 'string' as const }, - uploaderUin: { field: 15, type: 'uint32' as const }, - parentDirectory: { field: 16, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileListItemRespSchema = { - type: { field: 1, type: 'uint32' as const }, - folderInfo: { field: 2, type: 'message' as const, schema: OidbGroupFileListFolderRespSchema }, - fileInfo: { field: 3, type: 'message' as const, schema: OidbGroupFileListFileRespSchema }, -} satisfies ProtoSchema; - -export const OidbGroupFileListRespSchema = { - retCode: { field: 1, type: 'uint32' as const }, - retMsg: { field: 2, type: 'string' as const }, - clientWording: { field: 3, type: 'string' as const }, - isEnd: { field: 4, type: 'bool' as const }, - items: { field: 5, type: 'repeated_message' as const, schema: OidbGroupFileListItemRespSchema }, -} satisfies ProtoSchema; - -export const OidbGroupFileViewRespSchema = { - list: { field: 2, type: 'message' as const, schema: OidbGroupFileListRespSchema }, -} satisfies ProtoSchema; - -// --- 0x6D6_2 / 0x6D6_3: Group file url & delete --- - -export const OidbGroupFileUploadReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - appId: { field: 2, type: 'uint32' as const }, - busId: { field: 3, type: 'uint32' as const }, - entrance: { field: 4, type: 'uint32' as const }, - targetDirectory: { field: 5, type: 'string' as const }, - fileName: { field: 6, type: 'string' as const }, - localDirectory: { field: 7, type: 'string' as const }, - fileSize: { field: 8, type: 'uint64' as const }, - fileSha1: { field: 9, type: 'bytes' as const }, - fileSha3: { field: 10, type: 'bytes' as const }, - fileMd5: { field: 11, type: 'bytes' as const }, - field15: { field: 15, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileDownloadReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - appId: { field: 2, type: 'uint32' as const }, - busId: { field: 3, type: 'uint32' as const }, - fileId: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileDeleteReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - busId: { field: 3, type: 'uint32' as const }, - fileId: { field: 5, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileMoveReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - appId: { field: 2, type: 'uint32' as const }, - busId: { field: 3, type: 'uint32' as const }, - fileId: { field: 4, type: 'string' as const }, - parentDirectory: { field: 5, type: 'string' as const }, - targetDirectory: { field: 6, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileReqSchema = { - file: { field: 1, type: 'message' as const, schema: OidbGroupFileUploadReqSchema }, - download: { field: 3, type: 'message' as const, schema: OidbGroupFileDownloadReqSchema }, - delete: { field: 4, type: 'message' as const, schema: OidbGroupFileDeleteReqSchema }, - move: { field: 6, type: 'message' as const, schema: OidbGroupFileMoveReqSchema }, -} satisfies ProtoSchema; - -export const OidbGroupFileUploadRespSchema = { - retCode: { field: 1, type: 'int32' as const }, - retMsg: { field: 2, type: 'string' as const }, - clientWording: { field: 3, type: 'string' as const }, - uploadIp: { field: 4, type: 'string' as const }, - serverDns: { field: 5, type: 'string' as const }, - busId: { field: 6, type: 'int32' as const }, - fileId: { field: 7, type: 'string' as const }, - checkKey: { field: 8, type: 'bytes' as const }, - fileKey: { field: 9, type: 'bytes' as const }, - boolFileExist: { field: 10, type: 'bool' as const }, - uploadPort: { field: 14, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileDownloadRespSchema = { - retCode: { field: 1, type: 'uint32' as const }, - retMsg: { field: 2, type: 'string' as const }, - clientWording: { field: 3, type: 'string' as const }, - downloadIp: { field: 4, type: 'string' as const }, - downloadDns: { field: 5, type: 'string' as const }, - downloadUrl: { field: 6, type: 'bytes' as const }, - saveFileName: { field: 11, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileRetRespSchema = { - retCode: { field: 1, type: 'uint32' as const }, - retMsg: { field: 2, type: 'string' as const }, - clientWording: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileRespSchema = { - upload: { field: 1, type: 'message' as const, schema: OidbGroupFileUploadRespSchema }, - download: { field: 3, type: 'message' as const, schema: OidbGroupFileDownloadRespSchema }, - delete: { field: 4, type: 'message' as const, schema: OidbGroupFileRetRespSchema }, - move: { field: 6, type: 'message' as const, schema: OidbGroupFileRetRespSchema }, -} satisfies ProtoSchema; - -// --- 0x6D7_0 / 0x6D7_1 / 0x6D7_2: Group file folder ops --- - -export const OidbGroupFileCreateFolderReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - rootDirectory: { field: 3, type: 'string' as const }, - folderName: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileDeleteFolderReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - folderId: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileRenameFolderReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - folderId: { field: 3, type: 'string' as const }, - newFolderName: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileFolderReqSchema = { - create: { field: 1, type: 'message' as const, schema: OidbGroupFileCreateFolderReqSchema }, - delete: { field: 2, type: 'message' as const, schema: OidbGroupFileDeleteFolderReqSchema }, - rename: { field: 3, type: 'message' as const, schema: OidbGroupFileRenameFolderReqSchema }, -} satisfies ProtoSchema; - -export const OidbGroupFileFolderRetRespSchema = { - retcode: { field: 1, type: 'uint32' as const }, - retMsg: { field: 2, type: 'string' as const }, - clientWording: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileFolderRespSchema = { - create: { field: 1, type: 'message' as const, schema: OidbGroupFileFolderRetRespSchema }, - delete: { field: 2, type: 'message' as const, schema: OidbGroupFileFolderRetRespSchema }, - rename: { field: 3, type: 'message' as const, schema: OidbGroupFileFolderRetRespSchema }, -} satisfies ProtoSchema; - -// --- 0xE37_1200: Private file download url --- - -export const OidbPrivateFileDownloadReqBodySchema = { - receiverUid: { field: 10, type: 'string' as const }, - fileUuid: { field: 20, type: 'string' as const }, - type: { field: 30, type: 'uint32' as const }, - fileHash: { field: 60, type: 'string' as const }, - t2: { field: 601, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbPrivateFileDownloadReqSchema = { - subCommand: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - body: { field: 14, type: 'message' as const, schema: OidbPrivateFileDownloadReqBodySchema }, - field101: { field: 101, type: 'uint32' as const }, - field102: { field: 102, type: 'uint32' as const }, - field200: { field: 200, type: 'uint32' as const }, - field99999: { field: 99999, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const OidbPrivateFileDownloadRespResultSchema = { - server: { field: 20, type: 'string' as const }, - port: { field: 40, type: 'uint32' as const }, - url: { field: 50, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbPrivateFileDownloadRespBodySchema = { - state: { field: 20, type: 'string' as const }, - result: { field: 30, type: 'message' as const, schema: OidbPrivateFileDownloadRespResultSchema }, -} satisfies ProtoSchema; - -export const OidbPrivateFileDownloadRespSchema = { - body: { field: 14, type: 'message' as const, schema: OidbPrivateFileDownloadRespBodySchema }, -} satisfies ProtoSchema; - -// --- 0xE37_1700: Private file upload --- - -export const OidbPrivateFileUploadReqBodySchema = { - senderUid: { field: 10, type: 'string' as const }, - receiverUid: { field: 20, type: 'string' as const }, - fileSize: { field: 30, type: 'uint32' as const }, - fileName: { field: 40, type: 'string' as const }, - md510MCheckSum:{ field: 50, type: 'bytes' as const }, - sha1CheckSum: { field: 60, type: 'bytes' as const }, - localPath: { field: 70, type: 'string' as const }, - md5CheckSum: { field: 110, type: 'bytes' as const }, - sha3CheckSum: { field: 120, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const OidbPrivateFileUploadReqSchema = { - command: { field: 1, type: 'uint32' as const }, - seq: { field: 2, type: 'int32' as const }, - upload: { field: 19, type: 'message' as const, schema: OidbPrivateFileUploadReqBodySchema }, - businessId: { field: 101, type: 'int32' as const }, - clientType: { field: 102, type: 'int32' as const }, - flagSupportMediaPlatform: { field: 200, type: 'int32' as const }, -} satisfies ProtoSchema; - -export const OidbPrivateFileUploadRespBodySchema = { - retCode: { field: 10, type: 'int32' as const }, - retMsg: { field: 20, type: 'string' as const }, - uploadIp: { field: 60, type: 'string' as const }, - uploadPort: { field: 80, type: 'uint32' as const }, - uuid: { field: 90, type: 'string' as const }, - uploadKey: { field: 100, type: 'bytes' as const }, - boolFileExist: { field: 110, type: 'bool' as const }, - fileAddon: { field: 200, type: 'string' as const }, - mediaPlatformUploadKey: { field: 220, type: 'bytes' as const }, -} satisfies ProtoSchema; - -export const OidbPrivateFileUploadRespSchema = { - upload: { field: 19, type: 'message' as const, schema: OidbPrivateFileUploadRespBodySchema }, -} satisfies ProtoSchema; - -// --- NTV2 Rich Media (0x9067_202): Download RKey --- - -export const NTV2CommonHeadSchema = { - requestId: { field: 1, type: 'uint32' as const }, - command: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2C2CUserInfoSchema = { - accountType: { field: 1, type: 'uint32' as const }, - targetUid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const NTV2GroupInfoSchema = { - groupUin: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2SceneInfoSchema = { - requestType: { field: 101, type: 'uint32' as const }, - businessType: { field: 102, type: 'uint32' as const }, - sceneType: { field: 200, type: 'uint32' as const }, - c2c: { field: 201, type: 'message' as const, schema: NTV2C2CUserInfoSchema }, - group: { field: 202, type: 'message' as const, schema: NTV2GroupInfoSchema }, -} satisfies ProtoSchema; - -export const NTV2ClientMetaSchema = { - agentType: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2ReqHeadSchema = { - common: { field: 1, type: 'message' as const, schema: NTV2CommonHeadSchema }, - scene: { field: 2, type: 'message' as const, schema: NTV2SceneInfoSchema }, - client: { field: 3, type: 'message' as const, schema: NTV2ClientMetaSchema }, -} satisfies ProtoSchema; - -export const NTV2DownloadRKeyReqSchema = { - types: { field: 1, type: 'repeated_uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2FileTypeSchema = { - type: { field: 1, type: 'uint32' as const }, - picFormat: { field: 2, type: 'uint32' as const }, - videoFormat: { field: 3, type: 'uint32' as const }, - voiceFormat: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2FileInfoSchema = { - fileSize: { field: 1, type: 'uint32' as const }, - fileHash: { field: 2, type: 'string' as const }, - fileSha1: { field: 3, type: 'string' as const }, - fileName: { field: 4, type: 'string' as const }, - type: { field: 5, type: 'message' as const, schema: NTV2FileTypeSchema }, - width: { field: 6, type: 'uint32' as const }, - height: { field: 7, type: 'uint32' as const }, - time: { field: 8, type: 'uint32' as const }, - original: { field: 9, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2IndexNodeSchema = { - info: { field: 1, type: 'message' as const, schema: NTV2FileInfoSchema }, - fileUuid: { field: 2, type: 'string' as const }, - storeId: { field: 3, type: 'uint32' as const }, - uploadTime: { field: 4, type: 'uint32' as const }, - ttl: { field: 5, type: 'uint32' as const }, - subType: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2VideoDownloadExtSchema = { - busiType: { field: 1, type: 'uint32' as const }, - sceneType: { field: 2, type: 'uint32' as const }, - subBusiType: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2DownloadExtSchema = { - video: { field: 2, type: 'message' as const, schema: NTV2VideoDownloadExtSchema }, -} satisfies ProtoSchema; - -export const NTV2DownloadReqSchema = { - node: { field: 1, type: 'message' as const, schema: NTV2IndexNodeSchema }, - download: { field: 2, type: 'message' as const, schema: NTV2DownloadExtSchema }, -} satisfies ProtoSchema; - -export const NTV2RichMediaReqSchema = { - reqHead: { field: 1, type: 'message' as const, schema: NTV2ReqHeadSchema }, - download: { field: 3, type: 'message' as const, schema: NTV2DownloadReqSchema }, - downloadRkey: { field: 4, type: 'message' as const, schema: NTV2DownloadRKeyReqSchema }, -} satisfies ProtoSchema; - -export const NTV2RespHeadSchema = { - common: { field: 1, type: 'message' as const, schema: NTV2CommonHeadSchema }, - retCode: { field: 2, type: 'uint32' as const }, - message: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const NTV2RKeyInfoSchema = { - rkey: { field: 1, type: 'string' as const }, - rkeyTtlSec: { field: 2, type: 'uint64' as const }, - storeId: { field: 3, type: 'uint32' as const }, - rkeyCreateTime:{ field: 4, type: 'uint32' as const }, - type: { field: 5, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2DownloadRKeyRespSchema = { - rkeys: { field: 1, type: 'repeated_message' as const, schema: NTV2RKeyInfoSchema }, -} satisfies ProtoSchema; - -export const NTV2MediaDownloadInfoSchema = { - domain: { field: 1, type: 'string' as const }, - urlPath: { field: 2, type: 'string' as const }, - httpsPort: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2MediaDownloadRespSchema = { - rKeyParam: { field: 1, type: 'string' as const }, - rKeyTtlSecond: { field: 2, type: 'uint32' as const }, - info: { field: 3, type: 'message' as const, schema: NTV2MediaDownloadInfoSchema }, - rKeyCreateTime: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const NTV2RichMediaRespSchema = { - respHead: { field: 1, type: 'message' as const, schema: NTV2RespHeadSchema }, - download: { field: 3, type: 'message' as const, schema: NTV2MediaDownloadRespSchema }, - downloadRkey:{ field: 4, type: 'message' as const, schema: NTV2DownloadRKeyRespSchema }, -} satisfies ProtoSchema; - -// --- 0xB6E_2: Set friend remark --- - -export const OidbSetFriendRemarkSchema = { - targetUid: { field: 1, type: 'string' as const }, - remark: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- 0x9082_2: Set group reaction (remove) — same schema as set --- -// (0x9082_1 for add, 0x9082_2 for remove — both use OidbGroupReactionSchema) - -// --- Group file count (0x6D8_3) --- - -export const OidbGroupFileCountReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - appId: { field: 2, type: 'uint32' as const }, - busId: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileCountRespSchema = { - fileCount: { field: 1, type: 'uint32' as const }, - maxCount: { field: 2, type: 'uint32' as const }, - isEnd: { field: 3, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const OidbGroupFileCountViewReqSchema = { - count: { field: 3, type: 'message' as const, schema: OidbGroupFileCountReqSchema }, -} satisfies ProtoSchema; - -export const OidbGroupFileCountViewRespSchema = { - count: { field: 3, type: 'message' as const, schema: OidbGroupFileCountRespSchema }, -} satisfies ProtoSchema; - - -// --- trpc.msg.msg_svc.MsgService.SsoReadedReport --- - -export const GroupReadedReportItemSchema = { - groupUin: { field: 1, type: 'uint64' as const }, - lastReadSeq: { field: 2, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const C2CReadedReportItemSchema = { - uid: { field: 2, type: 'string' as const }, - lastReadTime: { field: 3, type: 'uint64' as const }, - lastReadSeq: { field: 4, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const SsoReadedReportReqSchema = { - groupList: { field: 1, type: 'repeated_message' as const, schema: GroupReadedReportItemSchema }, - c2cList: { field: 2, type: 'repeated_message' as const, schema: C2CReadedReportItemSchema }, -} satisfies ProtoSchema; - - -// --- 0x102A_1: Get Client Key --- - -export const OidbClientKeyReqSchema = { -} satisfies ProtoSchema; - -export const OidbClientKeyRespSchema = { - keyIndex: { field: 2, type: 'uint32' as const }, - clientKey: { field: 3, type: 'string' as const }, - expireTime: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - - -// --- 0x102A_0: Get PSKey --- - -export const OidbGetPskeyReqSchema = { - domainList: { field: 1, type: 'repeated_string' as const }, -} satisfies ProtoSchema; - -export const OidbPskeyItemSchema = { - domain: { field: 1, type: 'string' as const }, - pskey: { field: 2, type: 'string' as const }, - expireTime: { field: 3, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const OidbGetPskeyRespSchema = { - pskeyItems: { field: 1, type: 'repeated_message' as const, schema: OidbPskeyItemSchema }, -} satisfies ProtoSchema; - - -// customExt sub-message of SetStatus. Populated only by -// set_diy_online_status (status=10 + extStatus=2000 + this payload); -// regular set_online_status leaves field 4 unset. -// -// Wire (from napcat packet/transformer/proto/action/action.ts SetStatusCustomExt): -// 1 faceId (uint32) — face icon id, e.g. "Q我吧" sticker -// 2 text (string) — wording shown next to the icon -// 3 field3 (uint32) — face_type / template id; observed values 1..3 -export const SetStatusCustomExtSchema = { - faceId: { field: 1, type: 'uint32' as const }, - text: { field: 2, type: 'string' as const }, - faceType: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const SetStatusReqSchema = { - status: { field: 1, type: 'int32' as const }, - extStatus: { field: 2, type: 'int32' as const }, - batteryStatus: { field: 3, type: 'int32' as const }, - customExt: { field: 4, type: 'message' as const, schema: SetStatusCustomExtSchema }, -} satisfies ProtoSchema; - -export const SetStatusRespSchema = { - errCode: { field: 1, type: 'int32' as const }, // 盲猜字段 1 是错误码(虽然成功时没下发,默认 0) - errMsg: { field: 2, type: 'string' as const }, // 返回的 "set status success" -} satisfies ProtoSchema; - - -export const OidbProfileStringItemSchema = { - fieldId: { field: 1, type: 'uint32' as const }, - value: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbProfileIntItemSchema = { - fieldId: { field: 1, type: 'uint32' as const }, - value: { field: 2, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const OidbSetProfileSchema = { - uin: { field: 1, type: 'uint64' as const }, - stringProfiles: { field: 2, type: 'repeated_message' as const, schema: OidbProfileStringItemSchema }, - intProfiles: { field: 3, type: 'repeated_message' as const, schema: OidbProfileIntItemSchema }, -} satisfies ProtoSchema; - - -export const Oidb0x7edInteractionSchema = { - totalCount: { field: 1, type: 'uint32' as const }, - newCount: { field: 2, type: 'uint32' as const }, - todayCount: { field: 3, type: 'uint32' as const }, - lastTime: { field: 4, type: 'uint64' as const }, - // userInfos: { field: 7, type: 'repeated_message' ... } // 我没有这个字段,期待未来补全 -} satisfies ProtoSchema; - -export const Oidb0x7edUserLikeInfoSchema = { - uid: { field: 1, type: 'string' as const }, - time: { field: 2, type: 'uint64' as const }, - favoriteInfo: { field: 3, type: 'message' as const, schema: Oidb0x7edInteractionSchema }, - voteInfo: { field: 4, type: 'message' as const, schema: Oidb0x7edInteractionSchema }, -} satisfies ProtoSchema; - -export const Oidb0x7edReqSchema = { - targetUid: { field: 1, type: 'string' as const }, - basic: { field: 2, type: 'uint32' as const }, - vote: { field: 3, type: 'uint32' as const }, - favorite: { field: 4, type: 'uint32' as const }, - start: { field: 12, type: 'uint32' as const }, - limit: { field: 103, type: 'uint32' as const }, // 0xB8 0x06 -} satisfies ProtoSchema; - -export const Oidb0x7edRespSchema = { - userLikeInfos: { field: 1, type: 'repeated_message' as const, schema: Oidb0x7edUserLikeInfoSchema }, -} satisfies ProtoSchema; - - -export const Oidb0x8a7ReqSchema = { - basic1: { field: 1, type: 'uint32' as const }, - basic2: { field: 2, type: 'uint32' as const }, - basic3: { field: 3, type: 'uint32' as const }, - uin: { field: 4, type: 'uint64' as const }, - groupId: { field: 5, type: 'uint64' as const }, - type: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x8a7RespSchema = { - uinRemain: { field: 2, type: 'uint32' as const }, - groupRemain: { field: 3, type: 'uint32' as const }, - msg: { field: 4, type: 'string' as const }, - canAtAll: { field: 6, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const Oidb0xe17ReqSchema = { - jsonBody: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const Oidb0xe17RespSchema = { - jsonBody: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const Oidb0x112aProfileInfoSchema = { - tag: { field: 1, type: 'uint32' as const }, - value: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const Oidb0x112aReqSchema = { - uin: { field: 1, type: 'uint64' as const }, - profile: { field: 2, type: 'message' as const, schema: Oidb0x112aProfileInfoSchema }, -} satisfies ProtoSchema; - -export const Oidb0x112aRespSchema = {} satisfies ProtoSchema; - -export const Oidb0xcd4ReqBodySchema = { - uid: { field: 1, type: 'string' as const }, - chatType: { field: 2, type: 'uint32' as const }, // 默认为 0 - eventType: { field: 3, type: 'uint32' as const }, // 输入状态 1 等 -} satisfies ProtoSchema; - -export const Oidb0xcd4ReqSchema = { - reqBody: { field: 1, type: 'message' as const, schema: Oidb0xcd4ReqBodySchema }, -} satisfies ProtoSchema; - -export const Oidb0xcd4RespSchema = {} satisfies ProtoSchema; - - -export const Oidb0x990TranslateReqSchema = { - srcLang: { field: 1, type: 'string' as const }, - dstLang: { field: 2, type: 'string' as const }, - words: { field: 3, type: 'repeated_string' as const }, -} satisfies ProtoSchema; - -export const Oidb0x990ReqSchema = { - translateReq: { field: 2, type: 'message' as const, schema: Oidb0x990TranslateReqSchema }, - tag10: { field: 10, type: 'uint32' as const }, - tag12: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x990TranslateRespSchema = { - errorCode: { field: 1, type: 'uint32' as const }, - errorMsg: { field: 2, type: 'string' as const }, - srcLang: { field: 3, type: 'string' as const }, - dstLang: { field: 4, type: 'string' as const }, - srcWords: { field: 5, type: 'repeated_string' as const }, - dstWords: { field: 6, type: 'repeated_string' as const }, -} satisfies ProtoSchema; - -export const Oidb0x990RespSchema = { - translateResp: { field: 2, type: 'message' as const, schema: Oidb0x990TranslateRespSchema } -} satisfies ProtoSchema; - -export const MiniAppShareReqBodySchema = { - appid: { field: 2, type: 'string' as const }, - title: { field: 3, type: 'string' as const }, - desc: { field: 4, type: 'string' as const }, - picUrl: { field: 9, type: 'string' as const }, - jumpUrl: { field: 11, type: 'string' as const }, - iconUrl: { field: 12, type: 'string' as const }, -} satisfies ProtoSchema; - -export const MiniAppShareReqSchema = { - sdkVersion: { field: 2, type: 'string' as const }, - body: { field: 4, type: 'message' as const, schema: MiniAppShareReqBodySchema }, -} satisfies ProtoSchema; - -export const MiniAppShareRespBodySchema = { - jsonStr: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const MiniAppShareRespSchema = { - status: { field: 2, type: 'uint32' as const }, - msg: { field: 3, type: 'string' as const }, - body: { field: 4, type: 'message' as const, schema: MiniAppShareRespBodySchema }, -} satisfies ProtoSchema; - -export const Oidb0x112eReqSchema = { - botAppid: { field: 3, type: 'uint64' as const }, - msgSeq: { field: 4, type: 'uint64' as const }, - buttonId: { field: 5, type: 'string' as const }, - callbackData: { field: 6, type: 'string' as const }, - unknown7: { field: 7, type: 'uint32' as const }, - groupId: { field: 8, type: 'uint64' as const }, - unknown9: { field: 9, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x112eRespSchema = { - result: { field: 3, type: 'uint32' as const }, - promptText: { field: 4, type: 'string' as const }, - errMsg: { field: 5, type: 'string' as const }, -} satisfies ProtoSchema; - -export const Oidb0xeb7SignInInfoSchema = { - uin: { field: 1, type: 'string' as const }, - groupId: { field: 2, type: 'string' as const }, - version: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const Oidb0xeb7ReqSchema = { - signInInfo: { field: 2, type: 'message' as const, schema: Oidb0xeb7SignInInfoSchema }, -} satisfies ProtoSchema; - -export const Oidb0xeb7RespSchema = {} satisfies ProtoSchema; - -// --- Faceroam.OpReq: Fetch custom face --- - -export const FaceroamOpReqInnerSchema = { - field1: { field: 1, type: 'uint32' as const }, - osVersion: { field: 2, type: 'string' as const }, - qqVersion: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const FaceroamOpReqSchema = { - inner: { field: 1, type: 'message' as const, schema: FaceroamOpReqInnerSchema }, - uin: { field: 2, type: 'uint64' as const }, - field3: { field: 3, type: 'uint32' as const }, - field6: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const FaceroamOpRespItemSchema = { - faceIds: { field: 1, type: 'repeated_string' as const }, - category: { field: 3, type: 'string' as const }, - totalCount: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const FaceroamOpRespSchema = { - retCode: { field: 1, type: 'uint32' as const }, - message: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'uint32' as const }, - item: { field: 4, type: 'message' as const, schema: FaceroamOpRespItemSchema }, -} satisfies ProtoSchema; - -// --- 0x9083_1: Get emoji likes --- - -export const Oidb0x9083ReqSchema = { - groupId: { field: 2, type: 'uint64' as const }, - sequence: { field: 3, type: 'uint32' as const }, - emojiType: { field: 4, type: 'uint32' as const }, - emojiId: { field: 5, type: 'string' as const }, - cookie: { field: 6, type: 'bytes' as const }, - field7: { field: 7, type: 'uint32' as const }, - count: { field: 8, type: 'uint32' as const }, - field12: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x9083RespUserInfoSchema = { - uin: { field: 1, type: 'uint64' as const }, - field3: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x9083RespInnerSchema = { - userInfo: { field: 1, type: 'message' as const, schema: Oidb0x9083RespUserInfoSchema }, - field4: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x9083RespSchema = { - inner: { field: 4, type: 'message' as const, schema: Oidb0x9083RespInnerSchema }, - cookie: { field: 5, type: 'bytes' as const }, -} satisfies ProtoSchema; - -// --- 0x8a0_1: Kick group members (batch) --- - -export const Oidb0x8a0ReqSchema = { - groupId: { field: 1, type: 'uint64' as const }, - targetUids: { field: 3, type: 'repeated_string' as const }, - rejectAddRequest: { field: 4, type: 'uint32' as const }, - kickReason: { field: 5, type: 'bytes' as const }, - field12: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0x8a0RespSchema = {} satisfies ProtoSchema; - -// --- 0xf16_1: Set group remark --- - -export const Oidb0xf16InnerSchema = { - groupId: { field: 1, type: 'uint64' as const }, - remark: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const Oidb0xf16ReqSchema = { - inner: { field: 1, type: 'message' as const, schema: Oidb0xf16InnerSchema }, - field12: { field: 12, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const Oidb0xf16RespSchema = {} satisfies ProtoSchema; - -// --- 0xF90_{1,2,3}: Set / complete / cancel group todo --- -// All three subCmds share the same body (groupUin + msgSeq); only the -// envelope subCmd differs. Sources: napcat -// packet/transformer/action/{Set,Complete,Cancel}GroupTodo.ts. - -export const OidbGroupTodoSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - msgSeq: { field: 2, type: 'uint64' as const }, -} satisfies ProtoSchema; - -// --- 0xFE1_2: Get stranger profile (used for online/ext status lookup) --- - -export const OidbStrangerStatusKeySchema = { - key: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbStrangerStatusReqSchema = { - uin: { field: 1, type: 'uint32' as const }, - key: { field: 3, type: 'repeated_message' as const, schema: OidbStrangerStatusKeySchema }, -} satisfies ProtoSchema; - -export const OidbStrangerStatusRespStatusSchema = { - key: { field: 1, type: 'uint32' as const }, - value: { field: 2, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const OidbStrangerStatusRespDataSchema = { - status: { field: 2, type: 'message' as const, schema: OidbStrangerStatusRespStatusSchema }, -} satisfies ProtoSchema; - -export const OidbStrangerStatusRespSchema = { - data: { field: 1, type: 'message' as const, schema: OidbStrangerStatusRespDataSchema }, -} satisfies ProtoSchema; - -// --- 0x929D_0: Fetch AI voice character list --- - -export const OidbAiVoiceListReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - chatType: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbAiVoiceListEntrySchema = { - voiceId: { field: 1, type: 'string' as const }, - voiceDisplayName: { field: 2, type: 'string' as const }, - voiceExampleUrl: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbAiVoiceListCategorySchema = { - category: { field: 1, type: 'string' as const }, - voices: { field: 2, type: 'repeated_message' as const, schema: OidbAiVoiceListEntrySchema }, -} satisfies ProtoSchema; - -export const OidbAiVoiceListRespSchema = { - content: { field: 1, type: 'repeated_message' as const, schema: OidbAiVoiceListCategorySchema }, -} satisfies ProtoSchema; - -// --- 0x929B_0: Trigger AI voice synthesis (returns server-side IndexNode) --- - -export const OidbAiVoiceSessionSchema = { - sessionId: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbAiVoiceReqSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - voiceId: { field: 2, type: 'string' as const }, - text: { field: 3, type: 'string' as const }, - chatType: { field: 4, type: 'uint32' as const }, - session: { field: 5, type: 'message' as const, schema: OidbAiVoiceSessionSchema }, -} satisfies ProtoSchema; - -// We only need the fields the OneBot adapter consumes back: the -// IndexNode payload (which feeds fetchGroupPttUrlByNode) and the -// statusCode that the server uses to signal "still rendering, retry". - -export const OidbAiVoiceFileTypeSchema = { - type: { field: 1, type: 'uint32' as const }, - picFormat: { field: 2, type: 'uint32' as const }, - videoFormat: { field: 3, type: 'uint32' as const }, - voiceFormat: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbAiVoiceFileInfoSchema = { - fileSize: { field: 1, type: 'uint32' as const }, - fileHash: { field: 2, type: 'string' as const }, - fileSha1: { field: 3, type: 'string' as const }, - fileName: { field: 4, type: 'string' as const }, - type: { field: 5, type: 'message' as const, schema: OidbAiVoiceFileTypeSchema }, - width: { field: 6, type: 'uint32' as const }, - height: { field: 7, type: 'uint32' as const }, - time: { field: 8, type: 'uint32' as const }, - original: { field: 9, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbAiVoiceIndexNodeSchema = { - info: { field: 1, type: 'message' as const, schema: OidbAiVoiceFileInfoSchema }, - fileUuid: { field: 2, type: 'string' as const }, - storeId: { field: 3, type: 'uint32' as const }, - uploadTime: { field: 4, type: 'uint32' as const }, - ttl: { field: 5, type: 'uint32' as const }, - subType: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbAiVoiceMsgInfoBodySchema = { - index: { field: 1, type: 'message' as const, schema: OidbAiVoiceIndexNodeSchema }, -} satisfies ProtoSchema; - -export const OidbAiVoiceMsgInfoSchema = { - msgInfoBody: { field: 1, type: 'repeated_message' as const, schema: OidbAiVoiceMsgInfoBodySchema }, -} satisfies ProtoSchema; - -export const OidbAiVoiceRespSchema = { - statusCode: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'uint32' as const }, - msgInfo: { field: 4, type: 'message' as const, schema: OidbAiVoiceMsgInfoSchema }, -} satisfies ProtoSchema; - -// --- Highway cmdId 3000: GroupAvatarExtra --- -// Ported from Lagrange.Core/Internal/Packets/Service/Highway/GroupAvatarExtra.cs. -// Field values are protocol-prescribed constants (Lagrange comments on each). - -export const GroupAvatarExtraField3Schema = { - field1: { field: 1, type: 'uint32' as const }, // observed value: 1 -} satisfies ProtoSchema; - -export const GroupAvatarExtraSchema = { - type: { field: 1, type: 'uint32' as const }, // observed value: 101 - groupUin: { field: 2, type: 'uint32' as const }, - field3: { field: 3, type: 'message' as const, schema: GroupAvatarExtraField3Schema }, - field5: { field: 5, type: 'uint32' as const }, // observed value: 3 - field6: { field: 6, type: 'uint32' as const }, // observed value: 1 -} satisfies ProtoSchema; - -///////// --- group album -// --- Request Schemas --- - -export const ExtMapEntrySchema = { - key: { field: 1, type: 'string' as const }, - value: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const ReqInfoSchema = { - groupId: { field: 1, type: 'string' as const }, - albumId: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'int32' as const }, - attachInfo: { field: 4, type: 'string' as const }, - field5: { field: 5, type: 'string' as const }, -} satisfies ProtoSchema; - -export const GetMediaListRequestSchema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'bytes' as const }, - field3: { field: 3, type: 'bytes' as const }, - reqInfo: { field: 4, type: 'message' as const, schema: ReqInfoSchema }, - traceId: { field: 5, type: 'string' as const }, - extMap: { field: 10, type: 'repeated_message' as const, schema: ExtMapEntrySchema }, -} satisfies ProtoSchema; - -// --- Response Schemas --- - -export const UrlInfoSchema = { - url: { field: 1, type: 'string' as const }, - width: { field: 2, type: 'uint32' as const }, - height: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const PhotoUrlSchema = { - spec: { field: 1, type: 'uint32' as const }, - url: { field: 2, type: 'message' as const, schema: UrlInfoSchema } -} satisfies ProtoSchema; - -export const ImageInfoSchema = { - name: { field: 1, type: 'string' as const }, - sloc: { field: 2, type: 'string' as const }, - lloc: { field: 3, type: 'string' as const }, - photoUrls: { field: 4, type: 'repeated_message' as const, schema: PhotoUrlSchema }, - defaultUrl: { field: 5, type: 'message' as const, schema: UrlInfoSchema }, - isGif: { field: 6, type: 'bool' as const }, - hasRaw: { field: 7, type: 'bool' as const }, -} satisfies ProtoSchema; - -export const MediaInfoSchema = { - type: { field: 1, type: 'uint32' as const }, - image: { field: 2, type: 'message' as const, schema: ImageInfoSchema }, - uploader: { field: 6, type: 'string' as const }, - batchId: { field: 7, type: 'uint64' as const }, - uploadTime: { field: 8, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const GetMediaListRspDataSchema = { - albumInfo: { - field: 1, - type: 'message' as const, - schema: { - albumId: { field: 1, type: 'string' as const }, - owner: { field: 2, type: 'string' as const }, - name: { field: 3, type: 'string' as const }, - } satisfies ProtoSchema - }, - mediaList: { field: 3, type: 'repeated_message' as const, schema: MediaInfoSchema }, - prevAttachInfo: { field: 4, type: 'string' as const }, - nextAttachInfo: { field: 5, type: 'string' as const }, // 用于翻页拉取的 token -} satisfies ProtoSchema; - -export const GetMediaListResponseSchema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'bytes' as const }, - field3: { field: 3, type: 'bytes' as const }, - data: { field: 4, type: 'message' as const, schema: GetMediaListRspDataSchema }, // 将原本的 bytes 修正为 message 解析 -} satisfies ProtoSchema; - - -// --- DoQunComment: Comment on group album media --- - -// --- DoQunComment: 严格对齐底层字节的字段定义 --- - -export const CommentContentItemSchema = { - type: { field: 1, type: 'uint32' as const }, - content: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const CommentUserSchema = { - uin: { field: 13, type: 'string' as const }, -} satisfies ProtoSchema; - -// 评论具体内容结构 (原 CommentReqContentSchema) -export const CommentReqContentSchema = { - field2: { field: 2, type: 'message' as const, schema: CommentUserSchema }, - field3: { field: 3, type: 'message' as const, schema: { - field1: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'string' as const }, - field4: { field: 4, type: 'string' as const }, - field5: { field: 5, type: 'uint32' as const }, - field6: { field: 6, type: 'string' as const }, - } satisfies ProtoSchema }, - clientKey: { field: 7, type: 'string' as const }, // 对应你的 clientKey -} satisfies ProtoSchema; - -export const CommentReqPhotoInfoSchema = { - field1: { field: 1, type: 'message' as const, schema: { - field2: { field: 2, type: 'message' as const, schema: { - field1: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'string' as const }, - lloc: { field: 3, type: 'string' as const }, - field4: { field: 4, type: 'string' as const }, - field6: { field: 6, type: 'string' as const }, - field7: { field: 7, type: 'uint32' as const }, - field8: { field: 8, type: 'uint32' as const }, - field9: { field: 9, type: 'uint32' as const }, - field14: { field: 14, type: 'uint32' as const }, - field15: { field: 15, type: 'uint32' as const }, - field17: { field: 17, type: 'uint32' as const }, - } satisfies ProtoSchema }, - } satisfies ProtoSchema }, - albumId: { field: 3, type: 'string' as const }, - field5: { field: 5, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const CommentReqBodySchema = { - field1: { field: 1, type: 'message' as const, schema: { - field3: { field: 3, type: 'uint32' as const }, - field4: { field: 4, type: 'string' as const }, - } satisfies ProtoSchema }, - field2: { field: 2, type: 'message' as const, schema: { - field1: { field: 1, type: 'message' as const, schema: CommentUserSchema } - } satisfies ProtoSchema }, - field5: { field: 5, type: 'message' as const, schema: CommentReqPhotoInfoSchema }, // 注意:抓包证实照片在 field 5 -} satisfies ProtoSchema; - -export const DoQunCommentRequestSchema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'bytes' as const }, - field3: { field: 3, type: 'bytes' as const }, - body: { field: 4, type: 'message' as const, schema: { - groupId: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'uint32' as const }, - reqBody: { field: 4, type: 'message' as const, schema: CommentReqBodySchema }, - field5: { field: 5, type: 'message' as const, schema: CommentReqContentSchema }, // 注意:评论文本实际在外层的 field 5 - } satisfies ProtoSchema }, - traceId: { field: 5, type: 'string' as const }, - extMap: { field: 10, type: 'repeated_message' as const, schema: ExtMapEntrySchema }, -} satisfies ProtoSchema; - -export const CommentRespUserSchema = { - uin: { field: 13, type: 'string' as const }, -} satisfies ProtoSchema; - -export const CommentRespContentSchema = { - type: { field: 1, type: 'uint32' as const }, - content: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const CommentRespDataSchema = { - id: { field: 1, type: 'string' as const }, - user: { field: 2, type: 'message' as const, schema: CommentRespUserSchema }, - content: { field: 3, type: 'repeated_message' as const, schema: CommentRespContentSchema }, - time: { field: 4, type: 'uint64' as const }, - clientKey: { field: 7, type: 'string' as const }, -} satisfies ProtoSchema; - -export const DoQunCommentResponseSchema = { - field1: { field: 1, type: 'int32' as const }, - comment: { field: 4, type: 'message' as const, schema: { - data: { field: 2, type: 'message' as const, schema: CommentRespDataSchema }, - } satisfies ProtoSchema }, -} satisfies ProtoSchema; - -// --- DoQunLike: Like group album media --- - -export const DoQunLikeReqLikeInfoSchema = { - id: { field: 1, type: 'string' as const }, - status: { field: 3, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const DoQunLikeReqCellCommonSchema = { - time: { field: 3, type: 'uint64' as const }, - feedId: { field: 4, type: 'string' as const }, -} satisfies ProtoSchema; - -export const DoQunLikeReqCellUserSchema = { - uin: { field: 13, type: 'string' as const }, // 修复:抓包证实 uin 是 field 13 -} satisfies ProtoSchema; - -export const DoQunLikeReqCellUserInfoSchema = { - user: { field: 1, type: 'message' as const, schema: DoQunLikeReqCellUserSchema }, -} satisfies ProtoSchema; - -export const DoQunLikeReqCellQunInfoSchema = { - qunId: { field: 1, type: 'string' as const }, -} satisfies ProtoSchema; - -export const DoQunLikeReqCellMediaSchema = { - albumId: { field: 3, type: 'string' as const }, - batchId: { field: 5, type: 'uint64' as const }, -} satisfies ProtoSchema; - -export const DoQunLikeReqFeedPublishSchema = { - cellCommon: { field: 1, type: 'message' as const, schema: DoQunLikeReqCellCommonSchema }, - cellUserInfo: { field: 2, type: 'message' as const, schema: DoQunLikeReqCellUserInfoSchema }, - cellMedia: { field: 5, type: 'message' as const, schema: DoQunLikeReqCellMediaSchema }, - cellQunInfo: { field: 12, type: 'message' as const, schema: DoQunLikeReqCellQunInfoSchema }, -} satisfies ProtoSchema; - -export const DoQunLikeReqBodySchema = { - type: { field: 2, type: 'uint32' as const }, - like: { field: 3, type: 'message' as const, schema: DoQunLikeReqLikeInfoSchema }, - publish: { field: 4, type: 'message' as const, schema: DoQunLikeReqFeedPublishSchema }, - clientKey: { field: 5, type: 'string' as const }, -} satisfies ProtoSchema; - -export const DoQunLikeRequestSchema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'string' as const }, - body: { field: 4, type: 'message' as const, schema: DoQunLikeReqBodySchema }, - extMap: { field: 10, type: 'repeated_message' as const, schema: ExtMapEntrySchema }, -} satisfies ProtoSchema; - -export const DoQunLikeRespBodySchema = { - like: { field: 2, type: 'message' as const, schema: DoQunLikeReqLikeInfoSchema }, -} satisfies ProtoSchema; - -export const DoQunLikeResponseSchema = { - field1: { field: 1, type: 'int32' as const }, - body: { field: 4, type: 'message' as const, schema: DoQunLikeRespBodySchema }, -} satisfies ProtoSchema; - -// --- DeleteMedias: Delete group album media --- - -export const DeleteMediasReqBodySchema = { - groupId: { field: 1, type: 'string' as const }, - albumId: { field: 2, type: 'string' as const }, - lloc: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const DeleteMediasRequestSchema = { - field1: { field: 1, type: 'int32' as const }, - field2: { field: 2, type: 'string' as const }, - field3: { field: 3, type: 'string' as const }, - body: { field: 4, type: 'message' as const, schema: DeleteMediasReqBodySchema }, - traceId: { field: 5, type: 'string' as const }, // <-- 把它挪到外层了! - extMap: { field: 10, type: 'repeated_message' as const, schema: ExtMapEntrySchema }, -} satisfies ProtoSchema; - -export const DeleteMediasResponseSchema = { - field1: { field: 1, type: 'int32' as const }, // 8694 - field2: { field: 2, type: 'int32' as const }, // 错误码 (例如: 10023) - field3: { field: 3, type: 'string' as const }, // 错误信息 (例如: "no right delete...") -} satisfies ProtoSchema; - diff --git a/packages/core/src/bridge/proto/oidb.ts b/packages/core/src/bridge/proto/oidb.ts deleted file mode 100644 index 65fa1000..00000000 --- a/packages/core/src/bridge/proto/oidb.ts +++ /dev/null @@ -1,161 +0,0 @@ -// Proto schemas for OidbSvc service types. -// Port of src/bridge/include/bridge/proto/oidb.h - -import type { ProtoSchema } from '../../protobuf/decode'; - -// --- OidbSvcTrpcTcpBase wrapper --- - -export const OidbPropertySchema = { - key: { field: 1, type: 'string' as const }, - value: { field: 2, type: 'bytes' as const }, -} satisfies ProtoSchema; - -// Factory for OidbSvcTrpcTcpBase -export function makeOidbBaseSchema(bodySchema: ProtoSchema): ProtoSchema { - return { - command: { field: 1, type: 'uint32' as const }, - subCommand: { field: 2, type: 'uint32' as const }, - errorCode: { field: 3, type: 'uint32' as const }, - body: { field: 4, type: 'message' as const, schema: bodySchema }, - errorMsg: { field: 5, type: 'string' as const }, - properties: { field: 11, type: 'repeated_message' as const, schema: OidbPropertySchema }, - reserved: { field: 12, type: 'int32' as const }, - }; -} - -// --- Friend list (0xFD4_1) --- - -export const OidbFriendPropertySchema = { - code: { field: 1, type: 'uint32' as const }, - value: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbFriendLayer1Schema = { - properties: { field: 2, type: 'repeated_message' as const, schema: OidbFriendPropertySchema }, -} satisfies ProtoSchema; - -export const OidbFriendAdditionalSchema = { - type: { field: 1, type: 'uint32' as const }, - layer1: { field: 2, type: 'message' as const, schema: OidbFriendLayer1Schema }, -} satisfies ProtoSchema; - -export const OidbFriendSchema = { - uid: { field: 1, type: 'string' as const }, - customGroup:{ field: 2, type: 'uint32' as const }, - uin: { field: 3, type: 'uint32' as const }, - additional: { field: 10001, type: 'repeated_message' as const, schema: OidbFriendAdditionalSchema }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFD4_1ResponseUinSchema = { - uin: { field: 1, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFD4_1ResponseSchema = { - next: { field: 2, type: 'message' as const, schema: OidbSvcTrpcTcp0xFD4_1ResponseUinSchema }, - displayFriendCount: { field: 3, type: 'uint32' as const }, - timestamp: { field: 6, type: 'uint32' as const }, - selfUin: { field: 7, type: 'uint32' as const }, - friends: { field: 101, type: 'repeated_message' as const, schema: OidbFriendSchema }, - groups: { field: 102, type: 'repeated_message' as const, schema: OidbFriendPropertySchema }, -} satisfies ProtoSchema; - -// --- Group list (0xFE5_2) --- - -export const OidbSvcTrpcTcp0xFE5_2MemberSchema = { - uid: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE5_2GroupInfoSchema = { - groupOwner: { field: 1, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE5_2MemberSchema }, - createdTime: { field: 2, type: 'uint32' as const }, - memberMax: { field: 3, type: 'uint32' as const }, - memberCount: { field: 4, type: 'uint32' as const }, - groupName: { field: 5, type: 'string' as const }, - description: { field: 18, type: 'string' as const }, - question: { field: 19, type: 'string' as const }, - announcement: { field: 30, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE5_2CustomInfoSchema = { - remark: { field: 3, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE5_2GroupSchema = { - groupUin: { field: 3, type: 'uint32' as const }, - info: { field: 4, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE5_2GroupInfoSchema }, - customInfo: { field: 5, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE5_2CustomInfoSchema }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE5_2ResponseSchema = { - groups: { field: 2, type: 'repeated_message' as const, schema: OidbSvcTrpcTcp0xFE5_2GroupSchema }, -} satisfies ProtoSchema; - -// --- Group member list (0xFE7_3) --- - -export const OidbSvcTrpcTcp0xFE7_3UinSchema = { - uid: { field: 2, type: 'string' as const }, - uin: { field: 4, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE7_3CardSchema = { - memberCard: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE7_3LevelSchema = { - infos: { field: 1, type: 'repeated_uint32' as const }, - level: { field: 2, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE7_3MemberSchema = { - uin: { field: 1, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE7_3UinSchema }, - memberName: { field: 10, type: 'string' as const }, - specialTitle: { field: 17, type: 'string' as const }, - memberCard: { field: 11, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE7_3CardSchema }, - level: { field: 12, type: 'message' as const, schema: OidbSvcTrpcTcp0xFE7_3LevelSchema }, - joinTimestamp: { field: 100, type: 'uint32' as const }, - lastMsgTimestamp: { field: 101, type: 'uint32' as const }, - shutUpTimestamp: { field: 102, type: 'uint32' as const }, - permission: { field: 107, type: 'uint32' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0xFE7_3ResponseSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - members: { field: 2, type: 'repeated_message' as const, schema: OidbSvcTrpcTcp0xFE7_3MemberSchema }, - field3: { field: 3, type: 'uint32' as const }, - memberChangeSeq: { field: 5, type: 'uint32' as const }, - memberCardChangeSeq:{ field: 6, type: 'uint32' as const }, - token: { field: 15, type: 'string' as const }, -} satisfies ProtoSchema; - -// --- Group request (0x10C0) --- - -export const OidbSvcTrpcTcp0x10C0ResponseUserSchema = { - uid: { field: 1, type: 'string' as const }, - name: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0x10C0ResponseGroupSchema = { - groupUin: { field: 1, type: 'uint32' as const }, - groupName: { field: 2, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0x10C0ResponseRequestSchema = { - sequence: { field: 1, type: 'uint64' as const }, - eventType: { field: 2, type: 'uint32' as const }, - state: { field: 3, type: 'uint32' as const }, - group: { field: 4, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseGroupSchema }, - target: { field: 5, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseUserSchema }, - invitor: { field: 6, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseUserSchema }, - operatorUser: { field: 7, type: 'message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseUserSchema }, - field9: { field: 9, type: 'string' as const }, - comment: { field: 10, type: 'string' as const }, -} satisfies ProtoSchema; - -export const OidbSvcTrpcTcp0x10C0ResponseSchema = { - requests: { field: 1, type: 'repeated_message' as const, schema: OidbSvcTrpcTcp0x10C0ResponseRequestSchema }, - field2: { field: 2, type: 'uint64' as const }, - newLatestSeq: { field: 3, type: 'uint64' as const }, - field4: { field: 4, type: 'uint32' as const }, - field5: { field: 5, type: 'uint64' as const }, - field6: { field: 6, type: 'uint32' as const }, -} satisfies ProtoSchema; diff --git a/packages/core/src/bridge/proto/proton/oidb-actions/base.ts b/packages/core/src/bridge/proto/proton/oidb-actions/base.ts index 34917203..3773970f 100644 --- a/packages/core/src/bridge/proto/proton/oidb-actions/base.ts +++ b/packages/core/src/bridge/proto/proton/oidb-actions/base.ts @@ -3,119 +3,574 @@ import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@sn // Re-exported from the legacy oidb-action module while large protocol groups // are split into focused files. -export interface OidbMuteMemberBody { targetUid?: pb<1, string>; duration?: pb<2, uint_32>; } -export interface OidbMuteMember { groupUin?: pb<1, uint_32>; type?: pb<2, uint_32>; body?: pb<3, OidbMuteMemberBody>; } -export interface OidbMuteAllState { state?: pb<17, uint_32>; } -export interface OidbMuteAll { groupUin?: pb<1, uint_32>; muteState?: pb<2, OidbMuteAllState>; } -export interface Oidb0x89a_0AddOptionSettings { addType?: pb<16, uint_32>; } -export interface Oidb0x89a_0AddOption { groupUin?: pb<1, uint_64>; settings?: pb<2, Oidb0x89a_0AddOptionSettings>; field12?: pb<12, uint_32>; } -export interface Oidb0x89a_0Search { groupUin?: pb<1, uint_64>; settings?: pb<2, bytes>; field12?: pb<12, uint_32>; } -export interface OidbKickMember { groupUin?: pb<1, uint_32>; targetUid?: pb<3, string>; rejectAddRequest?: pb<4, bool>; reason?: pb<5, string>; } -export interface OidbLeaveGroup { groupUin?: pb<1, uint_32>; } -export interface OidbFriendRequestAction { accept?: pb<1, uint_32>; targetUid?: pb<2, string>; } -export interface OidbDeleteFriendField2Field3 { field1?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; } -export interface OidbDeleteFriendField2 { field1?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, OidbDeleteFriendField2Field3>; } -export interface OidbDeleteFriendField1 { targetUid?: pb<1, string>; field2?: pb<2, OidbDeleteFriendField2>; block?: pb<3, bool>; field4?: pb<4, bool>; } -export interface OidbDeleteFriend { field1?: pb<1, OidbDeleteFriendField1>; } -export interface OidbGroupRequestBody { sequence?: pb<1, uint_64>; eventType?: pb<2, uint_32>; groupUin?: pb<3, uint_32>; message?: pb<4, string>; } -export interface OidbGroupRequestAction { accept?: pb<1, uint_32>; body?: pb<2, OidbGroupRequestBody>; } -export interface OidbPoke { uin?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; friendUin?: pb<5, uint_32>; ext?: pb<6, uint_32>; } -export interface OidbEssence { groupUin?: pb<1, uint_32>; sequence?: pb<2, uint_32>; random?: pb<3, uint_32>; } -export interface OidbSetAdmin { groupUin?: pb<1, uint_32>; uid?: pb<2, string>; isAdmin?: pb<3, bool>; } -export interface OidbRenameMemberBody { targetUid?: pb<1, string>; targetName?: pb<2, string>; } -export interface OidbRenameMember { groupUin?: pb<1, uint_32>; body?: pb<2, OidbRenameMemberBody>; } -export interface OidbRenameGroupBody { targetName?: pb<1, string>; } -export interface OidbRenameGroup { groupUin?: pb<1, uint_32>; body?: pb<2, OidbRenameGroupBody>; } -export interface OidbSpecialTitleBody { targetUid?: pb<1, string>; specialTitle?: pb<5, string>; expireTime?: pb<6, int_32>; } -export interface OidbSpecialTitle { groupUin?: pb<1, uint_32>; body?: pb<2, OidbSpecialTitleBody>; } -export interface OidbLike { targetUin?: pb<1, uint_32>; count?: pb<2, uint_32>; } -export interface OidbGroupRequestList { count?: pb<1, uint_32>; field2?: pb<2, uint_32>; } -export interface OidbUserInfoKey { key?: pb<1, uint_32>; } -export interface OidbUserInfoRequest { uin?: pb<1, uint_32>; keys?: pb_repeated<3, OidbUserInfoKey>; } -export interface OidbTwoNumber { number1?: pb<1, uint_32>; number2?: pb<2, uint_32>; } -export interface OidbByteProperty { code?: pb<1, uint_32>; value?: pb<2, bytes>; } -export interface OidbUserInfoProperty { numberProperties?: pb_repeated<1, OidbTwoNumber>; bytesProperties?: pb_repeated<2, OidbByteProperty>; } -export interface OidbUserInfoResponseBody { uid?: pb<1, string>; properties?: pb<2, OidbUserInfoProperty>; uin?: pb<3, uint_32>; } -export interface OidbUserInfoResponse { body?: pb<1, OidbUserInfoResponseBody>; } -export interface AvatarInfo { url?: pb<5, string>; } -export interface OidbFriendListNumber { numbers?: pb_repeated<1, uint_32>; } -export interface OidbFriendListBodyItem { type?: pb<1, uint_32>; number?: pb<2, OidbFriendListNumber>; } -export interface OidbFriendListNextUin { uin?: pb<1, uint_32>; } -export interface OidbFriendListRequest { friendCount?: pb<2, uint_32>; field4?: pb<4, uint_32>; nextUin?: pb<5, OidbFriendListNextUin>; field6?: pb<6, uint_32>; field7?: pb<7, uint_32>; body?: pb_repeated<10001, OidbFriendListBodyItem>; field10002?: pb_repeated<10002, uint_32>; field10003?: pb<10003, uint_32>; } -export interface OidbGroupListConfig1 { groupOwner?: pb<1, bool>; field2?: pb<2, bool>; memberMax?: pb<3, bool>; memberCount?: pb<4, bool>; groupName?: pb<5, bool>; field8?: pb<8, bool>; field9?: pb<9, bool>; field10?: pb<10, bool>; field11?: pb<11, bool>; field12?: pb<12, bool>; field13?: pb<13, bool>; field14?: pb<14, bool>; field15?: pb<15, bool>; field16?: pb<16, bool>; field17?: pb<17, bool>; field18?: pb<18, bool>; question?: pb<19, bool>; field20?: pb<20, bool>; field22?: pb<22, bool>; field23?: pb<23, bool>; field24?: pb<24, bool>; field25?: pb<25, bool>; field26?: pb<26, bool>; field27?: pb<27, bool>; field28?: pb<28, bool>; field29?: pb<29, bool>; field30?: pb<30, bool>; field31?: pb<31, bool>; field32?: pb<32, bool>; field5001?: pb<5001, bool>; field5002?: pb<5002, bool>; field5003?: pb<5003, bool>; } -export interface OidbGroupListConfig2 { field1?: pb<1, bool>; field2?: pb<2, bool>; field3?: pb<3, bool>; field4?: pb<4, bool>; field5?: pb<5, bool>; field6?: pb<6, bool>; field7?: pb<7, bool>; field8?: pb<8, bool>; } -export interface OidbGroupListConfig3 { field5?: pb<5, bool>; field6?: pb<6, bool>; } -export interface OidbGroupListConfig { config1?: pb<1, OidbGroupListConfig1>; config2?: pb<2, OidbGroupListConfig2>; config3?: pb<3, OidbGroupListConfig3>; } -export interface OidbGroupListRequest { config?: pb<1, OidbGroupListConfig>; } -export interface OidbGroupMemberListBody { memberName?: pb<10, bool>; memberCard?: pb<11, bool>; level?: pb<12, bool>; field13?: pb<13, bool>; field16?: pb<16, bool>; specialTitle?: pb<17, bool>; field18?: pb<18, bool>; field20?: pb<20, bool>; field21?: pb<21, bool>; joinTimestamp?: pb<100, bool>; lastMsgTimestamp?: pb<101, bool>; shutUpTimestamp?: pb<102, bool>; field103?: pb<103, bool>; field104?: pb<104, bool>; field105?: pb<105, bool>; field106?: pb<106, bool>; permission?: pb<107, bool>; field200?: pb<200, bool>; field201?: pb<201, bool>; } -export interface OidbGroupMemberListRequest { groupUin?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; body?: pb<4, OidbGroupMemberListBody>; token?: pb<15, string>; } -export interface GroupRecallInfo { sequence?: pb<1, uint_32>; random?: pb<2, uint_32>; field3?: pb<3, uint_32>; } -export interface GroupRecallSettings { field1?: pb<1, uint_32>; } -export interface GroupRecallRequest { type?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; info?: pb<3, GroupRecallInfo>; settings?: pb<4, GroupRecallSettings>; } -export interface C2CRecallInfo { clientSequence?: pb<1, uint_32>; random?: pb<2, uint_32>; messageId?: pb<3, uint_64>; timestamp?: pb<4, uint_32>; field5?: pb<5, uint_32>; messageSequence?: pb<6, uint_32>; } -export interface C2CRecallSettings { field1?: pb<1, bool>; field2?: pb<2, bool>; } -export interface C2CRecallRequest { type?: pb<1, uint_32>; targetUid?: pb<3, string>; info?: pb<4, C2CRecallInfo>; settings?: pb<5, C2CRecallSettings>; field6?: pb<6, bool>; } -export interface OidbGroupReaction { groupUin?: pb<1, uint_32>; sequence?: pb<2, uint_32>; code?: pb<3, string>; type?: pb<4, uint_32>; } -export interface GroupReadedReportItem { groupUin?: pb<1, uint_64>; lastReadSeq?: pb<2, uint_64>; } -export interface C2CReadedReportItem { uid?: pb<2, string>; lastReadTime?: pb<3, uint_64>; lastReadSeq?: pb<4, uint_64>; } -export interface SsoReadedReportReq { groupList?: pb_repeated<1, GroupReadedReportItem>; c2cList?: pb_repeated<2, C2CReadedReportItem>; } +export interface OidbMuteMemberBody { + targetUid?: pb<1, string>; + duration?: pb<2, uint_32>; +} +export interface OidbMuteMember { + groupUin?: pb<1, uint_32>; + type?: pb<2, uint_32>; + body?: pb<3, OidbMuteMemberBody>; +} +export interface OidbMuteAllState { + state?: pb<17, uint_32>; +} +export interface OidbMuteAll { + groupUin?: pb<1, uint_32>; + muteState?: pb<2, OidbMuteAllState>; +} +export interface Oidb0x89a_0AddOptionSettings { + addType?: pb<16, uint_32>; +} +export interface Oidb0x89a_0AddOption { + groupUin?: pb<1, uint_64>; + settings?: pb<2, Oidb0x89a_0AddOptionSettings>; + field12?: pb<12, uint_32>; +} +export interface Oidb0x89a_0Search { + groupUin?: pb<1, uint_64>; + settings?: pb<2, bytes>; + field12?: pb<12, uint_32>; +} +export interface OidbKickMember { + groupUin?: pb<1, uint_32>; + targetUid?: pb<3, string>; + rejectAddRequest?: pb<4, bool>; + reason?: pb<5, string>; +} +export interface OidbLeaveGroup { + groupUin?: pb<1, uint_32>; +} +export interface OidbFriendRequestAction { + accept?: pb<1, uint_32>; + targetUid?: pb<2, string>; +} +export interface OidbDeleteFriendField2Field3 { + field1?: pb<1, uint_32>; + field2?: pb<2, uint_32>; + field3?: pb<3, uint_32>; +} +export interface OidbDeleteFriendField2 { + field1?: pb<1, uint_32>; + field2?: pb<2, uint_32>; + field3?: pb<3, OidbDeleteFriendField2Field3>; +} +export interface OidbDeleteFriendField1 { + targetUid?: pb<1, string>; + field2?: pb<2, OidbDeleteFriendField2>; + block?: pb<3, bool>; + field4?: pb<4, bool>; +} +export interface OidbDeleteFriend { + field1?: pb<1, OidbDeleteFriendField1>; +} +export interface OidbGroupRequestBody { + sequence?: pb<1, uint_64>; + eventType?: pb<2, uint_32>; + groupUin?: pb<3, uint_32>; + message?: pb<4, string>; +} +export interface OidbGroupRequestAction { + accept?: pb<1, uint_32>; + body?: pb<2, OidbGroupRequestBody>; +} +export interface OidbPoke { + uin?: pb<1, uint_32>; + groupUin?: pb<2, uint_32>; + friendUin?: pb<5, uint_32>; + ext?: pb<6, uint_32>; +} +export interface OidbEssence { + groupUin?: pb<1, uint_32>; + sequence?: pb<2, uint_32>; + random?: pb<3, uint_32>; +} +export interface OidbSetAdmin { + groupUin?: pb<1, uint_32>; + uid?: pb<2, string>; + isAdmin?: pb<3, bool>; +} +export interface OidbRenameMemberBody { + targetUid?: pb<1, string>; + targetName?: pb<2, string>; +} +export interface OidbRenameMember { + groupUin?: pb<1, uint_32>; + body?: pb<2, OidbRenameMemberBody>; +} +export interface OidbRenameGroupBody { + targetName?: pb<1, string>; +} +export interface OidbRenameGroup { + groupUin?: pb<1, uint_32>; + body?: pb<2, OidbRenameGroupBody>; +} +export interface OidbSpecialTitleBody { + targetUid?: pb<1, string>; + specialTitle?: pb<5, string>; + expireTime?: pb<6, int_32>; +} +export interface OidbSpecialTitle { + groupUin?: pb<1, uint_32>; + body?: pb<2, OidbSpecialTitleBody>; +} +export interface OidbLike { + targetUin?: pb<1, uint_32>; + count?: pb<2, uint_32>; +} +export interface OidbGroupRequestList { + count?: pb<1, uint_32>; + field2?: pb<2, uint_32>; +} +export interface OidbUserInfoKey { + key?: pb<1, uint_32>; +} +export interface OidbUserInfoRequest { + uin?: pb<1, uint_32>; + keys?: pb_repeated<3, OidbUserInfoKey>; +} +export interface OidbTwoNumber { + number1?: pb<1, uint_32>; + number2?: pb<2, uint_32>; +} +export interface OidbByteProperty { + code?: pb<1, uint_32>; + value?: pb<2, bytes>; +} +export interface OidbUserInfoProperty { + numberProperties?: pb_repeated<1, OidbTwoNumber>; + bytesProperties?: pb_repeated<2, OidbByteProperty>; +} +export interface OidbUserInfoResponseBody { + uid?: pb<1, string>; + properties?: pb<2, OidbUserInfoProperty>; + uin?: pb<3, uint_32>; +} +export interface OidbUserInfoResponse { + body?: pb<1, OidbUserInfoResponseBody>; +} +export interface AvatarInfo { + url?: pb<5, string>; +} +export interface OidbFriendListNumber { + numbers?: pb_repeated<1, uint_32>; +} +export interface OidbFriendListBodyItem { + type?: pb<1, uint_32>; + number?: pb<2, OidbFriendListNumber>; +} +export interface OidbFriendListNextUin { + uin?: pb<1, uint_32>; +} +export interface OidbFriendListRequest { + friendCount?: pb<2, uint_32>; + field4?: pb<4, uint_32>; + nextUin?: pb<5, OidbFriendListNextUin>; + field6?: pb<6, uint_32>; + field7?: pb<7, uint_32>; + body?: pb_repeated<10001, OidbFriendListBodyItem>; + field10002?: pb_repeated<10002, uint_32>; + field10003?: pb<10003, uint_32>; +} +export interface OidbGroupListConfig1 { + groupOwner?: pb<1, bool>; + field2?: pb<2, bool>; + memberMax?: pb<3, bool>; + memberCount?: pb<4, bool>; + groupName?: pb<5, bool>; + field8?: pb<8, bool>; + field9?: pb<9, bool>; + field10?: pb<10, bool>; + field11?: pb<11, bool>; + field12?: pb<12, bool>; + field13?: pb<13, bool>; + field14?: pb<14, bool>; + field15?: pb<15, bool>; + field16?: pb<16, bool>; + field17?: pb<17, bool>; + field18?: pb<18, bool>; + question?: pb<19, bool>; + field20?: pb<20, bool>; + field22?: pb<22, bool>; + field23?: pb<23, bool>; + field24?: pb<24, bool>; + field25?: pb<25, bool>; + field26?: pb<26, bool>; + field27?: pb<27, bool>; + field28?: pb<28, bool>; + field29?: pb<29, bool>; + field30?: pb<30, bool>; + field31?: pb<31, bool>; + field32?: pb<32, bool>; + field5001?: pb<5001, bool>; + field5002?: pb<5002, bool>; + field5003?: pb<5003, bool>; +} +export interface OidbGroupListConfig2 { + field1?: pb<1, bool>; + field2?: pb<2, bool>; + field3?: pb<3, bool>; + field4?: pb<4, bool>; + field5?: pb<5, bool>; + field6?: pb<6, bool>; + field7?: pb<7, bool>; + field8?: pb<8, bool>; +} +export interface OidbGroupListConfig3 { + field5?: pb<5, bool>; + field6?: pb<6, bool>; +} +export interface OidbGroupListConfig { + config1?: pb<1, OidbGroupListConfig1>; + config2?: pb<2, OidbGroupListConfig2>; + config3?: pb<3, OidbGroupListConfig3>; +} +export interface OidbGroupListRequest { + config?: pb<1, OidbGroupListConfig>; +} +export interface OidbGroupMemberListBody { + memberName?: pb<10, bool>; + memberCard?: pb<11, bool>; + level?: pb<12, bool>; + field13?: pb<13, bool>; + field16?: pb<16, bool>; + specialTitle?: pb<17, bool>; + field18?: pb<18, bool>; + field20?: pb<20, bool>; + field21?: pb<21, bool>; + joinTimestamp?: pb<100, bool>; + lastMsgTimestamp?: pb<101, bool>; + shutUpTimestamp?: pb<102, bool>; + field103?: pb<103, bool>; + field104?: pb<104, bool>; + field105?: pb<105, bool>; + field106?: pb<106, bool>; + permission?: pb<107, bool>; + field200?: pb<200, bool>; + field201?: pb<201, bool>; +} +export interface OidbGroupMemberListRequest { + groupUin?: pb<1, uint_32>; + field2?: pb<2, uint_32>; + field3?: pb<3, uint_32>; + body?: pb<4, OidbGroupMemberListBody>; + token?: pb<15, string>; +} +export interface GroupRecallInfo { + sequence?: pb<1, uint_32>; + random?: pb<2, uint_32>; + field3?: pb<3, uint_32>; +} +export interface GroupRecallSettings { + field1?: pb<1, uint_32>; +} +export interface GroupRecallRequest { + type?: pb<1, uint_32>; + groupUin?: pb<2, uint_32>; + info?: pb<3, GroupRecallInfo>; + settings?: pb<4, GroupRecallSettings>; +} +export interface C2CRecallInfo { + clientSequence?: pb<1, uint_32>; + random?: pb<2, uint_32>; + messageId?: pb<3, uint_64>; + timestamp?: pb<4, uint_32>; + field5?: pb<5, uint_32>; + messageSequence?: pb<6, uint_32>; +} +export interface C2CRecallSettings { + field1?: pb<1, bool>; + field2?: pb<2, bool>; +} +export interface C2CRecallRequest { + type?: pb<1, uint_32>; + targetUid?: pb<3, string>; + info?: pb<4, C2CRecallInfo>; + settings?: pb<5, C2CRecallSettings>; + field6?: pb<6, bool>; +} +export interface OidbGroupReaction { + groupUin?: pb<1, uint_32>; + sequence?: pb<2, uint_32>; + code?: pb<3, string>; + type?: pb<4, uint_32>; +} +export interface GroupReadedReportItem { + groupUin?: pb<1, uint_64>; + lastReadSeq?: pb<2, uint_64>; +} +export interface C2CReadedReportItem { + uid?: pb<2, string>; + lastReadTime?: pb<3, uint_64>; + lastReadSeq?: pb<4, uint_64>; +} +export interface SsoReadedReportReq { + groupList?: pb_repeated<1, GroupReadedReportItem>; + c2cList?: pb_repeated<2, C2CReadedReportItem>; +} export interface OidbClientKeyReq {} -export interface OidbClientKeyResp { keyIndex?: pb<2, uint_32>; clientKey?: pb<3, string>; expireTime?: pb<4, uint_32>; } -export interface OidbGetPskeyReq { domainList?: pb_repeated<1, string>; } -export interface OidbPskeyItem { domain?: pb<1, string>; pskey?: pb<2, string>; expireTime?: pb<3, uint_64>; } -export interface OidbGetPskeyResp { pskeyItems?: pb_repeated<1, OidbPskeyItem>; } -export interface SetStatusCustomExt { faceId?: pb<1, uint_32>; text?: pb<2, string>; faceType?: pb<3, uint_32>; } -export interface SetStatusReq { status?: pb<1, int_32>; extStatus?: pb<2, int_32>; batteryStatus?: pb<3, int_32>; customExt?: pb<4, SetStatusCustomExt>; } -export interface SetStatusResp { errCode?: pb<1, int_32>; errMsg?: pb<2, string>; } -export interface OidbProfileStringItem { fieldId?: pb<1, uint_32>; value?: pb<2, string>; } -export interface OidbProfileIntItem { fieldId?: pb<1, uint_32>; value?: pb<2, uint_64>; } -export interface OidbSetProfile { uin?: pb<1, uint_64>; stringProfiles?: pb_repeated<2, OidbProfileStringItem>; intProfiles?: pb_repeated<3, OidbProfileIntItem>; } -export interface Oidb0x7edInteraction { totalCount?: pb<1, uint_32>; newCount?: pb<2, uint_32>; todayCount?: pb<3, uint_32>; lastTime?: pb<4, uint_64>; } -export interface Oidb0x7edUserLikeInfo { uid?: pb<1, string>; time?: pb<2, uint_64>; favoriteInfo?: pb<3, Oidb0x7edInteraction>; voteInfo?: pb<4, Oidb0x7edInteraction>; } -export interface Oidb0x7edReq { targetUid?: pb<1, string>; basic?: pb<2, uint_32>; vote?: pb<3, uint_32>; favorite?: pb<4, uint_32>; start?: pb<12, uint_32>; limit?: pb<103, uint_32>; } -export interface Oidb0x7edResp { userLikeInfos?: pb_repeated<1, Oidb0x7edUserLikeInfo>; } -export interface Oidb0x8a7Req { basic1?: pb<1, uint_32>; basic2?: pb<2, uint_32>; basic3?: pb<3, uint_32>; uin?: pb<4, uint_64>; groupId?: pb<5, uint_64>; type?: pb<12, uint_32>; } -export interface Oidb0x8a7Resp { uinRemain?: pb<2, uint_32>; groupRemain?: pb<3, uint_32>; msg?: pb<4, string>; canAtAll?: pb<6, bool>; } -export interface Oidb0xe17Req { jsonBody?: pb<3, string>; } -export interface Oidb0xe17Resp { jsonBody?: pb<4, string>; } -export interface Oidb0x112aProfileInfo { tag?: pb<1, uint_32>; value?: pb<2, string>; } -export interface Oidb0x112aReq { uin?: pb<1, uint_64>; profile?: pb<2, Oidb0x112aProfileInfo>; } +export interface OidbClientKeyResp { + keyIndex?: pb<2, uint_32>; + clientKey?: pb<3, string>; + expireTime?: pb<4, uint_32>; +} +export interface OidbGetPskeyReq { + domainList?: pb_repeated<1, string>; +} +export interface OidbPskeyItem { + domain?: pb<1, string>; + pskey?: pb<2, string>; + expireTime?: pb<3, uint_64>; +} +export interface OidbGetPskeyResp { + pskeyItems?: pb_repeated<1, OidbPskeyItem>; +} +export interface SetStatusCustomExt { + faceId?: pb<1, uint_32>; + text?: pb<2, string>; + faceType?: pb<3, uint_32>; +} +export interface SetStatusReq { + status?: pb<1, int_32>; + extStatus?: pb<2, int_32>; + batteryStatus?: pb<3, int_32>; + customExt?: pb<4, SetStatusCustomExt>; +} +export interface SetStatusResp { + errCode?: pb<1, int_32>; + errMsg?: pb<2, string>; +} +export interface OidbProfileStringItem { + fieldId?: pb<1, uint_32>; + value?: pb<2, string>; +} +export interface OidbProfileIntItem { + fieldId?: pb<1, uint_32>; + value?: pb<2, uint_64>; +} +export interface OidbSetProfile { + uin?: pb<1, uint_64>; + stringProfiles?: pb_repeated<2, OidbProfileStringItem>; + intProfiles?: pb_repeated<3, OidbProfileIntItem>; +} +export interface Oidb0x7edInteraction { + totalCount?: pb<1, uint_32>; + newCount?: pb<2, uint_32>; + todayCount?: pb<3, uint_32>; + lastTime?: pb<4, uint_64>; +} +export interface Oidb0x7edUserLikeInfo { + uid?: pb<1, string>; + time?: pb<2, uint_64>; + favoriteInfo?: pb<3, Oidb0x7edInteraction>; + voteInfo?: pb<4, Oidb0x7edInteraction>; +} +export interface Oidb0x7edReq { + targetUid?: pb<1, string>; + basic?: pb<2, uint_32>; + vote?: pb<3, uint_32>; + favorite?: pb<4, uint_32>; + start?: pb<12, uint_32>; + limit?: pb<103, uint_32>; +} +export interface Oidb0x7edResp { + userLikeInfos?: pb_repeated<1, Oidb0x7edUserLikeInfo>; +} +export interface Oidb0x8a7Req { + basic1?: pb<1, uint_32>; + basic2?: pb<2, uint_32>; + basic3?: pb<3, uint_32>; + uin?: pb<4, uint_64>; + groupId?: pb<5, uint_64>; + type?: pb<12, uint_32>; +} +export interface Oidb0x8a7Resp { + uinRemain?: pb<2, uint_32>; + groupRemain?: pb<3, uint_32>; + msg?: pb<4, string>; + canAtAll?: pb<6, bool>; +} +export interface Oidb0xe17Req { + jsonBody?: pb<3, string>; +} +export interface Oidb0xe17Resp { + jsonBody?: pb<4, string>; +} +export interface Oidb0x112aProfileInfo { + tag?: pb<1, uint_32>; + value?: pb<2, string>; +} +export interface Oidb0x112aReq { + uin?: pb<1, uint_64>; + profile?: pb<2, Oidb0x112aProfileInfo>; +} export interface Oidb0x112aResp {} -export interface Oidb0xcd4ReqBody { uid?: pb<1, string>; chatType?: pb<2, uint_32>; eventType?: pb<3, uint_32>; } -export interface Oidb0xcd4Req { reqBody?: pb<1, Oidb0xcd4ReqBody>; } +export interface Oidb0xcd4ReqBody { + uid?: pb<1, string>; + chatType?: pb<2, uint_32>; + eventType?: pb<3, uint_32>; +} +export interface Oidb0xcd4Req { + reqBody?: pb<1, Oidb0xcd4ReqBody>; +} export interface Oidb0xcd4Resp {} -export interface Oidb0x990TranslateReq { srcLang?: pb<1, string>; dstLang?: pb<2, string>; words?: pb_repeated<3, string>; } -export interface Oidb0x990Req { translateReq?: pb<2, Oidb0x990TranslateReq>; tag10?: pb<10, uint_32>; tag12?: pb<12, uint_32>; } -export interface Oidb0x990TranslateResp { errorCode?: pb<1, uint_32>; errorMsg?: pb<2, string>; srcLang?: pb<3, string>; dstLang?: pb<4, string>; srcWords?: pb_repeated<5, string>; dstWords?: pb_repeated<6, string>; } -export interface Oidb0x990Resp { translateResp?: pb<2, Oidb0x990TranslateResp>; } -export interface MiniAppShareReqBody { appid?: pb<2, string>; title?: pb<3, string>; desc?: pb<4, string>; picUrl?: pb<9, string>; jumpUrl?: pb<11, string>; iconUrl?: pb<12, string>; } -export interface MiniAppShareReq { sdkVersion?: pb<2, string>; body?: pb<4, MiniAppShareReqBody>; } -export interface MiniAppShareRespBody { jsonStr?: pb<2, string>; } -export interface MiniAppShareResp { status?: pb<2, uint_32>; msg?: pb<3, string>; body?: pb<4, MiniAppShareRespBody>; } -export interface Oidb0x112eReq { botAppid?: pb<3, uint_64>; msgSeq?: pb<4, uint_64>; buttonId?: pb<5, string>; callbackData?: pb<6, string>; unknown7?: pb<7, uint_32>; groupId?: pb<8, uint_64>; unknown9?: pb<9, uint_32>; } -export interface Oidb0x112eResp { result?: pb<3, uint_32>; promptText?: pb<4, string>; errMsg?: pb<5, string>; } -export interface Oidb0xeb7SignInInfo { uin?: pb<1, string>; groupId?: pb<2, string>; version?: pb<3, string>; } -export interface Oidb0xeb7Req { signInInfo?: pb<2, Oidb0xeb7SignInInfo>; } +export interface Oidb0x990TranslateReq { + srcLang?: pb<1, string>; + dstLang?: pb<2, string>; + words?: pb_repeated<3, string>; +} +export interface Oidb0x990Req { + translateReq?: pb<2, Oidb0x990TranslateReq>; + tag10?: pb<10, uint_32>; + tag12?: pb<12, uint_32>; +} +export interface Oidb0x990TranslateResp { + errorCode?: pb<1, uint_32>; + errorMsg?: pb<2, string>; + srcLang?: pb<3, string>; + dstLang?: pb<4, string>; + srcWords?: pb_repeated<5, string>; + dstWords?: pb_repeated<6, string>; +} +export interface Oidb0x990Resp { + translateResp?: pb<2, Oidb0x990TranslateResp>; +} +export interface MiniAppShareReqBody { + appid?: pb<2, string>; + title?: pb<3, string>; + desc?: pb<4, string>; + picUrl?: pb<9, string>; + jumpUrl?: pb<11, string>; + iconUrl?: pb<12, string>; +} +export interface MiniAppShareReq { + sdkVersion?: pb<2, string>; + body?: pb<4, MiniAppShareReqBody>; +} +export interface MiniAppShareRespBody { + jsonStr?: pb<2, string>; +} +export interface MiniAppShareResp { + status?: pb<2, uint_32>; + msg?: pb<3, string>; + body?: pb<4, MiniAppShareRespBody>; +} +export interface Oidb0x112eReq { + botAppid?: pb<3, uint_64>; + msgSeq?: pb<4, uint_64>; + buttonId?: pb<5, string>; + callbackData?: pb<6, string>; + unknown7?: pb<7, uint_32>; + groupId?: pb<8, uint_64>; + unknown9?: pb<9, uint_32>; +} +export interface Oidb0x112eResp { + result?: pb<3, uint_32>; + promptText?: pb<4, string>; + errMsg?: pb<5, string>; +} +export interface Oidb0xeb7SignInInfo { + uin?: pb<1, string>; + groupId?: pb<2, string>; + version?: pb<3, string>; +} +export interface Oidb0xeb7Req { + signInInfo?: pb<2, Oidb0xeb7SignInInfo>; +} export interface Oidb0xeb7Resp {} -export interface FaceroamOpReqInner { field1?: pb<1, uint_32>; osVersion?: pb<2, string>; qqVersion?: pb<3, string>; } -export interface FaceroamOpReq { inner?: pb<1, FaceroamOpReqInner>; uin?: pb<2, uint_64>; field3?: pb<3, uint_32>; field6?: pb<6, uint_32>; } -export interface FaceroamOpRespItem { faceIds?: pb_repeated<1, string>; category?: pb<3, string>; totalCount?: pb<4, uint_32>; } -export interface FaceroamOpResp { retCode?: pb<1, uint_32>; message?: pb<2, string>; field3?: pb<3, uint_32>; item?: pb<4, FaceroamOpRespItem>; } -export interface Oidb0x9083Req { groupId?: pb<2, uint_64>; sequence?: pb<3, uint_32>; emojiType?: pb<4, uint_32>; emojiId?: pb<5, string>; cookie?: pb<6, bytes>; field7?: pb<7, uint_32>; count?: pb<8, uint_32>; field12?: pb<12, uint_32>; } -export interface Oidb0x9083RespUserInfo { uin?: pb<1, uint_64>; field3?: pb<3, uint_32>; } -export interface Oidb0x9083RespInner { userInfo?: pb<1, Oidb0x9083RespUserInfo>; field4?: pb<4, uint_32>; } -export interface Oidb0x9083Resp { inner?: pb<4, Oidb0x9083RespInner>; cookie?: pb<5, bytes>; } -export interface Oidb0x8a0Req { groupId?: pb<1, uint_64>; targetUids?: pb_repeated<3, string>; rejectAddRequest?: pb<4, uint_32>; kickReason?: pb<5, bytes>; field12?: pb<12, uint_32>; } +export interface FaceroamOpReqInner { + field1?: pb<1, uint_32>; + osVersion?: pb<2, string>; + qqVersion?: pb<3, string>; +} +export interface FaceroamOpReq { + inner?: pb<1, FaceroamOpReqInner>; + uin?: pb<2, uint_64>; + field3?: pb<3, uint_32>; + field6?: pb<6, uint_32>; +} +export interface FaceroamOpRespItem { + faceIds?: pb_repeated<1, string>; + category?: pb<3, string>; + totalCount?: pb<4, uint_32>; +} +export interface FaceroamOpResp { + retCode?: pb<1, uint_32>; + message?: pb<2, string>; + field3?: pb<3, uint_32>; + item?: pb<4, FaceroamOpRespItem>; +} +export interface Oidb0x9083Req { + groupId?: pb<2, uint_64>; + sequence?: pb<3, uint_32>; + emojiType?: pb<4, uint_32>; + emojiId?: pb<5, string>; + cookie?: pb<6, bytes>; + field7?: pb<7, uint_32>; + count?: pb<8, uint_32>; + field12?: pb<12, uint_32>; +} +export interface Oidb0x9083RespUserInfo { + uin?: pb<1, uint_64>; + field3?: pb<3, uint_32>; +} +export interface Oidb0x9083RespInner { + userInfo?: pb<1, Oidb0x9083RespUserInfo>; + field4?: pb<4, uint_32>; +} +export interface Oidb0x9083Resp { + inner?: pb<4, Oidb0x9083RespInner>; + cookie?: pb<5, bytes>; +} +export interface Oidb0x8a0Req { + groupId?: pb<1, uint_64>; + targetUids?: pb_repeated<3, string>; + rejectAddRequest?: pb<4, uint_32>; + kickReason?: pb<5, bytes>; + field12?: pb<12, uint_32>; +} export interface Oidb0x8a0Resp {} -export interface Oidb0xf16Inner { groupId?: pb<1, uint_64>; remark?: pb<3, string>; } -export interface Oidb0xf16Req { inner?: pb<1, Oidb0xf16Inner>; field12?: pb<12, uint_32>; } +export interface Oidb0xf16Inner { + groupId?: pb<1, uint_64>; + remark?: pb<3, string>; +} +export interface Oidb0xf16Req { + inner?: pb<1, Oidb0xf16Inner>; + field12?: pb<12, uint_32>; +} export interface Oidb0xf16Resp {} -export interface OidbGroupTodo { groupUin?: pb<1, uint_32>; msgSeq?: pb<2, uint_64>; } -export interface OidbStrangerStatusKey { key?: pb<1, uint_32>; } -export interface OidbStrangerStatusReq { uin?: pb<1, uint_32>; key?: pb_repeated<3, OidbStrangerStatusKey>; } -export interface OidbSetFriendRemark { targetUid?: pb<1, string>; remark?: pb<2, string>; } -export interface OidbStrangerStatusRespStatus { key?: pb<1, uint_32>; value?: pb<2, uint_64>; } -export interface OidbStrangerStatusRespData { status?: pb<2, OidbStrangerStatusRespStatus>; } -export interface OidbStrangerStatusResp { data?: pb<1, OidbStrangerStatusRespData>; } -export interface GroupAvatarExtraField3 { field1?: pb<1, uint_32>; } -export interface GroupAvatarExtra { type?: pb<1, uint_32>; groupUin?: pb<2, uint_32>; field3?: pb<3, GroupAvatarExtraField3>; field5?: pb<5, uint_32>; field6?: pb<6, uint_32>; } \ No newline at end of file +export interface OidbGroupTodo { + groupUin?: pb<1, uint_32>; + msgSeq?: pb<2, uint_64>; +} +export interface OidbStrangerStatusKey { + key?: pb<1, uint_32>; +} +export interface OidbStrangerStatusReq { + uin?: pb<1, uint_32>; + key?: pb_repeated<3, OidbStrangerStatusKey>; +} +export interface OidbSetFriendRemark { + targetUid?: pb<1, string>; + remark?: pb<2, string>; +} +export interface OidbStrangerStatusRespStatus { + key?: pb<1, uint_32>; + value?: pb<2, uint_64>; +} +export interface OidbStrangerStatusRespData { + status?: pb<2, OidbStrangerStatusRespStatus>; +} +export interface OidbStrangerStatusResp { + data?: pb<1, OidbStrangerStatusRespData>; +} +export interface GroupAvatarExtraField3 { + field1?: pb<1, uint_32>; +} +export interface GroupAvatarExtra { + type?: pb<1, uint_32>; + groupUin?: pb<2, uint_32>; + field3?: pb<3, GroupAvatarExtraField3>; + field5?: pb<5, uint_32>; + field6?: pb<6, uint_32>; +} \ No newline at end of file diff --git a/packages/core/src/bridge/proto/proton/oidb-actions/group-album.ts b/packages/core/src/bridge/proto/proton/oidb-actions/group-album.ts index 81c8afca..4692e529 100644 --- a/packages/core/src/bridge/proto/proton/oidb-actions/group-album.ts +++ b/packages/core/src/bridge/proto/proton/oidb-actions/group-album.ts @@ -1,43 +1,216 @@ import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton'; -export interface ExtMapEntry { key?: pb<1, string>; value?: pb<2, string>; } -export interface ReqInfo { groupId?: pb<1, string>; albumId?: pb<2, string>; field3?: pb<3, int_32>; attachInfo?: pb<4, string>; field5?: pb<5, string>; } -export interface GetMediaListRequest { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; reqInfo?: pb<4, ReqInfo>; traceId?: pb<5, string>; extMap?: pb_repeated<10, ExtMapEntry>; } -export interface UrlInfo { url?: pb<1, string>; width?: pb<2, uint_32>; height?: pb<3, uint_32>; } -export interface PhotoUrl { spec?: pb<1, uint_32>; url?: pb<2, UrlInfo>; } -export interface ImageInfo { name?: pb<1, string>; sloc?: pb<2, string>; lloc?: pb<3, string>; photoUrls?: pb_repeated<4, PhotoUrl>; defaultUrl?: pb<5, UrlInfo>; isGif?: pb<6, bool>; hasRaw?: pb<7, bool>; } -export interface MediaInfo { type?: pb<1, uint_32>; image?: pb<2, ImageInfo>; uploader?: pb<6, string>; batchId?: pb<7, uint_64>; uploadTime?: pb<8, uint_64>; } -export interface GetMediaListAlbumInfo { albumId?: pb<1, string>; owner?: pb<2, string>; name?: pb<3, string>; } -export interface GetMediaListRspData { albumInfo?: pb<1, GetMediaListAlbumInfo>; mediaList?: pb_repeated<3, MediaInfo>; prevAttachInfo?: pb<4, string>; nextAttachInfo?: pb<5, string>; } -export interface GetMediaListResponse { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; data?: pb<4, GetMediaListRspData>; } -export interface CommentContentItem { type?: pb<1, uint_32>; content?: pb<2, string>; } -export interface CommentUser { uin?: pb<13, string>; } -export interface CommentReqContentMeta { field1?: pb<1, uint_32>; field2?: pb<2, string>; field3?: pb<3, string>; field4?: pb<4, string>; field5?: pb<5, uint_32>; field6?: pb<6, string>; } -export interface CommentReqContent { field2?: pb<2, CommentUser>; field3?: pb<3, CommentReqContentMeta>; clientKey?: pb<7, string>; } -export interface CommentReqPhotoMeta { field1?: pb<1, uint_32>; field2?: pb<2, string>; lloc?: pb<3, string>; field4?: pb<4, string>; field6?: pb<6, string>; field7?: pb<7, uint_32>; field8?: pb<8, uint_32>; field9?: pb<9, uint_32>; field14?: pb<14, uint_32>; field15?: pb<15, uint_32>; field17?: pb<17, uint_32>; } -export interface CommentReqPhotoWrap { field2?: pb<2, CommentReqPhotoMeta>; } -export interface CommentReqPhotoInfo { field1?: pb<1, CommentReqPhotoWrap>; albumId?: pb<3, string>; field5?: pb<5, uint_32>; } -export interface CommentReqBodyHeader { field3?: pb<3, uint_32>; field4?: pb<4, string>; } -export interface CommentReqBodyUserWrap { field1?: pb<1, CommentUser>; } -export interface CommentReqBody { field1?: pb<1, CommentReqBodyHeader>; field2?: pb<2, CommentReqBodyUserWrap>; field5?: pb<5, CommentReqPhotoInfo>; } -export interface DoQunCommentRequestBody { groupId?: pb<2, string>; field3?: pb<3, uint_32>; reqBody?: pb<4, CommentReqBody>; field5?: pb<5, CommentReqContent>; } -export interface DoQunCommentRequest { field1?: pb<1, int_32>; field2?: pb<2, bytes>; field3?: pb<3, bytes>; body?: pb<4, DoQunCommentRequestBody>; traceId?: pb<5, string>; extMap?: pb_repeated<10, ExtMapEntry>; } -export interface CommentRespUser { uin?: pb<13, string>; } -export interface CommentRespContent { type?: pb<1, uint_32>; content?: pb<2, string>; } -export interface CommentRespData { id?: pb<1, string>; user?: pb<2, CommentRespUser>; content?: pb_repeated<3, CommentRespContent>; time?: pb<4, uint_64>; clientKey?: pb<7, string>; } -export interface DoQunCommentResponseComment { data?: pb<2, CommentRespData>; } -export interface DoQunCommentResponse { field1?: pb<1, int_32>; comment?: pb<4, DoQunCommentResponseComment>; } -export interface DoQunLikeReqLikeInfo { id?: pb<1, string>; status?: pb<3, uint_32>; } -export interface DoQunLikeReqCellCommon { time?: pb<3, uint_64>; feedId?: pb<4, string>; } -export interface DoQunLikeReqCellUser { uin?: pb<13, string>; } -export interface DoQunLikeReqCellUserInfo { user?: pb<1, DoQunLikeReqCellUser>; } -export interface DoQunLikeReqCellQunInfo { qunId?: pb<1, string>; } -export interface DoQunLikeReqCellMedia { albumId?: pb<3, string>; batchId?: pb<5, uint_64>; } -export interface DoQunLikeReqFeedPublish { cellCommon?: pb<1, DoQunLikeReqCellCommon>; cellUserInfo?: pb<2, DoQunLikeReqCellUserInfo>; cellMedia?: pb<5, DoQunLikeReqCellMedia>; cellQunInfo?: pb<12, DoQunLikeReqCellQunInfo>; } -export interface DoQunLikeReqBody { type?: pb<2, uint_32>; like?: pb<3, DoQunLikeReqLikeInfo>; publish?: pb<4, DoQunLikeReqFeedPublish>; clientKey?: pb<5, string>; } -export interface DoQunLikeRequest { field1?: pb<1, int_32>; field2?: pb<2, string>; field3?: pb<3, string>; body?: pb<4, DoQunLikeReqBody>; extMap?: pb_repeated<10, ExtMapEntry>; } -export interface DoQunLikeRespBody { like?: pb<2, DoQunLikeReqLikeInfo>; } -export interface DoQunLikeResponse { field1?: pb<1, int_32>; body?: pb<4, DoQunLikeRespBody>; } -export interface DeleteMediasReqBody { groupId?: pb<1, string>; albumId?: pb<2, string>; lloc?: pb<3, string>; } -export interface DeleteMediasRequest { field1?: pb<1, int_32>; field2?: pb<2, string>; field3?: pb<3, string>; body?: pb<4, DeleteMediasReqBody>; traceId?: pb<5, string>; extMap?: pb_repeated<10, ExtMapEntry>; } -export interface DeleteMediasResponse { field1?: pb<1, int_32>; field2?: pb<2, int_32>; field3?: pb<3, string>; } \ No newline at end of file +export interface ExtMapEntry { + key?: pb<1, string>; + value?: pb<2, string>; +} +export interface ReqInfo { + groupId?: pb<1, string>; + albumId?: pb<2, string>; + field3?: pb<3, int_32>; + attachInfo?: pb<4, string>; + field5?: pb<5, string>; +} +export interface GetMediaListRequest { + field1?: pb<1, int_32>; + field2?: pb<2, bytes>; + field3?: pb<3, bytes>; + reqInfo?: pb<4, ReqInfo>; + traceId?: pb<5, string>; + extMap?: pb_repeated<10, ExtMapEntry>; +} +export interface UrlInfo { + url?: pb<1, string>; + width?: pb<2, uint_32>; + height?: pb<3, uint_32>; +} +export interface PhotoUrl { + spec?: pb<1, uint_32>; + url?: pb<2, UrlInfo>; +} +export interface ImageInfo { + name?: pb<1, string>; + sloc?: pb<2, string>; + lloc?: pb<3, string>; + photoUrls?: pb_repeated<4, PhotoUrl>; + defaultUrl?: pb<5, UrlInfo>; + isGif?: pb<6, bool>; + hasRaw?: pb<7, bool>; +} +export interface MediaInfo { + type?: pb<1, uint_32>; + image?: pb<2, ImageInfo>; + uploader?: pb<6, string>; + batchId?: pb<7, uint_64>; + uploadTime?: pb<8, uint_64>; +} +export interface GetMediaListAlbumInfo { + albumId?: pb<1, string>; + owner?: pb<2, string>; + name?: pb<3, string>; +} +export interface GetMediaListRspData { + albumInfo?: pb<1, GetMediaListAlbumInfo>; + mediaList?: pb_repeated<3, MediaInfo>; + prevAttachInfo?: pb<4, string>; + nextAttachInfo?: pb<5, string>; +} +export interface GetMediaListResponse { + field1?: pb<1, int_32>; + field2?: pb<2, bytes>; + field3?: pb<3, bytes>; + data?: pb<4, GetMediaListRspData>; +} +export interface CommentContentItem { + type?: pb<1, uint_32>; + content?: pb<2, string>; +} +export interface CommentUser { + uin?: pb<13, string>; +} +export interface CommentReqContentMeta { + field1?: pb<1, uint_32>; + field2?: pb<2, string>; + field3?: pb<3, string>; + field4?: pb<4, string>; + field5?: pb<5, uint_32>; + field6?: pb<6, string>; +} +export interface CommentReqContent { + field2?: pb<2, CommentUser>; + field3?: pb<3, CommentReqContentMeta>; + clientKey?: pb<7, string>; +} +export interface CommentReqPhotoMeta { + field1?: pb<1, uint_32>; + field2?: pb<2, string>; + lloc?: pb<3, string>; + field4?: pb<4, string>; + field6?: pb<6, string>; + field7?: pb<7, uint_32>; + field8?: pb<8, uint_32>; + field9?: pb<9, uint_32>; + field14?: pb<14, uint_32>; + field15?: pb<15, uint_32>; + field17?: pb<17, uint_32>; +} +export interface CommentReqPhotoWrap { + field2?: pb<2, CommentReqPhotoMeta>; +} +export interface CommentReqPhotoInfo { + field1?: pb<1, CommentReqPhotoWrap>; + albumId?: pb<3, string>; + field5?: pb<5, uint_32>; +} +export interface CommentReqBodyHeader { + field3?: pb<3, uint_32>; + field4?: pb<4, string>; +} +export interface CommentReqBodyUserWrap { + field1?: pb<1, CommentUser>; +} +export interface CommentReqBody { + field1?: pb<1, CommentReqBodyHeader>; + field2?: pb<2, CommentReqBodyUserWrap>; + field5?: pb<5, CommentReqPhotoInfo>; +} +export interface DoQunCommentRequestBody { + groupId?: pb<2, string>; + field3?: pb<3, uint_32>; + reqBody?: pb<4, CommentReqBody>; + field5?: pb<5, CommentReqContent>; +} +export interface DoQunCommentRequest { + field1?: pb<1, int_32>; + field2?: pb<2, bytes>; + field3?: pb<3, bytes>; + body?: pb<4, DoQunCommentRequestBody>; + traceId?: pb<5, string>; + extMap?: pb_repeated<10, ExtMapEntry>; +} +export interface CommentRespUser { + uin?: pb<13, string>; +} +export interface CommentRespContent { + type?: pb<1, uint_32>; + content?: pb<2, string>; +} +export interface CommentRespData { + id?: pb<1, string>; + user?: pb<2, CommentRespUser>; + content?: pb_repeated<3, CommentRespContent>; + time?: pb<4, uint_64>; + clientKey?: pb<7, string>; +} +export interface DoQunCommentResponseComment { + data?: pb<2, CommentRespData>; +} +export interface DoQunCommentResponse { + field1?: pb<1, int_32>; + comment?: pb<4, DoQunCommentResponseComment>; +} +export interface DoQunLikeReqLikeInfo { + id?: pb<1, string>; + status?: pb<3, uint_32>; +} +export interface DoQunLikeReqCellCommon { + time?: pb<3, uint_64>; + feedId?: pb<4, string>; +} +export interface DoQunLikeReqCellUser { + uin?: pb<13, string>; +} +export interface DoQunLikeReqCellUserInfo { + user?: pb<1, DoQunLikeReqCellUser>; +} +export interface DoQunLikeReqCellQunInfo { + qunId?: pb<1, string>; +} +export interface DoQunLikeReqCellMedia { + albumId?: pb<3, string>; + batchId?: pb<5, uint_64>; +} +export interface DoQunLikeReqFeedPublish { + cellCommon?: pb<1, DoQunLikeReqCellCommon>; + cellUserInfo?: pb<2, DoQunLikeReqCellUserInfo>; + cellMedia?: pb<5, DoQunLikeReqCellMedia>; + cellQunInfo?: pb<12, DoQunLikeReqCellQunInfo>; +} +export interface DoQunLikeReqBody { + type?: pb<2, uint_32>; + like?: pb<3, DoQunLikeReqLikeInfo>; + publish?: pb<4, DoQunLikeReqFeedPublish>; + clientKey?: pb<5, string>; +} +export interface DoQunLikeRequest { + field1?: pb<1, int_32>; + field2?: pb<2, string>; + field3?: pb<3, string>; + body?: pb<4, DoQunLikeReqBody>; + extMap?: pb_repeated<10, ExtMapEntry>; +} +export interface DoQunLikeRespBody { + like?: pb<2, DoQunLikeReqLikeInfo>; +} +export interface DoQunLikeResponse { + field1?: pb<1, int_32>; + body?: pb<4, DoQunLikeRespBody>; +} +export interface DeleteMediasReqBody { + groupId?: pb<1, string>; + albumId?: pb<2, string>; + lloc?: pb<3, string>; +} +export interface DeleteMediasRequest { + field1?: pb<1, int_32>; + field2?: pb<2, string>; + field3?: pb<3, string>; + body?: pb<4, DeleteMediasReqBody>; + traceId?: pb<5, string>; + extMap?: pb_repeated<10, ExtMapEntry>; +} +export interface DeleteMediasResponse { + field1?: pb<1, int_32>; + field2?: pb<2, int_32>; + field3?: pb<3, string>; +} \ No newline at end of file diff --git a/packages/core/src/bridge/proto/proton/oidb-actions/group-file.ts b/packages/core/src/bridge/proto/proton/oidb-actions/group-file.ts index 98f588cc..40ed92d4 100644 --- a/packages/core/src/bridge/proto/proton/oidb-actions/group-file.ts +++ b/packages/core/src/bridge/proto/proton/oidb-actions/group-file.ts @@ -1,31 +1,185 @@ import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton'; -export interface OidbGroupFileListReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; targetDirectory?: pb<3, string>; fileCount?: pb<5, uint_32>; sortBy?: pb<9, uint_32>; startIndex?: pb<13, uint_32>; field17?: pb<17, uint_32>; field18?: pb<18, uint_32>; } -export interface OidbGroupFileViewReq { list?: pb<2, OidbGroupFileListReq>; } -export interface OidbGroupFileListFolderResp { folderId?: pb<1, string>; parentDirectoryId?: pb<2, string>; folderName?: pb<3, string>; createTime?: pb<4, uint_32>; modifiedTime?: pb<5, uint_32>; creatorUin?: pb<6, uint_32>; creatorName?: pb<7, string>; totalFileCount?: pb<8, uint_32>; } -export interface OidbGroupFileListFileResp { fileId?: pb<1, string>; fileName?: pb<2, string>; fileSize?: pb<3, uint_64>; busId?: pb<4, uint_32>; uploadedTime?: pb<6, uint_32>; expireTime?: pb<7, uint_32>; modifiedTime?: pb<8, uint_32>; downloadedTimes?: pb<9, uint_32>; uploaderName?: pb<14, string>; uploaderUin?: pb<15, uint_32>; parentDirectory?: pb<16, string>; } -export interface OidbGroupFileListItemResp { type?: pb<1, uint_32>; folderInfo?: pb<2, OidbGroupFileListFolderResp>; fileInfo?: pb<3, OidbGroupFileListFileResp>; } -export interface OidbGroupFileListResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; isEnd?: pb<4, bool>; items?: pb_repeated<5, OidbGroupFileListItemResp>; } -export interface OidbGroupFileViewResp { list?: pb<2, OidbGroupFileListResp>; } -export interface OidbGroupFileUploadReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; entrance?: pb<4, uint_32>; targetDirectory?: pb<5, string>; fileName?: pb<6, string>; localDirectory?: pb<7, string>; fileSize?: pb<8, uint_64>; fileSha1?: pb<9, bytes>; fileSha3?: pb<10, bytes>; fileMd5?: pb<11, bytes>; field15?: pb<15, bool>; } -export interface OidbGroupFileDownloadReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<4, string>; } -export interface OidbGroupFileDeleteReq { groupUin?: pb<1, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<5, string>; } -export interface OidbGroupFileMoveReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; fileId?: pb<4, string>; parentDirectory?: pb<5, string>; targetDirectory?: pb<6, string>; } -export interface OidbGroupFileReq { file?: pb<1, OidbGroupFileUploadReq>; download?: pb<3, OidbGroupFileDownloadReq>; delete?: pb<4, OidbGroupFileDeleteReq>; move?: pb<6, OidbGroupFileMoveReq>; } -export interface OidbGroupFileUploadResp { retCode?: pb<1, int_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; uploadIp?: pb<4, string>; serverDns?: pb<5, string>; busId?: pb<6, int_32>; fileId?: pb<7, string>; checkKey?: pb<8, bytes>; fileKey?: pb<9, bytes>; boolFileExist?: pb<10, bool>; uploadPort?: pb<14, uint_32>; } -export interface OidbGroupFileDownloadResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; downloadIp?: pb<4, string>; downloadDns?: pb<5, string>; downloadUrl?: pb<6, bytes>; saveFileName?: pb<11, string>; } -export interface OidbGroupFileRetResp { retCode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; } -export interface OidbGroupFileResp { upload?: pb<1, OidbGroupFileUploadResp>; download?: pb<3, OidbGroupFileDownloadResp>; delete?: pb<4, OidbGroupFileRetResp>; move?: pb<6, OidbGroupFileRetResp>; } -export interface OidbGroupSendFileInfo { busiType?: pb<1, uint_32>; fileId?: pb<2, string>; field3?: pb<3, uint_32>; field4?: pb<4, string>; field5?: pb<5, bool>; } -export interface OidbGroupSendFileBody { groupUin?: pb<1, uint_32>; type?: pb<2, uint_32>; info?: pb<3, OidbGroupSendFileInfo>; } -export interface OidbGroupSendFileReq { body?: pb<5, OidbGroupSendFileBody>; } -export interface OidbGroupFileCreateFolderReq { groupUin?: pb<1, uint_32>; rootDirectory?: pb<3, string>; folderName?: pb<4, string>; } -export interface OidbGroupFileDeleteFolderReq { groupUin?: pb<1, uint_32>; folderId?: pb<3, string>; } -export interface OidbGroupFileRenameFolderReq { groupUin?: pb<1, uint_32>; folderId?: pb<3, string>; newFolderName?: pb<4, string>; } -export interface OidbGroupFileFolderReq { create?: pb<1, OidbGroupFileCreateFolderReq>; delete?: pb<2, OidbGroupFileDeleteFolderReq>; rename?: pb<3, OidbGroupFileRenameFolderReq>; } -export interface OidbGroupFileFolderRetResp { retcode?: pb<1, uint_32>; retMsg?: pb<2, string>; clientWording?: pb<3, string>; } -export interface OidbGroupFileFolderResp { create?: pb<1, OidbGroupFileFolderRetResp>; delete?: pb<2, OidbGroupFileFolderRetResp>; rename?: pb<3, OidbGroupFileFolderRetResp>; } -export interface OidbGroupFileCountReq { groupUin?: pb<1, uint_32>; appId?: pb<2, uint_32>; busId?: pb<3, uint_32>; } -export interface OidbGroupFileCountResp { fileCount?: pb<1, uint_32>; maxCount?: pb<2, uint_32>; isEnd?: pb<3, bool>; } -export interface OidbGroupFileCountViewReq { count?: pb<3, OidbGroupFileCountReq>; } -export interface OidbGroupFileCountViewResp { count?: pb<3, OidbGroupFileCountResp>; } \ No newline at end of file +export interface OidbGroupFileListReq { + groupUin?: pb<1, uint_32>; + appId?: pb<2, uint_32>; + targetDirectory?: pb<3, string>; + fileCount?: pb<5, uint_32>; + sortBy?: pb<9, uint_32>; + startIndex?: pb<13, uint_32>; + field17?: pb<17, uint_32>; + field18?: pb<18, uint_32>; +} +export interface OidbGroupFileViewReq { + list?: pb<2, OidbGroupFileListReq>; +} +export interface OidbGroupFileListFolderResp { + folderId?: pb<1, string>; + parentDirectoryId?: pb<2, string>; + folderName?: pb<3, string>; + createTime?: pb<4, uint_32>; + modifiedTime?: pb<5, uint_32>; + creatorUin?: pb<6, uint_32>; + creatorName?: pb<7, string>; + totalFileCount?: pb<8, uint_32>; +} +export interface OidbGroupFileListFileResp { + fileId?: pb<1, string>; + fileName?: pb<2, string>; + fileSize?: pb<3, uint_64>; + busId?: pb<4, uint_32>; + uploadedTime?: pb<6, uint_32>; + expireTime?: pb<7, uint_32>; + modifiedTime?: pb<8, uint_32>; + downloadedTimes?: pb<9, uint_32>; + uploaderName?: pb<14, string>; + uploaderUin?: pb<15, uint_32>; + parentDirectory?: pb<16, string>; +} +export interface OidbGroupFileListItemResp { + type?: pb<1, uint_32>; + folderInfo?: pb<2, OidbGroupFileListFolderResp>; + fileInfo?: pb<3, OidbGroupFileListFileResp>; +} +export interface OidbGroupFileListResp { + retCode?: pb<1, uint_32>; + retMsg?: pb<2, string>; + clientWording?: pb<3, string>; + isEnd?: pb<4, bool>; + items?: pb_repeated<5, OidbGroupFileListItemResp>; +} +export interface OidbGroupFileViewResp { + list?: pb<2, OidbGroupFileListResp>; +} +export interface OidbGroupFileUploadReq { + groupUin?: pb<1, uint_32>; + appId?: pb<2, uint_32>; + busId?: pb<3, uint_32>; + entrance?: pb<4, uint_32>; + targetDirectory?: pb<5, string>; + fileName?: pb<6, string>; + localDirectory?: pb<7, string>; + fileSize?: pb<8, uint_64>; + fileSha1?: pb<9, bytes>; + fileSha3?: pb<10, bytes>; + fileMd5?: pb<11, bytes>; + field15?: pb<15, bool>; +} +export interface OidbGroupFileDownloadReq { + groupUin?: pb<1, uint_32>; + appId?: pb<2, uint_32>; + busId?: pb<3, uint_32>; + fileId?: pb<4, string>; +} +export interface OidbGroupFileDeleteReq { + groupUin?: pb<1, uint_32>; + busId?: pb<3, uint_32>; + fileId?: pb<5, string>; +} +export interface OidbGroupFileMoveReq { + groupUin?: pb<1, uint_32>; + appId?: pb<2, uint_32>; + busId?: pb<3, uint_32>; + fileId?: pb<4, string>; + parentDirectory?: pb<5, string>; + targetDirectory?: pb<6, string>; +} +export interface OidbGroupFileReq { + file?: pb<1, OidbGroupFileUploadReq>; + download?: pb<3, OidbGroupFileDownloadReq>; + delete?: pb<4, OidbGroupFileDeleteReq>; + move?: pb<6, OidbGroupFileMoveReq>; +} +export interface OidbGroupFileUploadResp { + retCode?: pb<1, int_32>; + retMsg?: pb<2, string>; + clientWording?: pb<3, string>; + uploadIp?: pb<4, string>; + serverDns?: pb<5, string>; + busId?: pb<6, int_32>; + fileId?: pb<7, string>; + checkKey?: pb<8, bytes>; + fileKey?: pb<9, bytes>; + boolFileExist?: pb<10, bool>; + uploadPort?: pb<14, uint_32>; +} +export interface OidbGroupFileDownloadResp { + retCode?: pb<1, uint_32>; + retMsg?: pb<2, string>; + clientWording?: pb<3, string>; + downloadIp?: pb<4, string>; + downloadDns?: pb<5, string>; + downloadUrl?: pb<6, bytes>; + saveFileName?: pb<11, string>; +} +export interface OidbGroupFileRetResp { + retCode?: pb<1, uint_32>; + retMsg?: pb<2, string>; + clientWording?: pb<3, string>; +} +export interface OidbGroupFileResp { + upload?: pb<1, OidbGroupFileUploadResp>; + download?: pb<3, OidbGroupFileDownloadResp>; + delete?: pb<4, OidbGroupFileRetResp>; + move?: pb<6, OidbGroupFileRetResp>; +} +export interface OidbGroupSendFileInfo { + busiType?: pb<1, uint_32>; + fileId?: pb<2, string>; + field3?: pb<3, uint_32>; + field4?: pb<4, string>; + field5?: pb<5, bool>; +} +export interface OidbGroupSendFileBody { + groupUin?: pb<1, uint_32>; + type?: pb<2, uint_32>; + info?: pb<3, OidbGroupSendFileInfo>; +} +export interface OidbGroupSendFileReq { + body?: pb<5, OidbGroupSendFileBody>; +} +export interface OidbGroupFileCreateFolderReq { + groupUin?: pb<1, uint_32>; + rootDirectory?: pb<3, string>; + folderName?: pb<4, string>; +} +export interface OidbGroupFileDeleteFolderReq { + groupUin?: pb<1, uint_32>; + folderId?: pb<3, string>; +} +export interface OidbGroupFileRenameFolderReq { + groupUin?: pb<1, uint_32>; + folderId?: pb<3, string>; + newFolderName?: pb<4, string>; +} +export interface OidbGroupFileFolderReq { + create?: pb<1, OidbGroupFileCreateFolderReq>; + delete?: pb<2, OidbGroupFileDeleteFolderReq>; + rename?: pb<3, OidbGroupFileRenameFolderReq>; +} +export interface OidbGroupFileFolderRetResp { + retcode?: pb<1, uint_32>; + retMsg?: pb<2, string>; + clientWording?: pb<3, string>; +} +export interface OidbGroupFileFolderResp { + create?: pb<1, OidbGroupFileFolderRetResp>; + delete?: pb<2, OidbGroupFileFolderRetResp>; + rename?: pb<3, OidbGroupFileFolderRetResp>; +} +export interface OidbGroupFileCountReq { + groupUin?: pb<1, uint_32>; + appId?: pb<2, uint_32>; + busId?: pb<3, uint_32>; +} +export interface OidbGroupFileCountResp { + fileCount?: pb<1, uint_32>; + maxCount?: pb<2, uint_32>; + isEnd?: pb<3, bool>; +} +export interface OidbGroupFileCountViewReq { + count?: pb<3, OidbGroupFileCountReq>; +} +export interface OidbGroupFileCountViewResp { + count?: pb<3, OidbGroupFileCountResp>; +} \ No newline at end of file diff --git a/packages/core/src/bridge/proto/proton/oidb-actions/media.ts b/packages/core/src/bridge/proto/proton/oidb-actions/media.ts index 58c28999..8509e52c 100644 --- a/packages/core/src/bridge/proto/proton/oidb-actions/media.ts +++ b/packages/core/src/bridge/proto/proton/oidb-actions/media.ts @@ -1,44 +1,242 @@ import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton'; -export interface OidbPrivateFileDownloadReqBody { receiverUid?: pb<10, string>; fileUuid?: pb<20, string>; type?: pb<30, uint_32>; fileHash?: pb<60, string>; t2?: pb<601, uint_32>; } -export interface OidbPrivateFileDownloadReq { subCommand?: pb<1, uint_32>; field2?: pb<2, uint_32>; body?: pb<14, OidbPrivateFileDownloadReqBody>; field101?: pb<101, uint_32>; field102?: pb<102, uint_32>; field200?: pb<200, uint_32>; field99999?: pb<99999, bytes>; } -export interface OidbPrivateFileDownloadRespResult { server?: pb<20, string>; port?: pb<40, uint_32>; url?: pb<50, string>; } -export interface OidbPrivateFileDownloadRespBody { state?: pb<20, string>; result?: pb<30, OidbPrivateFileDownloadRespResult>; } -export interface OidbPrivateFileDownloadResp { body?: pb<14, OidbPrivateFileDownloadRespBody>; } -export interface OidbPrivateFileUploadReqBody { senderUid?: pb<10, string>; receiverUid?: pb<20, string>; fileSize?: pb<30, uint_32>; fileName?: pb<40, string>; md510MCheckSum?: pb<50, bytes>; sha1CheckSum?: pb<60, bytes>; localPath?: pb<70, string>; md5CheckSum?: pb<110, bytes>; sha3CheckSum?: pb<120, bytes>; } -export interface OidbPrivateFileUploadReq { command?: pb<1, uint_32>; seq?: pb<2, int_32>; upload?: pb<19, OidbPrivateFileUploadReqBody>; businessId?: pb<101, int_32>; clientType?: pb<102, int_32>; flagSupportMediaPlatform?: pb<200, int_32>; } -export interface IPv4 { outIP?: pb<1, int_32>; outPort?: pb<2, int_32>; inIP?: pb<3, int_32>; inPort?: pb<4, int_32>; iPType?: pb<5, int_32>; } -export interface OidbPrivateFileUploadRespBody { retCode?: pb<10, int_32>; retMsg?: pb<20, string>; uploadIp?: pb<60, string>; uploadDomain?: pb<70, string>; uploadPort?: pb<80, uint_32>; uuid?: pb<90, string>; uploadKey?: pb<100, bytes>; boolFileExist?: pb<110, bool>; uploadIpList?: pb_repeated<130, string>; uploadHttpsPort?: pb<140, int_32>; uploadHttpsDomain?: pb<150, string>; uploadDns?: pb<160, string>; uploadLanip?: pb<170, string>; fileAddon?: pb<200, string>; rtpMediaPlatformUploadAddress?: pb_repeated<210, IPv4>; mediaPlatformUploadKey?: pb<220, bytes>; } -export interface OidbPrivateFileUploadResp { upload?: pb<19, OidbPrivateFileUploadRespBody>; } -export interface NTV2CommonHead { requestId?: pb<1, uint_32>; command?: pb<2, uint_32>; } -export interface NTV2C2CUserInfo { accountType?: pb<1, uint_32>; targetUid?: pb<2, string>; } -export interface NTV2GroupInfo { groupUin?: pb<1, uint_32>; } -export interface NTV2SceneInfo { requestType?: pb<101, uint_32>; businessType?: pb<102, uint_32>; sceneType?: pb<200, uint_32>; c2c?: pb<201, NTV2C2CUserInfo>; group?: pb<202, NTV2GroupInfo>; } -export interface NTV2ClientMeta { agentType?: pb<1, uint_32>; } -export interface NTV2ReqHead { common?: pb<1, NTV2CommonHead>; scene?: pb<2, NTV2SceneInfo>; client?: pb<3, NTV2ClientMeta>; } -export interface NTV2DownloadRKeyReq { types?: pb_repeated<1, uint_32>; } -export interface NTV2FileType { type?: pb<1, uint_32>; picFormat?: pb<2, uint_32>; videoFormat?: pb<3, uint_32>; voiceFormat?: pb<4, uint_32>; } -export interface NTV2FileInfo { fileSize?: pb<1, uint_32>; fileHash?: pb<2, string>; fileSha1?: pb<3, string>; fileName?: pb<4, string>; type?: pb<5, NTV2FileType>; width?: pb<6, uint_32>; height?: pb<7, uint_32>; time?: pb<8, uint_32>; original?: pb<9, uint_32>; } -export interface NTV2IndexNode { info?: pb<1, NTV2FileInfo>; fileUuid?: pb<2, string>; storeId?: pb<3, uint_32>; uploadTime?: pb<4, uint_32>; ttl?: pb<5, uint_32>; subType?: pb<6, uint_32>; } -export interface NTV2VideoDownloadExt { busiType?: pb<1, uint_32>; sceneType?: pb<2, uint_32>; subBusiType?: pb<3, uint_32>; } -export interface NTV2DownloadExt { video?: pb<2, NTV2VideoDownloadExt>; } -export interface NTV2DownloadReq { node?: pb<1, NTV2IndexNode>; download?: pb<2, NTV2DownloadExt>; } -export interface NTV2RichMediaReq { reqHead?: pb<1, NTV2ReqHead>; download?: pb<3, NTV2DownloadReq>; downloadRkey?: pb<4, NTV2DownloadRKeyReq>; } -export interface NTV2RespHead { common?: pb<1, NTV2CommonHead>; retCode?: pb<2, uint_32>; message?: pb<3, string>; } -export interface NTV2RKeyInfo { rkey?: pb<1, string>; rkeyTtlSec?: pb<2, uint_64>; storeId?: pb<3, uint_32>; rkeyCreateTime?: pb<4, uint_32>; type?: pb<5, uint_32>; } -export interface NTV2DownloadRKeyResp { rkeys?: pb_repeated<1, NTV2RKeyInfo>; } -export interface NTV2MediaDownloadInfo { domain?: pb<1, string>; urlPath?: pb<2, string>; httpsPort?: pb<3, uint_32>; } -export interface NTV2MediaDownloadResp { rKeyParam?: pb<1, string>; rKeyTtlSecond?: pb<2, uint_32>; info?: pb<3, NTV2MediaDownloadInfo>; rKeyCreateTime?: pb<4, uint_32>; } -export interface NTV2RichMediaResp { respHead?: pb<1, NTV2RespHead>; download?: pb<3, NTV2MediaDownloadResp>; downloadRkey?: pb<4, NTV2DownloadRKeyResp>; } -export interface OidbAiVoiceListReq { groupUin?: pb<1, uint_32>; chatType?: pb<2, uint_32>; } -export interface OidbAiVoiceListEntry { voiceId?: pb<1, string>; voiceDisplayName?: pb<2, string>; voiceExampleUrl?: pb<3, string>; } -export interface OidbAiVoiceListCategory { category?: pb<1, string>; voices?: pb_repeated<2, OidbAiVoiceListEntry>; } -export interface OidbAiVoiceListResp { content?: pb_repeated<1, OidbAiVoiceListCategory>; } -export interface OidbAiVoiceSession { sessionId?: pb<1, uint_32>; } -export interface OidbAiVoiceReq { groupUin?: pb<1, uint_32>; voiceId?: pb<2, string>; text?: pb<3, string>; chatType?: pb<4, uint_32>; session?: pb<5, OidbAiVoiceSession>; } -export interface OidbAiVoiceFileType { type?: pb<1, uint_32>; picFormat?: pb<2, uint_32>; videoFormat?: pb<3, uint_32>; voiceFormat?: pb<4, uint_32>; } -export interface OidbAiVoiceFileInfo { fileSize?: pb<1, uint_32>; fileHash?: pb<2, string>; fileSha1?: pb<3, string>; fileName?: pb<4, string>; type?: pb<5, OidbAiVoiceFileType>; width?: pb<6, uint_32>; height?: pb<7, uint_32>; time?: pb<8, uint_32>; original?: pb<9, uint_32>; } -export interface OidbAiVoiceIndexNode { info?: pb<1, OidbAiVoiceFileInfo>; fileUuid?: pb<2, string>; storeId?: pb<3, uint_32>; uploadTime?: pb<4, uint_32>; ttl?: pb<5, uint_32>; subType?: pb<6, uint_32>; } -export interface OidbAiVoiceMsgInfoBody { index?: pb<1, OidbAiVoiceIndexNode>; } -export interface OidbAiVoiceMsgInfo { msgInfoBody?: pb_repeated<1, OidbAiVoiceMsgInfoBody>; } -export interface OidbAiVoiceResp { statusCode?: pb<1, uint_32>; field2?: pb<2, uint_32>; field3?: pb<3, uint_32>; msgInfo?: pb<4, OidbAiVoiceMsgInfo>; } \ No newline at end of file +export interface OidbPrivateFileDownloadReqBody { + receiverUid?: pb<10, string>; + fileUuid?: pb<20, string>; + type?: pb<30, uint_32>; + fileHash?: pb<60, string>; + t2?: pb<601, uint_32>; +} +export interface OidbPrivateFileDownloadReq { + subCommand?: pb<1, uint_32>; + field2?: pb<2, uint_32>; + body?: pb<14, OidbPrivateFileDownloadReqBody>; + field101?: pb<101, uint_32>; + field102?: pb<102, uint_32>; + field200?: pb<200, uint_32>; + field99999?: pb<99999, bytes>; +} +export interface OidbPrivateFileDownloadRespResult { + server?: pb<20, string>; + port?: pb<40, uint_32>; + url?: pb<50, string>; +} +export interface OidbPrivateFileDownloadRespBody { + state?: pb<20, string>; + result?: pb<30, OidbPrivateFileDownloadRespResult>; +} +export interface OidbPrivateFileDownloadResp { + body?: pb<14, OidbPrivateFileDownloadRespBody>; +} +export interface OidbPrivateFileUploadReqBody { + senderUid?: pb<10, string>; + receiverUid?: pb<20, string>; + fileSize?: pb<30, uint_32>; + fileName?: pb<40, string>; + md510MCheckSum?: pb<50, bytes>; + sha1CheckSum?: pb<60, bytes>; + localPath?: pb<70, string>; + md5CheckSum?: pb<110, bytes>; + sha3CheckSum?: pb<120, bytes>; +} +export interface OidbPrivateFileUploadReq { + command?: pb<1, uint_32>; + seq?: pb<2, int_32>; + upload?: pb<19, OidbPrivateFileUploadReqBody>; + businessId?: pb<101, int_32>; + clientType?: pb<102, int_32>; + flagSupportMediaPlatform?: pb<200, int_32>; +} +export interface IPv4 { + outIP?: pb<1, int_32>; + outPort?: pb<2, int_32>; + inIP?: pb<3, int_32>; + inPort?: pb<4, int_32>; + iPType?: pb<5, int_32>; +} +export interface OidbPrivateFileUploadRespBody { + retCode?: pb<10, int_32>; + retMsg?: pb<20, string>; + uploadIp?: pb<60, string>; + uploadDomain?: pb<70, string>; + uploadPort?: pb<80, uint_32>; + uuid?: pb<90, string>; + uploadKey?: pb<100, bytes>; + boolFileExist?: pb<110, bool>; + uploadIpList?: pb_repeated<130, string>; + uploadHttpsPort?: pb<140, int_32>; + uploadHttpsDomain?: pb<150, string>; + uploadDns?: pb<160, string>; + uploadLanip?: pb<170, string>; + fileAddon?: pb<200, string>; + rtpMediaPlatformUploadAddress?: pb_repeated<210, IPv4>; + mediaPlatformUploadKey?: pb<220, bytes>; +} +export interface OidbPrivateFileUploadResp { + upload?: pb<19, OidbPrivateFileUploadRespBody>; +} +export interface NTV2CommonHead { + requestId?: pb<1, uint_32>; + command?: pb<2, uint_32>; +} +export interface NTV2C2CUserInfo { + accountType?: pb<1, uint_32>; + targetUid?: pb<2, string>; +} +export interface NTV2GroupInfo { + groupUin?: pb<1, uint_32>; +} +export interface NTV2SceneInfo { + requestType?: pb<101, uint_32>; + businessType?: pb<102, uint_32>; + sceneType?: pb<200, uint_32>; + c2c?: pb<201, NTV2C2CUserInfo>; + group?: pb<202, NTV2GroupInfo>; +} +export interface NTV2ClientMeta { + agentType?: pb<1, uint_32>; +} +export interface NTV2ReqHead { + common?: pb<1, NTV2CommonHead>; + scene?: pb<2, NTV2SceneInfo>; + client?: pb<3, NTV2ClientMeta>; +} +export interface NTV2DownloadRKeyReq { + types?: pb_repeated<1, uint_32>; +} +export interface NTV2FileType { + type?: pb<1, uint_32>; + picFormat?: pb<2, uint_32>; + videoFormat?: pb<3, uint_32>; + voiceFormat?: pb<4, uint_32>; +} +export interface NTV2FileInfo { + fileSize?: pb<1, uint_32>; + fileHash?: pb<2, string>; + fileSha1?: pb<3, string>; + fileName?: pb<4, string>; + type?: pb<5, NTV2FileType>; + width?: pb<6, uint_32>; + height?: pb<7, uint_32>; + time?: pb<8, uint_32>; + original?: pb<9, uint_32>; +} +export interface NTV2IndexNode { + info?: pb<1, NTV2FileInfo>; + fileUuid?: pb<2, string>; + storeId?: pb<3, uint_32>; + uploadTime?: pb<4, uint_32>; + ttl?: pb<5, uint_32>; + subType?: pb<6, uint_32>; +} +export interface NTV2VideoDownloadExt { + busiType?: pb<1, uint_32>; + sceneType?: pb<2, uint_32>; + subBusiType?: pb<3, uint_32>; +} +export interface NTV2DownloadExt { + video?: pb<2, NTV2VideoDownloadExt>; +} +export interface NTV2DownloadReq { + node?: pb<1, NTV2IndexNode>; + download?: pb<2, NTV2DownloadExt>; +} +export interface NTV2RichMediaReq { + reqHead?: pb<1, NTV2ReqHead>; + download?: pb<3, NTV2DownloadReq>; + downloadRkey?: pb<4, NTV2DownloadRKeyReq>; +} +export interface NTV2RespHead { + common?: pb<1, NTV2CommonHead>; + retCode?: pb<2, uint_32>; + message?: pb<3, string>; +} +export interface NTV2RKeyInfo { + rkey?: pb<1, string>; + rkeyTtlSec?: pb<2, uint_64>; + storeId?: pb<3, uint_32>; + rkeyCreateTime?: pb<4, uint_32>; + type?: pb<5, uint_32>; +} +export interface NTV2DownloadRKeyResp { + rkeys?: pb_repeated<1, NTV2RKeyInfo>; +} +export interface NTV2MediaDownloadInfo { + domain?: pb<1, string>; + urlPath?: pb<2, string>; + httpsPort?: pb<3, uint_32>; +} +export interface NTV2MediaDownloadResp { + rKeyParam?: pb<1, string>; + rKeyTtlSecond?: pb<2, uint_32>; + info?: pb<3, NTV2MediaDownloadInfo>; + rKeyCreateTime?: pb<4, uint_32>; +} +export interface NTV2RichMediaResp { + respHead?: pb<1, NTV2RespHead>; + download?: pb<3, NTV2MediaDownloadResp>; + downloadRkey?: pb<4, NTV2DownloadRKeyResp>; +} +export interface OidbAiVoiceListReq { + groupUin?: pb<1, uint_32>; + chatType?: pb<2, uint_32>; +} +export interface OidbAiVoiceListEntry { + voiceId?: pb<1, string>; + voiceDisplayName?: pb<2, string>; + voiceExampleUrl?: pb<3, string>; +} +export interface OidbAiVoiceListCategory { + category?: pb<1, string>; + voices?: pb_repeated<2, OidbAiVoiceListEntry>; +} +export interface OidbAiVoiceListResp { + content?: pb_repeated<1, OidbAiVoiceListCategory>; +} +export interface OidbAiVoiceSession { + sessionId?: pb<1, uint_32>; +} +export interface OidbAiVoiceReq { + groupUin?: pb<1, uint_32>; + voiceId?: pb<2, string>; + text?: pb<3, string>; + chatType?: pb<4, uint_32>; + session?: pb<5, OidbAiVoiceSession>; +} +export interface OidbAiVoiceFileType { + type?: pb<1, uint_32>; + picFormat?: pb<2, uint_32>; + videoFormat?: pb<3, uint_32>; + voiceFormat?: pb<4, uint_32>; +} +export interface OidbAiVoiceFileInfo { + fileSize?: pb<1, uint_32>; + fileHash?: pb<2, string>; + fileSha1?: pb<3, string>; + fileName?: pb<4, string>; + type?: pb<5, OidbAiVoiceFileType>; + width?: pb<6, uint_32>; + height?: pb<7, uint_32>; + time?: pb<8, uint_32>; + original?: pb<9, uint_32>; +} +export interface OidbAiVoiceIndexNode { + info?: pb<1, OidbAiVoiceFileInfo>; + fileUuid?: pb<2, string>; + storeId?: pb<3, uint_32>; + uploadTime?: pb<4, uint_32>; + ttl?: pb<5, uint_32>; + subType?: pb<6, uint_32>; +} +export interface OidbAiVoiceMsgInfoBody { + index?: pb<1, OidbAiVoiceIndexNode>; +} +export interface OidbAiVoiceMsgInfo { + msgInfoBody?: pb_repeated<1, OidbAiVoiceMsgInfoBody>; +} +export interface OidbAiVoiceResp { + statusCode?: pb<1, uint_32>; + field2?: pb<2, uint_32>; + field3?: pb<3, uint_32>; + msgInfo?: pb<4, OidbAiVoiceMsgInfo>; +} \ No newline at end of file diff --git a/packages/core/src/bridge/web-actions/cookies.ts b/packages/core/src/bridge/web-actions/cookies.ts index 325ff0fd..8ecb5bab 100644 --- a/packages/core/src/bridge/web-actions/cookies.ts +++ b/packages/core/src/bridge/web-actions/cookies.ts @@ -12,7 +12,7 @@ import type { OidbClientKeyResp, OidbGetPskeyReq, OidbGetPskeyResp, -} from '../proto/proton/oidb-action'; +} from '../proto/proton/oidb-actions/base'; import { RequestUtil } from '../web/request-util'; export async function forceFetchClientKey(bridge: Bridge) { diff --git a/packages/core/tests/actions/extras.test.ts b/packages/core/tests/actions/extras.test.ts index 0278be45..e6c69b07 100644 --- a/packages/core/tests/actions/extras.test.ts +++ b/packages/core/tests/actions/extras.test.ts @@ -3,9 +3,11 @@ import { protobuf_encode } from '@snowluma/proton'; import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; import type { OidbStrangerStatusResp, +} from '../../src/bridge/proto/proton/oidb-actions/base'; +import type { OidbAiVoiceListResp, OidbAiVoiceResp, -} from '../../src/bridge/proto/proton/oidb-action'; +} from '../../src/bridge/proto/proton/oidb-actions/media'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // that the plugin substitutes at the call site with the inlined codec, so diff --git a/packages/core/tests/actions/forward-file.test.ts b/packages/core/tests/actions/forward-file.test.ts index d63154e1..a6a0e900 100644 --- a/packages/core/tests/actions/forward-file.test.ts +++ b/packages/core/tests/actions/forward-file.test.ts @@ -44,13 +44,13 @@ vi.mock('../../src/bridge/element-builder', () => ({ buildSendElems: buildSendElemsMock, })); -import { protoEncode } from '../../src/protobuf/decode'; -import { SendLongMsgRespSchema } from '../../src/bridge/proto/longmsg'; +import { protobuf_encode } from '@snowluma/proton'; +import type { SendLongMsgResp } from '../../src/bridge/proto/proton/longmsg'; import * as forward from '../../src/bridge/actions/forward'; import { mockBridge } from './_helpers'; function uploadResponseWithResId(resId: string) { - const encoded = protoEncode({ result: { resId } }, SendLongMsgRespSchema); + const encoded = protobuf_encode({ result: { resId } }); return { success: true, gotResponse: true, diff --git a/packages/core/tests/actions/forward.test.ts b/packages/core/tests/actions/forward.test.ts index 8226118c..db1ea831 100644 --- a/packages/core/tests/actions/forward.test.ts +++ b/packages/core/tests/actions/forward.test.ts @@ -14,13 +14,13 @@ vi.mock('../../src/bridge/element-builder', () => ({ buildSendElems: vi.fn(async () => []), })); -import { protoEncode } from '../../src/protobuf/decode'; -import { SendLongMsgRespSchema } from '../../src/bridge/proto/longmsg'; +import { protobuf_encode } from '@snowluma/proton'; +import type { SendLongMsgResp } from '../../src/bridge/proto/proton/longmsg'; import * as forward from '../../src/bridge/actions/forward'; import { mockBridge } from './_helpers'; function uploadResponseWithResId(resId: string) { - const encoded = protoEncode({ result: { resId } }, SendLongMsgRespSchema); + const encoded = protobuf_encode({ result: { resId } }); return { success: true, gotResponse: true, diff --git a/packages/core/tests/actions/friend.test.ts b/packages/core/tests/actions/friend.test.ts index 919cd5ae..e78c2418 100644 --- a/packages/core/tests/actions/friend.test.ts +++ b/packages/core/tests/actions/friend.test.ts @@ -15,8 +15,6 @@ describe('actions/friend', () => { beforeEach(() => { vi.mocked(oidb.runOidb).mockClear(); vi.mocked(oidb.makeOidbEnvelope).mockClear(); - vi.mocked(oidb.encodeOidbEnv).mockClear(); - vi.mocked(oidb.decodeOidbEnv).mockClear(); }); it('setFriendAddRequest: numeric input is treated as UIN and resolved', async () => { diff --git a/packages/core/tests/actions/group-admin.test.ts b/packages/core/tests/actions/group-admin.test.ts index a7e0c5c7..90bb9672 100644 --- a/packages/core/tests/actions/group-admin.test.ts +++ b/packages/core/tests/actions/group-admin.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { protobuf_encode } from '@snowluma/proton'; import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; -import type { Oidb0x8a7Resp } from '../../src/bridge/proto/proton/oidb-action'; +import type { Oidb0x8a7Resp } from '../../src/bridge/proto/proton/oidb-actions/base'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // that the plugin substitutes at the call site with the inlined codec, so diff --git a/packages/core/tests/actions/group-file.test.ts b/packages/core/tests/actions/group-file.test.ts index 22394ae8..64935916 100644 --- a/packages/core/tests/actions/group-file.test.ts +++ b/packages/core/tests/actions/group-file.test.ts @@ -5,10 +5,12 @@ import type { OidbGroupFileCountViewResp, OidbGroupFileResp, OidbGroupFileViewResp, - OidbPrivateFileUploadResp, OidbGroupFileFolderResp, +} from '../../src/bridge/proto/proton/oidb-actions/group-file'; +import type { + OidbPrivateFileUploadResp, NTV2RichMediaResp, -} from '../../src/bridge/proto/proton/oidb-action'; +} from '../../src/bridge/proto/proton/oidb-actions/media'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // (substituted at the call site with the inlined codec). Mocking them on diff --git a/packages/core/tests/actions/group-message.test.ts b/packages/core/tests/actions/group-message.test.ts index 95281197..9dff687d 100644 --- a/packages/core/tests/actions/group-message.test.ts +++ b/packages/core/tests/actions/group-message.test.ts @@ -15,8 +15,6 @@ describe('actions/group-message', () => { beforeEach(() => { vi.mocked(oidb.runOidb).mockClear(); vi.mocked(oidb.makeOidbEnvelope).mockClear(); - vi.mocked(oidb.encodeOidbEnv).mockClear(); - vi.mocked(oidb.decodeOidbEnv).mockClear(); }); it('recallGroupMessage sends to SsoGroupRecallMsg with the group sequence', async () => { diff --git a/packages/core/tests/actions/interaction.test.ts b/packages/core/tests/actions/interaction.test.ts index feace71a..88570593 100644 --- a/packages/core/tests/actions/interaction.test.ts +++ b/packages/core/tests/actions/interaction.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { protobuf_encode } from '@snowluma/proton'; import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; -import type { Oidb0x9083Resp } from '../../src/bridge/proto/proton/oidb-action'; +import type { Oidb0x9083Resp } from '../../src/bridge/proto/proton/oidb-actions/base'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // that the plugin substitutes at the call site for the inlined codec. diff --git a/packages/core/tests/actions/misc.test.ts b/packages/core/tests/actions/misc.test.ts index 09efd6e2..7f7f7dd5 100644 --- a/packages/core/tests/actions/misc.test.ts +++ b/packages/core/tests/actions/misc.test.ts @@ -4,7 +4,7 @@ import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; import type { Oidb0x990Resp, Oidb0x112eResp, -} from '../../src/bridge/proto/proton/oidb-action'; +} from '../../src/bridge/proto/proton/oidb-actions/base'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // — the plugin substitutes them at the call site with the inlined codec, diff --git a/packages/core/tests/actions/profile.test.ts b/packages/core/tests/actions/profile.test.ts index 6ec45f46..bf5aa37c 100644 --- a/packages/core/tests/actions/profile.test.ts +++ b/packages/core/tests/actions/profile.test.ts @@ -1,10 +1,13 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; -import { protobuf_encode } from '@snowluma/proton'; +import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; import type { + GroupAvatarExtra, Oidb0x7edResp, Oidb0xe17Resp, -} from '../../src/bridge/proto/proton/oidb-action'; + SetStatusReq, + SetStatusResp, +} from '../../src/bridge/proto/proton/oidb-actions/base'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // (substituted at the call site with the inlined codec). Mocking them on @@ -71,23 +74,19 @@ describe('actions/profile', () => { expect(serviceCmd).toBe('trpc.qq_new_tech.status_svc.StatusService.SetStatus'); // Decode the wire bytes back through the same schema to assert // every field landed in the right place. - const { protoDecode } = await import('../../src/protobuf/decode'); - const { SetStatusReqSchema } = await import('../../src/bridge/proto/oidb-action'); - const decoded = protoDecode(body as Uint8Array, SetStatusReqSchema); + const decoded = protobuf_decode(body as Uint8Array); expect(decoded).toMatchObject({ status: 10, extStatus: 2000, - batteryStatus: 0, customExt: { faceId: 1234, text: '摸鱼中', faceType: 2 }, }); + expect(decoded.batteryStatus ?? 0).toBe(0); }); it('setDiyOnlineStatus surfaces server errors via the same path as setOnlineStatus', async () => { const bridge = mockBridge(); // Build a response that decodes to errCode != 0. - const { protoEncode } = await import('../../src/protobuf/decode'); - const { SetStatusRespSchema } = await import('../../src/bridge/proto/oidb-action'); - const respBuf = Buffer.from(protoEncode({ errCode: 1, errMsg: 'denied' }, SetStatusRespSchema)); + const respBuf = Buffer.from(protobuf_encode({ errCode: 1, errMsg: 'denied' })); bridge.sendRawPacket.mockResolvedValueOnce({ success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData: respBuf, } as any); @@ -150,9 +149,7 @@ describe('actions/profile', () => { expect(cmdId).toBe(3000); // Decode the extra blob back through the schema and assert every // protocol-prescribed constant lands where it should. - const { protoDecode } = await import('../../src/protobuf/decode'); - const { GroupAvatarExtraSchema } = await import('../../src/bridge/proto/oidb-action'); - const decoded = protoDecode(extend as Uint8Array, GroupAvatarExtraSchema); + const decoded = protobuf_decode(extend as Uint8Array); expect(decoded).toEqual({ type: 101, groupUin: 12345, diff --git a/packages/core/tests/bridge-private-routing.test.ts b/packages/core/tests/bridge-private-routing.test.ts index 443ce172..96c56008 100644 --- a/packages/core/tests/bridge-private-routing.test.ts +++ b/packages/core/tests/bridge-private-routing.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it, vi } from 'vitest'; +import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import type { SendPacketResult } from '../src/protocol/packet-sender'; -import { protoDecode, protoEncode } from '../src/protobuf/decode'; -import { SendMessageRequestSchema, SendMessageResponseSchema } from '../src/bridge/proto/action'; -import { FileExtraSchema } from '../src/bridge/proto/message'; +import type { SendMessageRequest, SendMessageResponse } from '../src/bridge/proto/proton/action'; +import type { FileExtra } from '../src/bridge/proto/proton/message'; vi.mock('../src/bridge/element-builder', () => ({ buildSendElems: vi.fn(async () => [{ text: { str: 'stub media elem' } }]), @@ -29,11 +29,12 @@ describe('Bridge private media routing', () => { gotResponse: true, errorCode: 0, errorMessage: '', - responseData: Buffer.from(protoEncode({ + responseData: Buffer.from(protobuf_encode({ result: 0, + errMsg: '', privateSequence: 88, timestamp1: 1710000000, - }, SendMessageResponseSchema)), + })), }; } } @@ -42,7 +43,7 @@ describe('Bridge private media routing', () => { await bridge.sendPrivateMessage(12345, [{ type: 'video', url: 'file:///tmp/clip.mp4' } as any]); expect(bridge.capturedBody).toBeInstanceOf(Uint8Array); - const request = protoDecode(bridge.capturedBody as Uint8Array, SendMessageRequestSchema); + const request = protobuf_decode(bridge.capturedBody as Uint8Array); expect(request?.routingHead?.c2c).toMatchObject({ uin: 12345, uid: 'u_peer_12345', @@ -67,9 +68,9 @@ describe('Bridge private media routing', () => { this.capturedBody = body; return { success: true, gotResponse: true, errorCode: 0, errorMessage: '', - responseData: Buffer.from(protoEncode({ - result: 0, privateSequence: 88, timestamp1: 1710000000, - }, SendMessageResponseSchema)), + responseData: Buffer.from(protobuf_encode({ + result: 0, errMsg: '', privateSequence: 88, timestamp1: 1710000000, + })), }; } } @@ -84,27 +85,24 @@ describe('Bridge private media routing', () => { fileHash: 'hash-xyz', }); - const request = protoDecode(bridge.capturedBody as Uint8Array, SendMessageRequestSchema); + const request = protobuf_decode(bridge.capturedBody as Uint8Array); // Routing: must be trans0x211 with ccCmd=4 + uid, no c2c slot. expect(request?.routingHead?.trans0x211).toMatchObject({ ccCmd: 4, uid: 'u_peer_xyz', }); - expect(request?.routingHead?.c2c).toBeUndefined(); + expect(request?.routingHead?.c2c ?? undefined).toBeUndefined(); // Body: msgContent carries the FileExtra; richText is absent (no // elems, no notOnlineFile slot — both lived on the wrong place). expect(request?.messageBody?.msgContent).toBeInstanceOf(Uint8Array); - expect(request?.messageBody?.richText).toBeUndefined(); + expect(request?.messageBody?.richText ?? undefined).toBeUndefined(); // Decode the msgContent and verify the NotOnlineFile fields land // at the correct tags (Lagrange's NotOnlineFile schema, not the // dead FileExtraInfo one). - const fileExtra = protoDecode( - request!.messageBody!.msgContent as Uint8Array, - FileExtraSchema, - ); + const fileExtra = protobuf_decode(request!.messageBody!.msgContent as Uint8Array); expect(fileExtra?.file).toMatchObject({ fileUuid: 'uuid-abc-123', fileName: 'doc.txt', diff --git a/packages/core/tests/group-msg-emoji-like.test.ts b/packages/core/tests/group-msg-emoji-like.test.ts index a986ac1d..b2187bcf 100644 --- a/packages/core/tests/group-msg-emoji-like.test.ts +++ b/packages/core/tests/group-msg-emoji-like.test.ts @@ -6,8 +6,8 @@ // - formatEvent prints something readable in the [Event] log import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { protoEncode } from '../src/protobuf/decode'; -import { GroupReactNotifySchema } from '../src/bridge/proto/notify'; +import { protobuf_encode } from '@snowluma/proton'; +import type { GroupReactNotify } from '../src/bridge/proto/proton/notify'; import { decodeEvent0x2DC } from '../src/bridge/msg-push/decoders/event-0x2dc'; import type { MsgPushContext } from '../src/bridge/msg-push/context'; import { IdentityService } from '../src/bridge/identity-service'; @@ -28,7 +28,7 @@ function makeIdentity(): IdentityService { * a 7-byte magic prefix followed by an encoded GroupReactNotify. */ function buildReactContent(notify: Record): Uint8Array { const prefix = new Uint8Array([0, 0, 0, 0, 0, 0, 0]); - const body = protoEncode(notify as never, GroupReactNotifySchema); + const body = protobuf_encode(notify as GroupReactNotify); const out = new Uint8Array(prefix.length + body.length); out.set(prefix, 0); out.set(body, prefix.length); diff --git a/packages/core/tests/highway/pipeline.test.ts b/packages/core/tests/highway/pipeline.test.ts index af7dc72a..06ade675 100644 --- a/packages/core/tests/highway/pipeline.test.ts +++ b/packages/core/tests/highway/pipeline.test.ts @@ -6,6 +6,7 @@ // the actual decode path inside the pipeline. import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; vi.mock('../../src/bridge/highway/highway-client', () => ({ fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })), @@ -23,13 +24,8 @@ import { runNtv2Upload, type MediaSubFileUpload, } from '../../src/bridge/highway/pipeline'; -import { protoDecode, protoEncode } from '../../src/protobuf/decode'; -import { makeOidbBaseSchema } from '../../src/bridge/proto/oidb'; -import { - EncodableMediaMsgInfoSchema, - NTV2UploadRichMediaReqSchema, - NTV2UploadRichMediaRespSchema, -} from '../../src/bridge/proto/highway'; +import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; +import type { EncodableMediaMsgInfo, NTV2UploadRichMediaReq, NTV2UploadRichMediaResp } from '../../src/bridge/proto/proton/highway'; interface FakeUploadResponse { upload?: { @@ -48,8 +44,7 @@ interface FakeUploadResponse { } function encodeOidbResponse(body: FakeUploadResponse, opts: { errorCode?: number; errorMsg?: string } = {}): Buffer { - const baseSchema = makeOidbBaseSchema(NTV2UploadRichMediaRespSchema); - return Buffer.from(protoEncode({ + return Buffer.from(protobuf_encode>({ command: 0x11C4, subCommand: 100, errorCode: opts.errorCode ?? 0, @@ -58,7 +53,7 @@ function encodeOidbResponse(body: FakeUploadResponse, opts: { errorCode?: number body: body as unknown as Record, errorMsg: opts.errorMsg ?? '', reserved: 1, - }, baseSchema)); + } as OidbBase)); } type SendPacketResult = { @@ -125,8 +120,7 @@ describe('pipeline — runNtv2Upload', () => { // The request roundtrips through the real OIDB envelope and carries // the requestId / businessType / scene fields we passed. - const baseSchema = makeOidbBaseSchema(NTV2UploadRichMediaReqSchema); - const decoded: any = protoDecode(requestBytes as Uint8Array, baseSchema); + const decoded: any = protobuf_decode>(requestBytes as Uint8Array); expect(decoded.command).toBe(0x11C4); expect(decoded.body.reqHead.common.requestId).toBe(1); expect(decoded.body.reqHead.scene.businessType).toBe(1); @@ -141,7 +135,7 @@ describe('pipeline — runNtv2Upload', () => { await runNtv2Upload(baseParams({ bridge, isGroup: false, targetIdOrUid: 'recipient-uid' })); const requestBytes = bridge.sendRawPacket.mock.calls[0]![1]; - const decoded: any = protoDecode(requestBytes as Uint8Array, makeOidbBaseSchema(NTV2UploadRichMediaReqSchema)); + const decoded: any = protobuf_decode>(requestBytes as Uint8Array); expect(decoded.body.reqHead.scene.sceneType).toBe(1); expect(decoded.body.reqHead.scene.c2c.targetUid).toBe('recipient-uid'); }); @@ -336,7 +330,7 @@ describe('pipeline — finalizeMediaMsgInfo', () => { msgInfo: { msgInfoBody: [], extBizInfo: {} }, }, { bizType: 7, textSummary: '[image]' }); - const decoded: any = protoDecode(out, EncodableMediaMsgInfoSchema); + const decoded: any = protobuf_decode(out); expect(decoded.extBizInfo.pic.bizType).toBe(7); expect(decoded.extBizInfo.pic.textSummary).toBe('[image]'); }); @@ -345,10 +339,10 @@ describe('pipeline — finalizeMediaMsgInfo', () => { const out = finalizeMediaMsgInfo({ msgInfo: { msgInfoBody: [], extBizInfo: {} }, }); - const decoded: any = protoDecode(out, EncodableMediaMsgInfoSchema); + const decoded: any = protobuf_decode(out); // An empty extBizInfo proto roundtrips to undefined; either way the // pic field never got materialised. - expect(decoded?.extBizInfo?.pic).toBeUndefined(); + expect(decoded?.extBizInfo?.pic ?? undefined).toBeUndefined(); }); }); diff --git a/packages/core/tests/message-parser.test.ts b/packages/core/tests/message-parser.test.ts index debc405b..fabec744 100644 --- a/packages/core/tests/message-parser.test.ts +++ b/packages/core/tests/message-parser.test.ts @@ -2,12 +2,12 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; import { describe, it, expect, vi } from 'vitest'; +import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import { parseMessage } from '../src/onebot/message-parser'; import { buildSendElems } from '../src/bridge/element-builder'; -import { MentionExtraSendSchema } from '../src/bridge/proto/action'; -import { makeOidbBaseSchema } from '../src/bridge/proto/oidb'; -import { NTV2UploadRichMediaRespSchema } from '../src/bridge/proto/highway'; -import { protoDecode, protoEncode } from '../src/protobuf/decode'; +import type { MentionExtraSend } from '../src/bridge/proto/proton/action'; +import type { OidbBase } from '../src/bridge/proto/proton/oidb'; +import type { NTV2UploadRichMediaResp } from '../src/bridge/proto/proton/highway'; describe('parseMessage', () => { describe('plain text', () => { @@ -188,7 +188,7 @@ describe('parseMessage', () => { const protoElems = await buildSendElems(elements); const reserve = protoElems[0].text?.pbReserve; expect(reserve).toBeInstanceOf(Uint8Array); - const extra = protoDecode(reserve as Uint8Array, MentionExtraSendSchema); + const extra = protobuf_decode(reserve as Uint8Array); expect(extra).toMatchObject({ type: 2, uin: 123456, @@ -232,8 +232,7 @@ describe('parseMessage', () => { const videoPath = path.join(os.tmpdir(), `snowluma-video-test-${process.pid}-${Date.now()}.mp4`); fs.writeFileSync(videoPath, Buffer.from([0, 1, 2, 3])); - const respSchema = makeOidbBaseSchema(NTV2UploadRichMediaRespSchema); - const responseData = protoEncode({ + const responseData = protobuf_encode>({ command: 0x11EA, subCommand: 100, errorCode: 0, @@ -255,7 +254,7 @@ describe('parseMessage', () => { }, errorMsg: '', reserved: 1, - }, respSchema); + }); const bridge = { identity: { uin: '10000' }, diff --git a/packages/core/tests/msg-push-handler.test.ts b/packages/core/tests/msg-push-handler.test.ts index c40ca4c8..851439d2 100644 --- a/packages/core/tests/msg-push-handler.test.ts +++ b/packages/core/tests/msg-push-handler.test.ts @@ -3,8 +3,6 @@ import { protobuf_encode } from '@snowluma/proton'; import { parseMsgPush, MSG_PUSH_CMD } from '../src/bridge/msg-push'; import { IdentityService } from '../src/bridge/identity-service'; import type { GroupMemberInfo, QQGroupInfo } from '../src/bridge/qq-info'; -import { PushMsgSchema } from '../src/bridge/proto/message'; -import { GroupChangeSchema, OperatorInfoSchema } from '../src/bridge/proto/notify'; // Proton's call-site analyzer keys off the literal type identifier // printed in `protobuf_encode` — it walks imports by *original* // name (not alias). If both `import { X } from 'proto/notify'` and @@ -15,8 +13,9 @@ import { GroupChangeSchema, OperatorInfoSchema } from '../src/bridge/proto/notif // name) — we don't need to import it directly since assertions can // inline-extract the kind. import type { - NewFriend, FriendRecall, SelfJoinInGroup, + GroupChange, NewFriend, FriendRecall, OperatorInfo, SelfJoinInGroup, } from '../src/bridge/proto/proton/notify'; +import type { PushMsg } from '../src/bridge/proto/proton/message'; import type { GroupMemberJoin, FriendAddEvent, QQEventVariant, } from '../src/bridge/events'; @@ -26,7 +25,6 @@ import type { // proton import above. type FriendRecallEvent = Extract; import type { PacketInfo } from '../src/protocol/types'; -import { protoEncode } from '../src/protobuf/decode'; import { subscribeLogs } from '../src/utils/logger'; const SELF_UIN = '10001'; @@ -67,21 +65,21 @@ function makeIdentity(members: GroupMemberInfo[] = []): IdentityService { function makeGroupIncreasePacket(memberUid: string, operatorUid = '', fromUin = GROUP_ID): PacketInfo { const operatorBytes = operatorUid - ? protoEncode({ operatorField: { uid: operatorUid } } as any, OperatorInfoSchema) + ? protobuf_encode({ operatorField: { uid: operatorUid } }) : new Uint8Array(0); - const content = protoEncode({ + const content = protobuf_encode({ groupUin: GROUP_ID, memberUid, operatorBytes, - } as any, GroupChangeSchema); - const body = protoEncode({ + }); + const body = protobuf_encode({ message: { responseHead: { fromUin }, contentHead: { msgType: 33, timestamp: 1710000000 }, body: { msgContent: content }, }, status: 0, - } as any, PushMsgSchema); + }); return { pid: 1, @@ -129,7 +127,7 @@ describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => { // drop silently — no OneBot-level event, and — critically — // **no** "unknown subType=38" fallback log spam anymore. function makeEvent0x210Packet(subType: number, content = new Uint8Array(0)): PacketInfo { - const body = protoEncode({ + const body = protobuf_encode({ message: { responseHead: { fromUin: 22222, type: 0, sigMap: 0 }, // 528 = Event0x210 @@ -137,7 +135,7 @@ describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => { body: { msgContent: content }, }, status: 0, - } as any, PushMsgSchema); + }); return { pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1, retCode: 0, fromClient: false, body, @@ -186,14 +184,14 @@ describe('parseMsgPush Event0x210 subType=38 (acknowledged-but-silent)', () => { // that we were previously dropping into the "unknown" fallback. ── function makeEvent0x210PacketAny(subType: number, content: Uint8Array): PacketInfo { - const body = protoEncode({ + const body = protobuf_encode({ message: { responseHead: { fromUin: 22222, type: 0, sigMap: 0 }, contentHead: { msgType: 528, subType, timestamp: 1710000000 }, body: { msgContent: content }, }, status: 0, - } as any, PushMsgSchema); + }); return { pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1, retCode: 0, fromClient: false, body, @@ -313,14 +311,14 @@ describe('parseMsgPush PkgType 85 (bot self-joined a group)', () => { field6: 48, field7: '', }); - const body = protoEncode({ + const body = protobuf_encode({ message: { responseHead: { fromUin: groupId, type: 0, sigMap: 0 }, contentHead: { msgType: 85, subType: 0, timestamp: 1710000000 }, body: { msgContent: content }, }, status: 0, - } as any, PushMsgSchema); + }); return { pid: 1, uin: SELF_UIN, serviceCmd: MSG_PUSH_CMD, seqId: 1, retCode: 0, fromClient: false, body, diff --git a/packages/core/tests/observability-logs.test.ts b/packages/core/tests/observability-logs.test.ts index ee3a871e..b09b7208 100644 --- a/packages/core/tests/observability-logs.test.ts +++ b/packages/core/tests/observability-logs.test.ts @@ -10,6 +10,7 @@ // network I/O. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { protobuf_encode } from '@snowluma/proton'; import { subscribeLogs, type LogEntry } from '../src/utils/logger'; vi.mock('../src/bridge/highway/highway-client', () => ({ @@ -24,22 +25,18 @@ import { runNtv2Upload, type MediaSubFileUpload, } from '../src/bridge/highway/pipeline'; -import { protoEncode } from '../src/protobuf/decode'; -import { makeOidbBaseSchema } from '../src/bridge/proto/oidb'; -import { - NTV2UploadRichMediaRespSchema, -} from '../src/bridge/proto/highway'; +import type { OidbBase } from '../src/bridge/proto/proton/oidb'; +import type { NTV2UploadRichMediaResp } from '../src/bridge/proto/proton/highway'; import { MsgPushRegistry } from '../src/bridge/msg-push/registry'; import type { MsgPushContext } from '../src/bridge/msg-push/context'; import { decodeEvent0x2DC } from '../src/bridge/msg-push/decoders/event-0x2dc'; function encodeOidbResponse(body: unknown): Buffer { - const baseSchema = makeOidbBaseSchema(NTV2UploadRichMediaRespSchema); - return Buffer.from(protoEncode({ + return Buffer.from(protobuf_encode>({ command: 0x11C4, subCommand: 100, errorCode: 0, body: body as Record, errorMsg: '', reserved: 1, - }, baseSchema)); + } as OidbBase)); } function fakeBridge(responseData: Buffer, uin = '12345'): any { diff --git a/packages/core/tests/proton-parity.test.ts b/packages/core/tests/proton-parity.test.ts deleted file mode 100644 index a6531434..00000000 --- a/packages/core/tests/proton-parity.test.ts +++ /dev/null @@ -1,815 +0,0 @@ -// Proof-of-concept: verify that codec generated by @snowluma/proton's Vite -// plugin produces wire bytes byte-identical to the legacy runtime schema -// encoder for the same input. If this passes, the migration pattern is sound -// for the schemas covered here. - -import { describe, it, expect } from 'vitest'; -import { protobuf_encode, protobuf_decode } from '@snowluma/proton'; -import { protoEncode, protoDecode } from '../src/protobuf/decode'; - -import { - SendLongMsgRespSchema, - SendLongMsgReqSchema, - RecvLongMsgReqSchema, - RecvLongMsgRespSchema, - LongMsgSettingsSchema, - LongMsgResultSchema, -} from '../src/bridge/proto/longmsg'; -import { - TextElemSchema, - NotOnlineImageSchema, - ExtraInfoSchema, - SrcMsgSchema, - ElemSchema, - MsgInfoSchema, -} from '../src/bridge/proto/element'; -import { - ResponseHeadSchema, - PushMsgBodySchema, - PushMsgSchema, -} from '../src/bridge/proto/message'; -import { - GroupChangeSchema, - GroupAdminSchema, - NotifyMessageBodySchema, - GroupReactNotifySchema, - FriendRequestSchema, - GroupJoinSchema, -} from '../src/bridge/proto/notify'; -import { - RoutingHeadSchema, - SendMessageRequestSchema, - SendMessageResponseSchema, - MentionExtraSendSchema, - MarkdownDataSchema, -} from '../src/bridge/proto/action'; -import { - HttpConn0x6FF501RequestSchema, - HttpConn0x6FF501ResponseSchema, - ReqDataHighwayHeadSchema, - NTV2RichMediaHighwayExtSchema, - FileUploadExtSchema, -} from '../src/bridge/proto/highway'; -import { makeOidbBaseSchema, OidbSvcTrpcTcp0xFE5_2ResponseSchema } from '../src/bridge/proto/oidb'; -import { makeOidbEnvelope, encodeOidbEnv, decodeOidbEnv } from '../src/bridge/bridge-oidb'; -import { - GetMediaListRequestSchema, - DoQunCommentRequestSchema, - DoQunLikeRequestSchema, - DeleteMediasRequestSchema, - DeleteMediasResponseSchema, -} from '../src/bridge/proto/oidb-action'; - -import type { - SendLongMsgResp, - SendLongMsgReq, - RecvLongMsgReq, - RecvLongMsgResp, - LongMsgSettings, - LongMsgResult, -} from '../src/bridge/proto/proton/longmsg'; -import type { - TextElem, - NotOnlineImage, - ExtraInfo, - SrcMsg, - Elem, - MsgInfo, -} from '../src/bridge/proto/proton/element'; -import type { - ResponseHead, - PushMsgBody, - PushMsg, -} from '../src/bridge/proto/proton/message'; -import type { - GroupChange, - GroupAdmin, - NotifyMessageBody, - GroupReactNotify, - FriendRequest as FriendRequestNotify, - GroupJoin, -} from '../src/bridge/proto/proton/notify'; -import type { - RoutingHead, - SendMessageRequest, - SendMessageResponse, - MentionExtraSend, - MarkdownData, -} from '../src/bridge/proto/proton/action'; -import type { - HttpConn0x6FF501Request, - HttpConn0x6FF501Response, - ReqDataHighwayHead, - NTV2RichMediaHighwayExt, - FileUploadExt, -} from '../src/bridge/proto/proton/highway'; -import type { - OidbBase, - OidbSvcTrpcTcp0xFE5_2Response, -} from '../src/bridge/proto/proton/oidb'; -import type { - GetMediaListRequest, - DoQunCommentRequest, - DoQunLikeRequest, - DeleteMediasRequest, - DeleteMediasResponse, -} from '../src/bridge/proto/proton/oidb-action'; - -function hex(buf: Uint8Array): string { - return Buffer.from(buf).toString('hex'); -} - -describe('proton ↔ legacy parity (longmsg subset)', () => { - it('encodes LongMsgSettings identically', () => { - const data: LongMsgSettings = { field1: 1, field2: 2, field3: 3, field4: 4 }; - const legacy = protoEncode(data as any, LongMsgSettingsSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes SendLongMsgResp (nested message) identically', () => { - const data: SendLongMsgResp = { result: { resId: 'res-001' } }; - const legacy = protoEncode(data as any, SendLongMsgRespSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes SendLongMsgReq with bytes + nested + settings identically', () => { - // NOTE: all numeric fields are non-zero — proton follows proto3 semantics - // and omits default-valued fields from the wire, whereas the legacy runtime - // encoder always writes them. Parity is therefore only expected when no - // numeric field equals its default. See the explicit divergence test below. - const data: SendLongMsgReq = { - info: { - type: 1, - uid: { uid: 'u_test' }, - groupUin: 123456, - payload: new Uint8Array([0xde, 0xad, 0xbe, 0xef]), - }, - settings: { field1: 4, field2: 1, field3: 7, field4: 2 }, - }; - const legacy = protoEncode(data as any, SendLongMsgReqSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes RecvLongMsgReq with bool field identically', () => { - const data: RecvLongMsgReq = { - info: { uid: { uid: 'u_recv' }, resId: 'r-9', acquire: true }, - settings: { field1: 4, field2: 1, field3: 7, field4: 2 }, - }; - const legacy = protoEncode(data as any, RecvLongMsgReqSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes RecvLongMsgResp (with bytes payload) identically', () => { - const data: RecvLongMsgResp = { - result: { resId: 'r-1', payload: new Uint8Array([1, 2, 3, 4, 5]) }, - settings: { field1: 4, field2: 1, field3: 7, field4: 2 }, - }; - const legacy = protoEncode(data as any, RecvLongMsgRespSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── element.ts coverage ───────────────────────────────────────────── - - it('encodes TextElem (only primitive bytes + strings) identically', () => { - const data: TextElem = { - str: 'hello', - link: 'https://example.com', - attr6Buf: new Uint8Array([1, 2, 3]), - buf: new Uint8Array([0xff, 0xee]), - }; - const legacy = protoEncode(data as any, TextElemSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes NotOnlineImage with nested PbReserve identically', () => { - const data: NotOnlineImage = { - filePath: 'pic.jpg', - fileLen: 12345, - picMd5: new Uint8Array([0x11, 0x22, 0x33, 0x44]), - picHeight: 600, - picWidth: 800, - resId: 'res-abc', - original: 1, - bigUrl: 'https://q.qq.com/big/abc', - bizType: 5, - pbRes: { - subType: 1, - summary: '[picture]', - field10: 7, - field20: { field1: 1, field2: 'inner', field3: 2, field4: 3, field5: 4, field7: 'tail' }, - url: 'https://q.qq.com/abc', - md5Str: 'abc123', - }, - }; - const legacy = protoEncode(data as any, NotOnlineImageSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes ExtraInfo (mix of bytes + int32 + uint64) identically', () => { - const data: ExtraInfo = { - nick: new Uint8Array([0x41, 0x42]), - groupCard: new Uint8Array([0x43]), - level: 7, - flags: 1, - groupMask: 2, - msgTailId: 3, - uin: 10001n, - msgStateFlag: 4, - }; - const legacy = protoEncode(data as any, ExtraInfoSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes SrcMsg with repeated_uint32 + repeated_bytes identically', () => { - const data: SrcMsg = { - origSeqs: [100, 200, 300, 400], - senderUin: 10001n, - time: 1234567890, - flag: 1, - elemsRaw: [new Uint8Array([1, 2]), new Uint8Array([3, 4]), new Uint8Array([5, 6])], - type: 1, - toUin: 20002n, - }; - const legacy = protoEncode(data as any, SrcMsgSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes Elem (oneOf-style union) identically across multiple shapes', () => { - const textOnly: Elem = { text: { str: 'hi', link: 'lnk' } }; - expect(hex(protobuf_encode(textOnly))).toBe(hex(protoEncode(textOnly as any, ElemSchema))); - - const faceOnly: Elem = { face: { index: 42, buf: new Uint8Array([1, 2, 3]) } }; - expect(hex(protobuf_encode(faceOnly))).toBe(hex(protoEncode(faceOnly as any, ElemSchema))); - - const generalFlags: Elem = { generalFlags: { uin: 10001n, longTextFlag: 1, longTextResId: 'rs' } }; - expect(hex(protobuf_encode(generalFlags))).toBe(hex(protoEncode(generalFlags as any, ElemSchema))); - }); - - it('encodes MsgInfo with repeated_message + deeply nested ExtBizInfo identically', () => { - const data: MsgInfo = { - msgInfoBody: [ - { - index: { - info: { fileSize: 1024, fileHash: 'sha-1', fileSha1: 'sha-2', fileName: 'a.png', type: { type: 1, picFormat: 2, videoFormat: 3, voiceFormat: 4 }, width: 100, height: 200, time: 99, original: 1 }, - fileUuid: 'uuid-1', storeId: 5, uploadTime: 1000, ttl: 86400, subType: 1, - }, - picture: { - urlPath: '/p/1', - ext: { originalParameter: 'op', bigParameter: 'bp', thumbParameter: 'tp' }, - domain: 'q.qq.com', - }, - fileExist: true, - }, - ], - extBizInfo: { - pic: { - bizType: 5, textSummary: '[pic]', - extData: { subType: 2, textSummary: 'sum' }, - fromScene: 1, toScene: 2, oldFileId: 999, - }, - busiType: 3, - }, - }; - const legacy = protoEncode(data as any, MsgInfoSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── message.ts coverage ───────────────────────────────────────────── - - it('encodes ResponseHead (nested forward + grp) identically', () => { - const data: ResponseHead = { - fromUin: 10001, fromUid: 'u_a', type: 1, sigMap: 2, toUin: 20002, toUid: 'u_b', - forward: { friendName: 'Alice' }, - grp: { groupUin: 555, memberName: 'Bob', groupName: 'TestGroup' }, - }; - const legacy = protoEncode(data as any, ResponseHeadSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes PushMsgBody (with RichText holding Elem[]) identically', () => { - const data: PushMsgBody = { - responseHead: { fromUin: 1, toUin: 2, type: 1, sigMap: 3, fromUid: 'a', toUid: 'b' }, - contentHead: { msgType: 1, subType: 1, divSeq: 1, msgId: 99, sequence: 100, timestamp: 1234567890 }, - body: { - richText: { - elems: [ - { text: { str: 'hi ' } }, - { text: { str: 'world', link: 'lnk' } }, - ], - }, - }, - }; - const legacy = protoEncode(data as any, PushMsgBodySchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes PushMsg (top-level) identically', () => { - const data: PushMsg = { - message: { - responseHead: { fromUin: 1, toUin: 2, type: 1, sigMap: 1, fromUid: 'a', toUid: 'b' }, - contentHead: { msgType: 1, subType: 1, divSeq: 1, msgId: 1, sequence: 1, timestamp: 1 }, - body: { richText: { elems: [{ text: { str: 'x' } }] } }, - }, - status: 1, - }; - const legacy = protoEncode(data as any, PushMsgSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── longmsg.ts: full migration (Content / Action / Result) ───────── - - it('encodes LongMsgResult (repeated Action → Content → PushMsgBody[]) identically', () => { - const inner: PushMsgBody = { - responseHead: { fromUin: 1, toUin: 2, type: 1, sigMap: 1, fromUid: 'a', toUid: 'b' }, - contentHead: { msgType: 1, subType: 1, divSeq: 1, msgId: 1, sequence: 1, timestamp: 1 }, - body: { richText: { elems: [{ text: { str: 'forwarded' } }] } }, - }; - const data: LongMsgResult = { - action: [ - { - actionCommand: 'MultiMsg', - actionData: { msgBody: [inner, inner] }, - }, - ], - }; - const legacy = protoEncode(data as any, LongMsgResultSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── notify.ts coverage ────────────────────────────────────────────── - - it('encodes GroupChange identically', () => { - const data: GroupChange = { - groupUin: 555, - flag: 1, - memberUid: 'u_x', - decreaseType: 130, - operatorBytes: new Uint8Array([1, 2, 3]), - increaseType: 1, - }; - const legacy = protoEncode(data as any, GroupChangeSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes GroupAdmin (extraEnable variant) identically', () => { - const data: GroupAdmin = { - groupUin: 777, flag: 1, isPromote: true, - body: { extraEnable: { adminUid: 'u_admin', isPromote: true } }, - }; - const legacy = protoEncode(data as any, GroupAdminSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes NotifyMessageBody (recall variant with repeated RecallMessage) identically', () => { - const data: NotifyMessageBody = { - type: 17, - groupUin: 555, - recall: { - operatorUid: 'u_op', - recallMessages: [ - { sequence: 1, time: 100, random: 42, type: 1, flag: 1, authorUid: 'u_a' }, - { sequence: 2, time: 200, random: 43, type: 1, flag: 1, authorUid: 'u_a' }, - ], - groupType: 1, opType: 2, - tipInfo: { tip: 'recalled' }, - }, - msgSequence: 99, - }; - const legacy = protoEncode(data as any, NotifyMessageBodySchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes GroupReactNotify (deeply nested) identically', () => { - const data: GroupReactNotify = { - groupUin: 555n, - field13: 35, - groupReactionData: { - data: { - data: { - groupReactionTarget: { seq: 12345n }, - groupReactionDataContent: { code: '128516', count: 1, operatorUid: 'u_op', type: 1 }, - }, - }, - }, - }; - const legacy = protoEncode(data as any, GroupReactNotifySchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes FriendRequest identically', () => { - const data: FriendRequestNotify = { - info: { targetUid: 'u_me', sourceUid: 'u_them', newSource: 'qrcode', message: 'hello!', source: 'web' }, - }; - const legacy = protoEncode(data as any, FriendRequestSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes GroupJoin identically', () => { - const data: GroupJoin = { - groupUin: 555, field2: 1, targetUid: 'u_them', field4: 1, - field6: 1, field7: 'reason', field8: 1, field9: new Uint8Array([0xaa]), - }; - const legacy = protoEncode(data as any, GroupJoinSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── action.ts coverage ───────────────────────────────────────────── - - it('encodes RoutingHead (c2c variant) identically', () => { - const data: RoutingHead = { c2c: { uin: 10001, uid: 'u_a' } }; - const legacy = protoEncode(data as any, RoutingHeadSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes RoutingHead (group variant) identically', () => { - const data: RoutingHead = { grp: { groupCode: 555n } }; - const legacy = protoEncode(data as any, RoutingHeadSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes SendMessageRequest (group with two text elements) identically', () => { - const data: SendMessageRequest = { - routingHead: { grp: { groupCode: 555n } }, - contentHead: { type: 1, subType: 1, c2cCmd: 11 }, - messageBody: { - richText: { - elems: [ - { text: { str: 'hi ' } }, - { text: { str: 'world', link: 'lnk' } }, - ], - }, - }, - clientSequence: 1, - random: 12345, - syncCookie: new Uint8Array([0xaa, 0xbb]), - via: 1, - dataStatist: 1, - multiSendSeq: 1, - }; - const legacy = protoEncode(data as any, SendMessageRequestSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes SendMessageResponse identically', () => { - const data: SendMessageResponse = { - result: 1, errMsg: 'ok', timestamp1: 1234567890, - field10: 1, groupSequence: 100, timestamp2: 1234567891, privateSequence: 200, - }; - const legacy = protoEncode(data as any, SendMessageResponseSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes MentionExtraSend identically', () => { - const data: MentionExtraSend = { type: 2, uin: 10001, field5: 1, uid: 'u_a' }; - const legacy = protoEncode(data as any, MentionExtraSendSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes MarkdownData identically', () => { - const data: MarkdownData = { content: '**bold** _italic_' }; - const legacy = protoEncode(data as any, MarkdownDataSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── highway.ts coverage ──────────────────────────────────────────── - - it('encodes HttpConn0x6FF501Request (high-numbered field tag 0x501) identically', () => { - const data: HttpConn0x6FF501Request = { - httpConn: { - field1: 1, field2: 2, field3: 16, field4: 1, field6: 3, - serviceTypes: [1, 5, 10, 21], - field9: 2, field10: 9, field11: 8, ver: '1.0.1', - }, - }; - const legacy = protoEncode(data as any, HttpConn0x6FF501RequestSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes HttpConn0x6FF501Response (with repeated server infos) identically', () => { - const data: HttpConn0x6FF501Response = { - httpConn: { - sigSession: new Uint8Array([1, 2, 3]), - sessionKey: new Uint8Array([4, 5, 6]), - serverInfos: [ - { serviceType: 1, serverAddrs: [{ type: 1, ip: 0x01020304, port: 8080, area: 1 }] }, - { serviceType: 2, serverAddrs: [{ type: 1, ip: 0x05060708, port: 8081, area: 2 }] }, - ], - }, - }; - const legacy = protoEncode(data as any, HttpConn0x6FF501ResponseSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes ReqDataHighwayHead (multiple nested messages) identically', () => { - const data: ReqDataHighwayHead = { - msgBaseHead: { - version: 1, uin: '10001', command: 'PicUp.DataUp', seq: 1, retryTimes: 1, - appId: 1600001604, dataFlag: 16, commandId: 1003, - }, - msgSegHead: { - serviceId: 1, filesize: 100n, dataOffset: 50n, dataLength: 100, - retCode: 1, serviceTicket: new Uint8Array([1, 2, 3]), flag: 1, - md5: new Uint8Array([4, 5, 6]), fileMd5: new Uint8Array([7, 8, 9]), - cacheAddr: 1, cachePort: 80, - }, - bytesReqExtendInfo: new Uint8Array([0xab, 0xcd]), - timestamp: 1234567890n, - msgLoginSigHead: { loginSigType: 8, appId: 1600001604 }, - }; - const legacy = protoEncode(data as any, ReqDataHighwayHeadSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes NTV2RichMediaHighwayExt (repeated_bytes hash) identically', () => { - const data: NTV2RichMediaHighwayExt = { - fileUuid: 'uuid-1', - uKey: 'key-1', - network: { ipv4s: [{ domain: { isEnable: true, ip: '127.0.0.1' }, port: 80 }] }, - blockSize: 1048576, - hash: { fileSha1: [new Uint8Array([1, 2]), new Uint8Array([3, 4])] }, - }; - const legacy = protoEncode(data as any, NTV2RichMediaHighwayExtSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes FileUploadExt (high-numbered tags 100/200/400/600/700) identically', () => { - const data: FileUploadExt = { - unknown1: 100, - unknown2: 1, - unknown3: 1, - entry: { - busiBuff: { - busId: 102, - senderUin: 10001n, - receiverUin: 555n, - groupCode: 555n, - }, - fileEntry: { - fileSize: 12345n, - md5: new Uint8Array([0x11, 0x22]), - checkKey: new Uint8Array([0x33, 0x44]), - md5S2: new Uint8Array([0x55]), - fileId: 'file-1', - uploadKey: new Uint8Array([0x66]), - }, - clientInfo: { - clientType: 3, appId: '100', terminalType: 3, clientVer: '1.1.1', unknown: 4, - }, - fileNameInfo: { fileName: 'a.bin' }, - host: { - hosts: [ - { url: { unknown: 1, host: 'upload.qq.com' }, port: 80 }, - ], - }, - }, - unknown200: 1, - }; - const legacy = protoEncode(data as any, FileUploadExtSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - // ── oidb.ts coverage (OidbBase generic envelope) ──────────────── - - it('encodes OidbBase identically to makeOidbBaseSchema', () => { - // This is the exact pattern runOidb uses for the OIDB envelope. Proton's - // OidbBase generic interface should monomorphize to a codec that is - // byte-equivalent to the legacy makeOidbBaseSchema(InnerSchema) factory. - // The inner Body type used here is a real schema (group-list response). - const body: OidbSvcTrpcTcp0xFE5_2Response = { - groups: [ - { - groupUin: 555, - info: { - groupOwner: { uid: 'u_owner' }, - createdTime: 1234567890, memberMax: 100, memberCount: 50, - groupName: 'TestGroup', description: 'desc', question: 'q?', - announcement: 'announcement', - }, - customInfo: { remark: 'remark' }, - }, - ], - }; - const envelope = { - command: 0xFE5, - subCommand: 2, - errorCode: 1, // non-zero so it isn't proto3-omitted - body, - errorMsg: 'ok', - reserved: 1, - }; - const legacy = protoEncode(envelope as any, makeOidbBaseSchema(OidbSvcTrpcTcp0xFE5_2ResponseSchema)); - const proton = protobuf_encode>(envelope); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodeOidbEnv pass-through wrapper byte-equivalent to direct codec', () => { - // The bridge-oidb.ts module exposes encodeOidbEnv / decodeOidbEnv - // as pure pass-through wrappers around protobuf_encode/decode>. - // Proton wrapper-binds them and substitutes each call site with the - // monomorphized codec, so byte-output must match a direct call. - const body: OidbSvcTrpcTcp0xFE5_2Response = { - groups: [{ groupUin: 100, info: { groupName: 'G' } }], - }; - const env = makeOidbEnvelope(0xFE5, 2, body, false); - const viaWrapper = encodeOidbEnv(env); - const viaDirect = protobuf_encode>(env); - expect(hex(viaWrapper)).toBe(hex(viaDirect)); - - const back = decodeOidbEnv(viaWrapper); - expect(back.body?.groups?.[0]?.groupUin).toBe(100); - expect(back.body?.groups?.[0]?.info?.groupName).toBe('G'); - }); - - it('round-trips OidbBase with non-trivial nested body', () => { - const body: OidbSvcTrpcTcp0xFE5_2Response = { - groups: [{ groupUin: 100, info: { groupName: 'G' } }], - }; - const envelope: OidbBase = { - command: 0xFE5, subCommand: 2, errorCode: 1, body, errorMsg: 'ok', reserved: 1, - }; - const encoded = protobuf_encode>(envelope); - const decoded = protobuf_decode>(encoded); - expect(decoded.command).toBe(0xFE5); - expect(decoded.errorCode).toBe(1); - expect(decoded.body?.groups?.[0]?.groupUin).toBe(100); - expect(decoded.body?.groups?.[0]?.info?.groupName).toBe('G'); - }); - - // ── Documented divergence: proto3 default-value omission ──────────── - - it('proton omits default-valued numeric fields (legacy emits them)', () => { - // proto3 wire format says fields equal to their default value MUST NOT be - // emitted. Proton follows that; the legacy runtime encoder always emits. - // Either form is round-trippable through a conforming proto3 reader — the - // missing field decodes as its default. This test pins that behaviour. - const data: LongMsgSettings = { field1: 0, field2: 0, field3: 0, field4: 0 }; - const legacy = protoEncode(data as any, LongMsgSettingsSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(''); // nothing on the wire - expect(legacy.length).toBeGreaterThan(0); // legacy emits all zeros - // Legacy emits explicit zero values; a proto3-conforming reader sees them - // back when decoding. (Decoding the empty wire returns null because the - // legacy decoder treats an empty buffer as "no message at all" — that's - // also semantically equivalent to "all-default values" in proto3.) - expect(protoDecode(legacy, LongMsgSettingsSchema)).toMatchObject({ - field1: 0, field2: 0, field3: 0, field4: 0, - }); - }); - - // ── round-trip via decode ─────────────────────────────────────────── - - it('round-trips SendLongMsgResp through proton encode → legacy decode', () => { - const data: SendLongMsgResp = { result: { resId: 'rt-1' } }; - const encoded = protobuf_encode(data); - const decoded = protoDecode(encoded, SendLongMsgRespSchema); - expect(decoded?.result?.resId).toBe('rt-1'); - }); - - it('round-trips SendLongMsgResp through legacy encode → proton decode', () => { - const data: SendLongMsgResp = { result: { resId: 'rt-2' } }; - const encoded = protoEncode(data as any, SendLongMsgRespSchema); - const decoded = protobuf_decode(encoded); - expect(decoded.result?.resId).toBe('rt-2'); - }); - - // ── Group album TRPC envelopes (PR #31) ───────────────────────────── - // - // Raw TRPC packets — not OIDB-wrapped — that the group-album actions - // ship to `QunAlbum.trpc.qzone.webapp_qun_*`. Field names are mostly - // positional (`field1`/`field2`/...) because the upstream protocol - // doesn't expose semantic names; the byte-for-byte parity below is - // what guarantees the migration preserved every numbered field. - - // NOTE: every numeric/bytes field below is non-zero / non-empty — - // proton follows proto3 semantics and skips default-valued fields on - // the wire, while the legacy runtime encoder writes them all. Byte - // parity therefore only holds when no field equals its default. The - // actual production callers in `actions/group-album.ts` *do* pass - // some zero-valued fields (e.g. `field1: 0`), which means the - // post-migration packet drops a few leading zero tags — semantically - // equivalent to a proto3-conforming reader, see the explicit - // divergence test earlier in this file. - - it('encodes GetMediaListRequest (nested ReqInfo + extMap) identically', () => { - const data: GetMediaListRequest = { - field1: 1, // proto3 non-default - field2: new Uint8Array([0xab]), - field3: new Uint8Array([0xcd]), - reqInfo: { groupId: '555', albumId: 'alb-1', field3: 7, attachInfo: 'cursor', field5: 'tag' }, - traceId: '_1700000000_12345', - extMap: [{ key: 'fc-appid', value: '100' }], - }; - const legacy = protoEncode(data as any, GetMediaListRequestSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes DoQunCommentRequest (deeply nested anonymous-in-legacy schemas) identically', () => { - const data: DoQunCommentRequest = { - field1: 8527, - field2: new Uint8Array([0x01]), - field3: new Uint8Array([0x02]), - body: { - groupId: '555', - field3: 2, - reqBody: { - field1: { field3: 3, field4: 'h' }, - field2: { field1: { uin: '10001' } }, - field5: { - field1: { - field2: { - field1: 1, field2: 'a', lloc: 'lloc-x', - field4: 'b', field6: 'c', field7: 1, field8: 1, field9: 1, - field14: 1, field15: 1, field17: 1, - }, - }, - albumId: 'alb-1', - field5: 1, - }, - }, - field5: { - field2: { uin: '10001' }, - field3: { field1: 1, field2: 'hello', field3: 'd', field4: 'e', field5: 1, field6: 'f' }, - clientKey: 'ck-1', - }, - }, - traceId: '_1700000000_12345', - extMap: [{ key: 'fc-appid', value: '100' }], - }; - const legacy = protoEncode(data as any, DoQunCommentRequestSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes DoQunLikeRequest (with bigint time/batchId) identically', () => { - const data: DoQunLikeRequest = { - field1: 5495, - field2: 'h5_test', - field3: 'h5_test', - body: { - type: 2, - like: { id: '421_1_0_555|alb|42', status: 1 }, // non-default - publish: { - cellCommon: { time: 1700000000000n, feedId: '422_0_42' }, - cellUserInfo: { user: { uin: '10001' } }, - cellMedia: { albumId: 'alb', batchId: 42n }, - cellQunInfo: { qunId: '555' }, - }, - clientKey: 'ck', - }, - extMap: [{ key: 'fc-appid', value: '100' }], - }; - const legacy = protoEncode(data as any, DoQunLikeRequestSchema); - const proton = protobuf_encode(data); - expect(hex(proton)).toBe(hex(legacy)); - }); - - it('encodes DeleteMediasRequest + decodes DeleteMediasResponse identically', () => { - const req: DeleteMediasRequest = { - field1: 8694, field2: 'h5_test', field3: 'h5_test', - body: { groupId: '555', albumId: 'alb', lloc: 'lloc-x' }, - traceId: 'tr-1', - extMap: [{ key: 'fc-appid', value: '100' }], - }; - expect(hex(protobuf_encode(req))) - .toBe(hex(protoEncode(req as any, DeleteMediasRequestSchema))); - - // Response: encode with legacy, decode with proton, fields stay aligned. - const respBytes = protoEncode({ field1: 8694, field2: 10023, field3: 'no right delete' } as any, DeleteMediasResponseSchema); - const decoded = protobuf_decode(respBytes); - expect(decoded.field1).toBe(8694); - expect(decoded.field2).toBe(10023); - expect(decoded.field3).toBe('no right delete'); - }); -}); diff --git a/packages/core/tests/web-actions/cookies.test.ts b/packages/core/tests/web-actions/cookies.test.ts index fdf54624..e585ac9d 100644 --- a/packages/core/tests/web-actions/cookies.test.ts +++ b/packages/core/tests/web-actions/cookies.test.ts @@ -4,7 +4,7 @@ import type { OidbBase } from '../../src/bridge/proto/proton/oidb'; import type { OidbClientKeyResp, OidbGetPskeyResp, -} from '../../src/bridge/proto/proton/oidb-action'; +} from '../../src/bridge/proto/proton/oidb-actions/base'; // `encodeOidbEnv` / `decodeOidbEnv` are proton-bound pass-through wrappers // — the plugin substitutes them at the call site with the inlined codec,