From ce78a3bbdf1fc05a04fe2c1cc0767bb0e6dcc217 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Fri, 22 May 2026 08:09:29 +0800 Subject: [PATCH] fix(oidb): update sequence type in Oidb0x9083Req to uint_64 for compatibility --- packages/core/src/bridge/apis/interaction.ts | 26 ++++++++++++++++++-- packages/proto-defs/src/oidb-actions/base.ts | 5 +++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/core/src/bridge/apis/interaction.ts b/packages/core/src/bridge/apis/interaction.ts index 5d349406..84c9c934 100644 --- a/packages/core/src/bridge/apis/interaction.ts +++ b/packages/core/src/bridge/apis/interaction.ts @@ -6,6 +6,8 @@ // already absorbed into `MessageApi` back in commit 1. import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; +import { toHexUpper } from '@snowluma/common/hex'; +import { createLogger } from '@snowluma/common/logger'; import type { OidbBase } from '@snowluma/proto-defs/oidb'; import type { Oidb0x9083Req, @@ -21,6 +23,8 @@ import { makeOidbEnvelope, runOidb } from '@snowluma/bridge/bridge-oidb'; function asBridge(ctx: BridgeContext): Bridge { return ctx as unknown as Bridge; } +const log = createLogger('Interaction'); + export class InteractionApi { constructor(private readonly ctx: BridgeContext) {} @@ -76,7 +80,10 @@ export class InteractionApi { const bridge = asBridge(this.ctx); const req: any = { groupId: BigInt(groupId), - sequence, + // sequence is uint_64 on the wire (matches LagrangeV2's + // SetGroupReactionRequest.Sequence:ulong). Caller still passes + // a JS number — bigint conversion lives here. + sequence: BigInt(sequence), emojiType, emojiId, cookie: cookie ? Buffer.from(cookie, 'base64') : new Uint8Array(0), @@ -85,7 +92,8 @@ export class InteractionApi { field12: 1, }; const env = makeOidbEnvelope(0x9083, 1, req); - const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9083_1', protobuf_encode>(env)); + const reqBytes = protobuf_encode>(env); + const respBytes = await runOidb(bridge, 'OidbSvcTrpcTcp.0x9083_1', reqBytes); const resp = protobuf_decode>(respBytes).body; // userInfo is repeated on the wire — one entry per liker. The pre-fix // schema treated it as single, which made multi-user responses collapse @@ -94,6 +102,20 @@ export class InteractionApi { .map(u => ({ uin: Number(u?.uin ?? 0) })) .filter(u => u.uin > 0); const respCookie = resp?.cookie ? Buffer.from(resp.cookie).toString('base64') : ''; + // Empty-list debug aid. fetch_emoji_like has been hard to validate + // without wire data (this is the only public 0x9083 implementation), + // so when nothing comes back we dump the full request/response hex + // and the decoded envelope. Logs at debug level — invisible unless + // the user opts in. + if (users.length === 0) { + log.debug( + `getEmojiLikes empty result: group=${groupId} seq=${sequence} ` + + `emojiId=${emojiId} emojiType=${emojiType} count=${count} ` + + `cookieIn=${cookie ? 'yes' : 'no'} respCookieOut=${respCookie || '(empty)'}`, + ); + log.debug(` req hex: ${toHexUpper(reqBytes)}`); + log.debug(` resp hex: ${toHexUpper(respBytes)}`); + } return { users, cookie: respCookie, isLast: !respCookie }; } } diff --git a/packages/proto-defs/src/oidb-actions/base.ts b/packages/proto-defs/src/oidb-actions/base.ts index 59f85965..fad37e1f 100644 --- a/packages/proto-defs/src/oidb-actions/base.ts +++ b/packages/proto-defs/src/oidb-actions/base.ts @@ -521,7 +521,10 @@ export interface FaceroamOpResp { // Lagrange.Core V2 `Internal/Packets/Service/SetGroupReaction.cs`. export interface Oidb0x9083Req { groupId?: pb<2, uint_64>; - sequence?: pb<3, uint_32>; + // ulong on LagrangeV2's `SetGroupReactionRequest`. wire-compatible + // with uint_32 for small seq values (which is what message sequences + // actually are today), but match the spec to be safe — costs nothing. + sequence?: pb<3, uint_64>; emojiId?: pb<4, string>; emojiType?: pb<5, uint_32>; cookie?: pb<6, bytes>;