From c62f51750a27712c64640c5020dafbcc27488bca Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 13:39:54 +0800 Subject: [PATCH 1/9] fix(oidb): drop the obsolete field 2 from OIDB 0xFE1_2 (user profile) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQ now rejects fetchUserProfile() with: [oidb] one of uid/openid is invaild The cause: SnowLuma's request schema declared field 2 as a zero-valued uint32 (`field2: 0`) and our encoder doesn't skip 0 varints. Newer QQ NT versions reinterpret field 2 of OIDB 0xFE1_2 as `uid: string` / `openid: string`, so a varint 0 there decodes as an empty/invalid uid → server bounces the whole request. NapCat's equivalent transformer (Oidb.0XFE1_2.ts) emits only `uin` (field 1) and `key[]` (field 3) — nothing in field 2. Match that shape exactly. Effect: warmUpBridgeState's "self info via profile" fallback path now succeeds for accounts that QQ omits from the friend list, so the WebUI shows their nickname instead of leaving it blank. --- packages/core/src/bridge/bridge-contacts.ts | 3 ++- packages/core/src/bridge/proto/oidb-action.ts | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/core/src/bridge/bridge-contacts.ts b/packages/core/src/bridge/bridge-contacts.ts index 63c2bbaa..23f537f1 100644 --- a/packages/core/src/bridge/bridge-contacts.ts +++ b/packages/core/src/bridge/bridge-contacts.ts @@ -208,9 +208,10 @@ export async function fetchGroupMemberList(bridge: Bridge, groupId: number): Pro export async function fetchUserProfile(bridge: Bridge, uin: number): Promise { const keys = [20002, 27394, 20009, 20031, 101, 103, 102, 20020, 20003, 20026, 105, 27372, 27406, 20037]; + // Only `uin` and `keys` — see OidbUserInfoRequestSchema for why + // sending field 2 makes the server reject the request. const body = { uin, - field2: 0, keys: keys.map(k => ({ key: k })), }; diff --git a/packages/core/src/bridge/proto/oidb-action.ts b/packages/core/src/bridge/proto/oidb-action.ts index b4b28a1a..ec521dff 100644 --- a/packages/core/src/bridge/proto/oidb-action.ts +++ b/packages/core/src/bridge/proto/oidb-action.ts @@ -190,10 +190,14 @@ 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 }, - field2: { field: 2, type: 'uint32' as const }, - keys: { field: 3, type: 'repeated_message' as const, schema: OidbUserInfoKeySchema }, + uin: { field: 1, type: 'uint32' as const }, + keys: { field: 3, type: 'repeated_message' as const, schema: OidbUserInfoKeySchema }, } satisfies ProtoSchema; export const OidbTwoNumberSchema = { From a07521d9dea0891f79ae425e1687b6b5c1adcd53 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 13:48:13 +0800 Subject: [PATCH 2/9] fix(bridge): drop bloated fields from OIDB 0xFE5_2 group-list request closes #42 On accounts with ~200+ groups, fetchGroupList was asking QQ to fill in every config flag (all 32 bools in config1 plus all 8 in config2) even though our response decoder reads only groupName / memberMax / memberCount / customInfo.remark / a handful of named info fields. QQ NT obligingly packs every requested field into the response. At group counts >= ~200 the payload is large enough to blow the named-pipe write buffer on the QQ side; SnowLuma reads EPIPE and the entire session dies during warmup: WARN [Hook] pipe error: PID=23928 err=read EPIPE INFO [OneBot] session closed: UIN=... WARN [OneBot] failed to load groups for UIN ...: qq_hook client closed Issue #42 reporter (airline233) bisected the breakage to two clusters of unused bool flags: - config1.field5003 (a 5xxx-range expansive descriptor) - the whole of config2 (per-group aux info we don't decode) This commit applies exactly their verified safe combination and inlines a comment so nobody flips them back on without context. The decoded response shape (groupName, memberCount, memberMax, remark, etc.) is unchanged. --- packages/core/src/bridge/bridge-contacts.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/core/src/bridge/bridge-contacts.ts b/packages/core/src/bridge/bridge-contacts.ts index 23f537f1..d63b10da 100644 --- a/packages/core/src/bridge/bridge-contacts.ts +++ b/packages/core/src/bridge/bridge-contacts.ts @@ -103,6 +103,19 @@ export async function fetchFriendList(bridge: Bridge): Promise { // --------------------------------------------------------------------------- export async function fetchGroupList(bridge: Bridge): Promise { + // The config flags ask QQ which per-group fields to include in the + // response. Asking for everything looks innocent on small accounts + // but on ~200+ groups it makes the QQ NT process write a payload + // large enough to blow the named-pipe write buffer — we then read + // EPIPE and the whole session dies. See issue #42. + // + // The user-verified safe combination: keep `config1.*` mostly on + // (the response decoder pulls groupOwner / memberMax / memberCount / + // groupName / description / question / announcement from this + // group), but turn off the two costly groups of bools that never + // map back to a decoded field: + // - config1.field5003 (an expansive 5xxx-range descriptor) + // - all of config2 (auxiliary per-group blob the decoder ignores) const allTrue = true; const body = { config: { @@ -114,11 +127,11 @@ export async function fetchGroupList(bridge: Bridge): Promise { question: allTrue, field20: allTrue, field22: allTrue, field23: allTrue, field24: allTrue, field25: allTrue, field26: allTrue, field27: allTrue, field28: allTrue, field29: allTrue, field30: allTrue, field31: allTrue, - field32: allTrue, field5001: allTrue, field5002: allTrue, field5003: allTrue, + field32: allTrue, field5001: allTrue, field5002: allTrue, field5003: false, }, config2: { - field1: allTrue, field2: allTrue, field3: allTrue, field4: allTrue, - field5: allTrue, field6: allTrue, field7: allTrue, field8: allTrue, + field1: false, field2: false, field3: false, field4: false, + field5: false, field6: false, field7: false, field8: false, }, config3: { field5: allTrue, field6: allTrue }, }, From 24056c3de0d271a29d6fd6489bb3015370c63d9c Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 14:06:44 +0800 Subject: [PATCH 3/9] feat(msg-push): decode group message emoji reactions (Event0x2DC subType=16) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQ has been pushing Event0x2DC subType=16 every time someone tapped an emoji on a message in a group, and we were dropping it silently (only surfacing the PR5 [MsgPush.Unknown] debug line that prompted this issue). Now we decode it into a first-class event and fan it out to OneBot clients. Wire details (cribbed from NapCat's GroupReactNotify transformer): - body.msgContent has a 7-byte magic prefix; strip before decoding. - GroupReactNotify { groupUin(4), field13(13), groupReactionData(44) }. - field13 is a discriminator — same subType is reused for other notify variants, only 35 means "emoji react". Other values now fall through to MsgPush.Unknown so we still spot future variants. - Inside groupReactionData (3-level nested data wrapper, ugh): code emoji id (system face = numeric str, market = code) count usually 1 operatorUid needs identity.findUinByUid to resolve to uin type 1 = add, else = remove target.seq msg_seq of the reacted-to message New event kind `group_msg_emoji_like` flows through the standard pipeline: bridge event → event-bus → converter → OneBot wire. Converter emits the gocqhttp / NapCat extension shape: notice_type: group_msg_emoji_like sub_type: add | remove group_id, user_id, operator_id, message_id, message_seq, likes: [{ emoji_id, count }] message_id is reconstructed via hashMessageIdInt32(msgSeq, groupId, GROUP_MESSAGE_EVENT) so it matches whatever id the bot originally handed out for the message being reacted to, even if it's no longer in the message store. formatEvent also gets a case so the [Event] log reads cleanly: 表情回应 [群名(123)] | [Alice(99999)] +[76] msgSeq=4242 7 new tests cover the happy path, type=2 (remove), field13!=35 (routed to MsgPush.Unknown), prefix-too-short edge, converter shape both for add and remove, and the formatEvent string. --- packages/core/src/bridge/events.ts | 19 +- .../bridge/msg-push/decoders/event-0x2dc.ts | 55 ++++- packages/core/src/bridge/msg-push/enums.ts | 1 + packages/core/src/bridge/proto/notify.ts | 38 ++++ .../core/src/onebot/event-converter/index.ts | 2 + .../src/onebot/event-converter/to-notice.ts | 30 +++ packages/core/src/onebot/event-pipeline.ts | 1 + packages/core/src/utils/event-format.ts | 2 + .../core/tests/group-msg-emoji-like.test.ts | 213 ++++++++++++++++++ 9 files changed, 358 insertions(+), 3 deletions(-) create mode 100644 packages/core/tests/group-msg-emoji-like.test.ts diff --git a/packages/core/src/bridge/events.ts b/packages/core/src/bridge/events.ts index 27e75eb6..e2665791 100644 --- a/packages/core/src/bridge/events.ts +++ b/packages/core/src/bridge/events.ts @@ -230,6 +230,22 @@ export interface FriendAddEvent extends QQEvent { userUin: number; } +export interface GroupMsgEmojiLikeEvent extends QQEvent { + kind: 'group_msg_emoji_like'; + groupId: number; + operatorUin: number; + operatorUid: string; + /** Sequence of the message that was reacted to (server-assigned msg_seq). */ + msgSeq: number; + /** Emoji ID. QQ system faces are short numeric strings; market faces + * are alphanumeric. We keep the wire string verbatim. */ + emojiId: string; + /** Multiplicity of the reaction event. Usually 1. */ + count: number; + /** True when the reaction is being added; false when removed. */ + isAdd: boolean; +} + export type QQEventVariant = | FriendMessage | GroupMessage @@ -246,4 +262,5 @@ export type QQEventVariant = | GroupPokeEvent | GroupEssenceEvent | GroupFileUploadEvent - | FriendAddEvent; + | FriendAddEvent + | GroupMsgEmojiLikeEvent; diff --git a/packages/core/src/bridge/msg-push/decoders/event-0x2dc.ts b/packages/core/src/bridge/msg-push/decoders/event-0x2dc.ts index 7b072b83..28efafe7 100644 --- a/packages/core/src/bridge/msg-push/decoders/event-0x2dc.ts +++ b/packages/core/src/bridge/msg-push/decoders/event-0x2dc.ts @@ -1,12 +1,14 @@ // Handles Event0x2DC wrapper (732). Internal switch on subType dispatches -// to GroupMute (12) / GroupRecall (17) / GroupGreyTip (20) / GroupEssence (21). +// to GroupMute (12) / GroupMsgEmojiLike (16) / GroupRecall (17) / +// GroupGreyTip (20) / GroupEssence (21). import { protoDecode } from '../../../protobuf/decode'; import { - GroupMuteSchema, NotifyMessageBodySchema, + GroupMuteSchema, NotifyMessageBodySchema, GroupReactNotifySchema, } from '../../proto/notify'; import type { GroupMuteEvent, GroupRecallEvent, GroupPokeEvent, GroupEssenceEvent, + GroupMsgEmojiLikeEvent, QQEventVariant, } from '../../events'; import type { MsgPushDecoder } from '../registry'; @@ -23,6 +25,7 @@ const unknownLog = createLogger('MsgPush.Unknown'); export const decodeEvent0x2DC: MsgPushDecoder = (ctx) => { switch (ctx.head.subType as Event0x2DCSubType) { case Event0x2DCSubType.GroupMuteNotice: return decodeGroupMute(ctx); + case Event0x2DCSubType.GroupMsgEmojiLikeNotice: return decodeGroupMsgEmojiLike(ctx); case Event0x2DCSubType.GroupRecallNotice: return decodeGroupRecall(ctx); case Event0x2DCSubType.GroupGreyTipNotice: return decodeGroupGreyTip(ctx); case Event0x2DCSubType.GroupEssenceNotice: return decodeGroupEssence(ctx); @@ -108,3 +111,51 @@ function decodeGroupEssence(ctx: MsgPushContext): QQEventVariant[] { }; return [ev]; } + +// Magic prefix QQ prepends to the GroupReactNotify payload inside +// body.msgContent for Event0x2DC subType=16. Same value NapCat strips +// (see api/group.ts: `msgContent?.slice(7)`). +const GROUP_REACT_PREFIX_BYTES = 7; +// Discriminator on GroupReactNotify.field13 — same subType is reused +// for other notify variants, only 35 means "emoji react". Anything +// else falls through to MsgPush.Unknown for protocol-drift visibility. +const GROUP_REACT_DISCRIMINATOR = 35; + +function decodeGroupMsgEmojiLike(ctx: MsgPushContext): QQEventVariant[] { + if (ctx.content.length <= GROUP_REACT_PREFIX_BYTES) return []; + const payload = ctx.content.subarray(GROUP_REACT_PREFIX_BYTES); + const notify = protoDecode(payload, GroupReactNotifySchema); + if (!notify) return []; + if ((notify.field13 ?? 0) !== GROUP_REACT_DISCRIMINATOR) { + unknownLog.debug('Event0x2DC subType=16 unhandled field13=%d (expected %d for emoji react)', + notify.field13 ?? 0, GROUP_REACT_DISCRIMINATOR); + return []; + } + const content = notify.groupReactionData?.data?.data?.groupReactionDataContent; + const target = notify.groupReactionData?.data?.data?.groupReactionTarget; + if (!content) return []; + + const groupId = Number(notify.groupUin ?? 0n); + const operatorUid = content.operatorUid ?? ''; + const emojiId = content.code ?? ''; + const count = content.count ?? 1; + // type is QQ's add/remove discriminator: 1 = react added, 2 = react + // removed. Older payloads occasionally omit it; default to "add" + // since most clients can only generate add events. + const isAdd = (content.type ?? 1) === 1; + const msgSeq = Number(target?.seq ?? 0n); + + const ev: GroupMsgEmojiLikeEvent = { + kind: 'group_msg_emoji_like', + time: ctx.head.timestamp, + selfUin: ctx.selfUin, + groupId, + operatorUin: resolveUidToUin(ctx.identity, groupId, operatorUid, ctx.fromUin), + operatorUid, + msgSeq, + emojiId, + count, + isAdd, + }; + return [ev]; +} diff --git a/packages/core/src/bridge/msg-push/enums.ts b/packages/core/src/bridge/msg-push/enums.ts index c94b3875..38561e87 100644 --- a/packages/core/src/bridge/msg-push/enums.ts +++ b/packages/core/src/bridge/msg-push/enums.ts @@ -21,6 +21,7 @@ export enum PkgType { export enum Event0x2DCSubType { GroupMuteNotice = 12, + GroupMsgEmojiLikeNotice = 16, GroupRecallNotice = 17, GroupGreyTipNotice = 20, GroupEssenceNotice = 21, diff --git a/packages/core/src/bridge/proto/notify.ts b/packages/core/src/bridge/proto/notify.ts index 36eb1163..2121ddad 100644 --- a/packages/core/src/bridge/proto/notify.ts +++ b/packages/core/src/bridge/proto/notify.ts @@ -205,3 +205,41 @@ export const NotifyMessageBodySchema = { 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/onebot/event-converter/index.ts b/packages/core/src/onebot/event-converter/index.ts index 806bb5c1..5b5b6032 100644 --- a/packages/core/src/onebot/event-converter/index.ts +++ b/packages/core/src/onebot/event-converter/index.ts @@ -23,6 +23,7 @@ import { convertGroupFileUpload, convertGroupMemberJoin, convertGroupMemberLeave, + convertGroupMsgEmojiLike, convertGroupMute, convertGroupPoke, convertGroupRecall, @@ -98,6 +99,7 @@ export async function convertEvent( case 'group_essence': return convertGroupEssence(ctx, event); case 'group_file_upload': return convertGroupFileUpload(ctx, event); case 'friend_add': return convertFriendAdd(ctx, event); + case 'group_msg_emoji_like': return convertGroupMsgEmojiLike(ctx, event); // Requests. case 'friend_request': return convertFriendRequest(ctx, event); diff --git a/packages/core/src/onebot/event-converter/to-notice.ts b/packages/core/src/onebot/event-converter/to-notice.ts index 1f4875e0..484d4921 100644 --- a/packages/core/src/onebot/event-converter/to-notice.ts +++ b/packages/core/src/onebot/event-converter/to-notice.ts @@ -21,6 +21,7 @@ type GroupPoke = Extract; type GroupEssence = Extract; type GroupFileUpload = Extract; type FriendAdd = Extract; +type GroupMsgEmojiLike = Extract; export function convertGroupMemberJoin(ctx: ConverterContext, event: GroupMemberJoin): JsonObject { return { @@ -187,3 +188,32 @@ export function convertFriendAdd(ctx: ConverterContext, event: FriendAdd): JsonO user_id: event.userUin, }; } + +/** + * Group message emoji reaction notice. Matches the gocqhttp / NapCat + * extension shape (`notice_type: 'group_msg_emoji_like'`) since OneBot + * v11 standard has no slot for reactions and that's what every + * downstream framework keys off. + */ +export function convertGroupMsgEmojiLike(ctx: ConverterContext, event: GroupMsgEmojiLike): JsonObject { + // Reconstruct the OneBot message_id we originally minted for the + // reacted-to message. hashMessageIdInt32 is deterministic so the ID + // matches whatever the client received at receive-time, even when + // the message has fallen out of our store. + const messageId = applyMessageIdResolver( + ctx.messageIdResolver, true, event.groupId, event.msgSeq, GROUP_MESSAGE_EVENT, + ); + return { + time: event.time, + self_id: ctx.selfId, + post_type: 'notice', + notice_type: 'group_msg_emoji_like', + sub_type: event.isAdd ? 'add' : 'remove', + group_id: event.groupId, + user_id: event.operatorUin, + operator_id: event.operatorUin, + message_id: messageId, + message_seq: event.msgSeq, + likes: [{ emoji_id: event.emojiId, count: event.count }], + }; +} diff --git a/packages/core/src/onebot/event-pipeline.ts b/packages/core/src/onebot/event-pipeline.ts index c0ccb3e2..1df60864 100644 --- a/packages/core/src/onebot/event-pipeline.ts +++ b/packages/core/src/onebot/event-pipeline.ts @@ -73,6 +73,7 @@ const NOTICE_KINDS = [ 'group_essence', 'group_file_upload', 'friend_add', + 'group_msg_emoji_like', ] as const satisfies readonly QQEventVariant['kind'][]; async function convertAndDispatch(ctx: OneBotInstanceContext, event: QQEventVariant): Promise { diff --git a/packages/core/src/utils/event-format.ts b/packages/core/src/utils/event-format.ts index ffa1aa28..243f098a 100644 --- a/packages/core/src/utils/event-format.ts +++ b/packages/core/src/utils/event-format.ts @@ -198,6 +198,8 @@ export function formatEvent(identity: IdentityService, event: QQEventVariant): s return `群邀请 ${formatUser(identity, undefined, event.fromUin)} -> ${formatGroup(identity, event.groupId)}`; case 'group_essence': return `精华 ${formatGroup(identity, event.groupId)} | ${event.set ? '+' : '-'}精华`; + case 'group_msg_emoji_like': + return `表情回应 ${formatGroup(identity, event.groupId)} | ${formatUser(identity, event.groupId, event.operatorUin, event.operatorUid)} ${event.isAdd ? '+' : '-'}[${event.emojiId}] msgSeq=${event.msgSeq}`; default: return null; } diff --git a/packages/core/tests/group-msg-emoji-like.test.ts b/packages/core/tests/group-msg-emoji-like.test.ts new file mode 100644 index 00000000..a986ac1d --- /dev/null +++ b/packages/core/tests/group-msg-emoji-like.test.ts @@ -0,0 +1,213 @@ +// Tests for the Event0x2DC subType=16 (GroupMsgEmojiLike) end-to-end: +// - decoder strips the 7-byte prefix and decodes GroupReactNotify +// - field13==35 yields a GroupMsgEmojiLikeEvent +// - field13!=35 surfaces under MsgPush.Unknown and emits nothing +// - converter shape matches the gocqhttp / NapCat extension layout +// - 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 { 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'; +import type { GroupMsgEmojiLikeEvent, QQEventVariant } from '../src/bridge/events'; +import { convertGroupMsgEmojiLike } from '../src/onebot/event-converter/to-notice'; +import { GROUP_MESSAGE_EVENT, hashMessageIdInt32 } from '../src/onebot/message-id'; +import { formatEvent } from '../src/utils/event-format'; +import { subscribeLogs, type LogEntry } from '../src/utils/logger'; + +const SELF_UIN = '10001'; +const GROUP_ID = 123456789; + +function makeIdentity(): IdentityService { + return IdentityService.memory(SELF_UIN); +} + +/** Build the raw bytes QQ would push into ctx.content for subType=16: + * 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 out = new Uint8Array(prefix.length + body.length); + out.set(prefix, 0); + out.set(body, prefix.length); + return out; +} + +function makeCtx(content: Uint8Array, identity = makeIdentity()): MsgPushContext { + return { + head: { msgType: 732, subType: 16, sequence: 0, timestamp: 1735000000, msgId: 0 }, + fromUin: 0, + fromUid: '', + selfUin: Number(SELF_UIN), + content, + body: undefined, + responseHead: undefined, + identity, + }; +} + +describe('decodeEvent0x2DC subType=16 — GroupMsgEmojiLike', () => { + it('decodes a field13=35 react add into a GroupMsgEmojiLikeEvent', () => { + const content = buildReactContent({ + groupUin: BigInt(GROUP_ID), + field13: 35, + groupReactionData: { + data: { + data: { + groupReactionTarget: { seq: 4242n }, + groupReactionDataContent: { + code: '76', + count: 1, + operatorUid: 'u_operator_xxx', + type: 1, // add + }, + }, + }, + }, + }); + + const [event] = decodeEvent0x2DC(makeCtx(content)) as GroupMsgEmojiLikeEvent[]; + expect(event).toBeDefined(); + expect(event.kind).toBe('group_msg_emoji_like'); + expect(event.groupId).toBe(GROUP_ID); + expect(event.operatorUid).toBe('u_operator_xxx'); + expect(event.emojiId).toBe('76'); + expect(event.msgSeq).toBe(4242); + expect(event.count).toBe(1); + expect(event.isAdd).toBe(true); + }); + + it('decodes type=2 as react remove (isAdd=false)', () => { + const content = buildReactContent({ + groupUin: BigInt(GROUP_ID), + field13: 35, + groupReactionData: { + data: { + data: { + groupReactionTarget: { seq: 1n }, + groupReactionDataContent: { + code: '⭐', + count: 1, + operatorUid: 'u_x', + type: 2, + }, + }, + }, + }, + }); + + const [event] = decodeEvent0x2DC(makeCtx(content)) as GroupMsgEmojiLikeEvent[]; + expect(event.isAdd).toBe(false); + expect(event.emojiId).toBe('⭐'); + }); + + it('drops the packet and logs to MsgPush.Unknown when field13 is not 35', () => { + const captured: LogEntry[] = []; + const unsub = subscribeLogs((e) => captured.push(e)); + + const content = buildReactContent({ + groupUin: BigInt(GROUP_ID), + field13: 99, // not 35 + groupReactionData: { + data: { data: { groupReactionDataContent: { code: 'x', operatorUid: 'u_y' } } }, + }, + }); + + const result = decodeEvent0x2DC(makeCtx(content)); + unsub(); + + expect(result).toHaveLength(0); + const unknown = captured.find((e) => + e.scope === 'MsgPush.Unknown' && /field13=99/.test(e.message)); + expect(unknown).toBeDefined(); + }); + + it('returns empty when content is shorter than the prefix length', () => { + const tooShort = new Uint8Array([1, 2, 3]); // < 7 bytes + expect(decodeEvent0x2DC(makeCtx(tooShort))).toEqual([]); + }); +}); + +describe('convertGroupMsgEmojiLike — OneBot notice shape', () => { + const baseEvent: GroupMsgEmojiLikeEvent = { + kind: 'group_msg_emoji_like', + time: 1735000000, + selfUin: 10001, + groupId: 123456789, + operatorUin: 99999, + operatorUid: 'u_x', + msgSeq: 4242, + emojiId: '76', + count: 1, + isAdd: true, + }; + + // Real production wiring puts a hashMessageIdInt32-based resolver + // on the ctx; mirror that so message_id is the same value the + // bot would have minted for the original message. + const ctx = { + selfId: 10001, + imageUrlResolver: null, + mediaUrlResolver: null, + messageIdResolver: (_isGroup: boolean, sessionId: number, sequence: number, eventName: string) => + hashMessageIdInt32(sequence, sessionId, eventName), + mediaSegmentSink: null, + } as never; + + it('produces a group_msg_emoji_like notice with sub_type=add and resolved message_id', () => { + const out = convertGroupMsgEmojiLike(ctx, baseEvent); + expect(out.post_type).toBe('notice'); + expect(out.notice_type).toBe('group_msg_emoji_like'); + expect(out.sub_type).toBe('add'); + expect(out.group_id).toBe(123456789); + expect(out.user_id).toBe(99999); + expect(out.operator_id).toBe(99999); + expect(out.message_seq).toBe(4242); + expect(out.message_id).toBe(hashMessageIdInt32(4242, 123456789, GROUP_MESSAGE_EVENT)); + expect(out.likes).toEqual([{ emoji_id: '76', count: 1 }]); + }); + + it('flips sub_type to remove when isAdd is false', () => { + const out = convertGroupMsgEmojiLike(ctx, { ...baseEvent, isAdd: false }); + expect(out.sub_type).toBe('remove'); + }); +}); + +describe('formatEvent — group_msg_emoji_like', () => { + let savedLevel: string | undefined; + beforeEach(() => { savedLevel = process.env.SNOWLUMA_LOG_LEVEL; }); + afterEach(() => { + if (savedLevel === undefined) delete process.env.SNOWLUMA_LOG_LEVEL; + else process.env.SNOWLUMA_LOG_LEVEL = savedLevel; + }); + + it('renders a one-line summary with group, operator and emoji id', () => { + const identity = IdentityService.memory(SELF_UIN); + identity.rememberGroups([{ + groupId: GROUP_ID, groupName: 'TestGroup', remark: '', + memberCount: 1, memberMax: 500, members: new Map(), + }]); + identity.rememberGroupMembers(GROUP_ID, [{ + uin: 99999, uid: 'u_x', nickname: 'Alice', card: '', + role: 'member', level: 0, title: '', + joinTime: 0, lastSentTime: 0, shutUpTime: 0, + }]); + + const event: QQEventVariant = { + kind: 'group_msg_emoji_like', + time: 0, selfUin: Number(SELF_UIN), + groupId: GROUP_ID, + operatorUin: 99999, operatorUid: 'u_x', + msgSeq: 100, emojiId: '76', count: 1, isAdd: true, + }; + + const line = formatEvent(identity, event); + expect(line).toBeDefined(); + expect(line).toContain('TestGroup'); + expect(line).toContain('Alice'); + expect(line).toContain('[76]'); + expect(line).toContain('msgSeq=100'); + }); +}); From a46043317551af9d79f8e06a9664ed8f95693e69 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 14:29:52 +0800 Subject: [PATCH 4/9] refactor(webui): redesign per-UIN config page into sidebar + tabs + modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original page stacked four expanded network sections vertically with inline editing, so the first view drowned in every field across every adapter at once. Restructured to a sidebar + tabs + modal layout: - Account sidebar collapses to a 56px avatar column with name/UIN tooltips; expanded it keeps the original 260px nickname + UIN layout. - Right pane swaps the stacked sections for a 5-tab strip (通用设置 / HTTP API / HTTP 客户端 / WS 服务端 / WS 客户端) with a per-tab badge count. - Each network tab is a list of summary cards: name + projected key info (host:port/path, url · role, etc.) + format/report/token badges + inline enable toggle + edit/delete buttons. No live-typed fields. - Create and edit both route through a single NodeEditDialog with kind-specific field strips; cancel truly discards the draft. - Per-kind metadata (title, summary projector, defaultEntry factory) lives in config/defaults.ts so adding a new adapter kind only needs one descriptor entry. Behavior preserved end-to-end: same per-UIN config payload, same useOneBotInstanceConfig hook, same dirty-switch confirm flow, same save endpoint. --- .../src/components/config/account-sidebar.tsx | 114 +++ .../webui/src/components/config/defaults.ts | 159 +++ .../config/general-settings-tab.tsx | 31 + .../components/config/node-edit-dialog.tsx | 407 ++++++++ .../components/config/node-summary-card.tsx | 130 +++ .../src/components/pages/config-page.tsx | 963 ++++++------------ 6 files changed, 1159 insertions(+), 645 deletions(-) create mode 100644 packages/webui/src/components/config/account-sidebar.tsx create mode 100644 packages/webui/src/components/config/defaults.ts create mode 100644 packages/webui/src/components/config/general-settings-tab.tsx create mode 100644 packages/webui/src/components/config/node-edit-dialog.tsx create mode 100644 packages/webui/src/components/config/node-summary-card.tsx diff --git a/packages/webui/src/components/config/account-sidebar.tsx b/packages/webui/src/components/config/account-sidebar.tsx new file mode 100644 index 00000000..6d0bfb47 --- /dev/null +++ b/packages/webui/src/components/config/account-sidebar.tsx @@ -0,0 +1,114 @@ +// Account selector strip. Collapsing to a 56px avatar-only column keeps +// the right-side editor breathing on smaller screens; expanded it shows +// nickname + UIN like the original. Selection routes through +// `requestSwitchUin` so the dirty-modify guard still gates the switch. + +import { motion } from 'motion/react'; +import { ChevronLeft, ChevronRight } from 'lucide-react'; +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { ScrollArea } from '@/components/ui/scroll-area'; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; +import { cn } from '@/lib/utils'; +import type { QQInfo } from '@/types'; + +function qqAvatarUrl(uin: string) { + return `/avatar/${encodeURIComponent(uin)}`; +} + +interface AccountSidebarProps { + accounts: QQInfo[]; + selectedUin: string | null; + onSelect: (uin: string) => void; + collapsed: boolean; + onToggleCollapsed: () => void; +} + +export function AccountSidebar({ + accounts, + selectedUin, + onSelect, + collapsed, + onToggleCollapsed, +}: AccountSidebarProps) { + return ( + +
+ {!collapsed && 在线连接} + +
+ + {accounts.length === 0 ? ( +

+ {collapsed ? '—' : '暂无在线会话'} +

+ ) : ( + + +
+ {accounts.map((q) => { + const isActive = selectedUin === q.uin; + const button = ( + onSelect(q.uin)} + className={cn( + 'flex items-center gap-2.5 rounded-lg border text-left transition-colors cursor-pointer', + collapsed ? 'justify-center p-1.5' : 'px-2.5 py-2', + isActive ? 'border-primary/30 bg-primary/10' : 'border-transparent hover:bg-accent/40', + )} + > + + + {(q.nickname || q.uin).slice(0, 2)} + + {!collapsed && ( +
+
+ {q.nickname || q.uin} +
+
+ {q.uin} +
+
+ )} +
+ ); + return collapsed ? ( + + {button} + +
+ {q.nickname || q.uin} + {q.uin} +
+
+
+ ) : ( + button + ); + })} +
+
+
+ )} +
+ ); +} diff --git a/packages/webui/src/components/config/defaults.ts b/packages/webui/src/components/config/defaults.ts new file mode 100644 index 00000000..1c71ce6a --- /dev/null +++ b/packages/webui/src/components/config/defaults.ts @@ -0,0 +1,159 @@ +// Per-network-kind metadata: localized title, summary projector for the +// list view, and factory for "create new" defaults. Centralised here so the +// page / list / dialog all agree on naming and shape and a new adapter +// kind only needs one entry in NETWORK_TABS to wire end-to-end. + +import type { + HttpClientNetwork, + HttpServerNetwork, + MessageFormat, + NetworkKind, + OneBotNetworks, + WsClientNetwork, + WsRole, + WsServerNetwork, +} from '@/types'; + +export type TabKey = 'general' | NetworkKind; + +export interface NetworkTabDescriptor { + key: K; + /** Tab label and dialog title prefix. */ + title: string; + /** Short subtitle shown under the tab when active. */ + description: string; + /** Singular noun for "新建 / 编辑 X". */ + noun: string; + /** Project the adapter into a short list-card summary string. */ + summarize: (item: OneBotNetworks[K][number]) => string; + /** Factory producing a fresh adapter with a unique suffix in its name. */ + defaultEntry: (suffix: number) => OneBotNetworks[K][number]; +} + +function genToken(): string { + const bytes = new Uint8Array(32); + globalThis.crypto.getRandomValues(bytes); + return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join(''); +} + +const httpServersTab: NetworkTabDescriptor<'httpServers'> = { + key: 'httpServers', + title: 'HTTP API', + description: '本地监听 HTTP 端口,OneBot 客户端发起请求', + noun: 'HTTP API 服务', + summarize: (it: HttpServerNetwork) => { + const host = it.host?.trim() || '0.0.0.0'; + const path = (it.path?.trim() || '/').replace(/^\/?/, '/'); + return `${host}:${it.port}${path}`; + }, + defaultEntry: (suffix): HttpServerNetwork => ({ + name: `http-${suffix}`, + host: '0.0.0.0', + port: 3000, + path: '/', + accessToken: genToken(), + messageFormat: 'array', + reportSelfMessage: false, + }), +}; + +const httpClientsTab: NetworkTabDescriptor<'httpClients'> = { + key: 'httpClients', + title: 'HTTP 客户端', + description: '主动向远端 URL POST 推送事件', + noun: 'HTTP 推送客户端', + summarize: (it: HttpClientNetwork) => it.url || '(未设置 URL)', + defaultEntry: (suffix): HttpClientNetwork => ({ + name: `httppost-${suffix}`, + url: 'http://127.0.0.1:5700', + messageFormat: 'array', + reportSelfMessage: false, + }), +}; + +const wsServersTab: NetworkTabDescriptor<'wsServers'> = { + key: 'wsServers', + title: 'WS 服务端', + description: '本地监听 WebSocket 端口,客户端建立持久连接', + noun: 'WebSocket 服务', + summarize: (it: WsServerNetwork) => { + const host = it.host?.trim() || '0.0.0.0'; + const path = (it.path?.trim() || '/').replace(/^\/?/, '/'); + const role = it.role ?? 'Universal'; + return `${host}:${it.port}${path} · ${role}`; + }, + defaultEntry: (suffix): WsServerNetwork => ({ + name: `ws-${suffix}`, + host: '0.0.0.0', + port: 3001, + path: '/', + role: 'Universal' as WsRole, + accessToken: genToken(), + messageFormat: 'array', + reportSelfMessage: false, + }), +}; + +const wsClientsTab: NetworkTabDescriptor<'wsClients'> = { + key: 'wsClients', + title: 'WS 客户端', + description: '主动连接到外部 WebSocket 服务器(reverse-ws)', + noun: 'WebSocket 反向客户端', + summarize: (it: WsClientNetwork) => { + const role = it.role ?? 'Universal'; + return `${it.url || '(未设置 URL)'} · ${role}`; + }, + defaultEntry: (suffix): WsClientNetwork => ({ + name: `wsclient-${suffix}`, + url: 'ws://127.0.0.1:8080/ws', + role: 'Universal' as WsRole, + reconnectIntervalMs: 5000, + messageFormat: 'array', + reportSelfMessage: false, + }), +}; + +/** + * Order here drives both the tab strip order and the dialog/page wiring. + * Each entry stays strictly typed on its kind so callers get the narrow + * adapter shape (no NetworkBase widening). + */ +export const NETWORK_TABS = { + httpServers: httpServersTab, + httpClients: httpClientsTab, + wsServers: wsServersTab, + wsClients: wsClientsTab, +} satisfies { [K in NetworkKind]: NetworkTabDescriptor }; + +export const NETWORK_TAB_ORDER: NetworkKind[] = [ + 'httpServers', + 'httpClients', + 'wsServers', + 'wsClients', +]; + +export const ALL_TABS: TabKey[] = ['general', ...NETWORK_TAB_ORDER]; + +/** + * Find the smallest suffix N (starting at list.length + 1) such that + * `factory(N).name` doesn't collide with any existing adapter. Used by + * the page to seed a fresh-default adapter when the user clicks "create". + */ +export function nextUniqueSuffix( + networks: { name: string }[], + factory: (suffix: number) => { name: string }, +): number { + const used = new Set(networks.map((n) => n.name)); + let suffix = networks.length + 1; + while (used.has(factory(suffix).name)) suffix += 1; + return suffix; +} + +// Re-exported for callers that just need to type a generic adapter. +export interface AdapterCommon { + name: string; + enabled?: boolean; + accessToken?: string; + messageFormat: MessageFormat; + reportSelfMessage: boolean; +} diff --git a/packages/webui/src/components/config/general-settings-tab.tsx b/packages/webui/src/components/config/general-settings-tab.tsx new file mode 100644 index 00000000..3ed5a3cc --- /dev/null +++ b/packages/webui/src/components/config/general-settings-tab.tsx @@ -0,0 +1,31 @@ +// "通用设置" tab — fields that apply to the whole OneBotInstance rather +// than any specific adapter. Currently just the music-sign service URL, +// but the layout has room for additional cross-cutting toggles. + +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import type { OneBotConfig } from '@/types'; + +interface GeneralSettingsTabProps { + config: OneBotConfig; + onChange: (next: OneBotConfig) => void; +} + +export function GeneralSettingsTab({ config, onChange }: GeneralSettingsTabProps) { + return ( +
+
+ + onChange({ ...config, musicSignUrl: e.target.value || undefined })} + /> +

+ 用于音乐分享卡片签名。未配置时音乐相关消息段会回落为普通文本。 +

+
+
+ ); +} diff --git a/packages/webui/src/components/config/node-edit-dialog.tsx b/packages/webui/src/components/config/node-edit-dialog.tsx new file mode 100644 index 00000000..b1ca652b --- /dev/null +++ b/packages/webui/src/components/config/node-edit-dialog.tsx @@ -0,0 +1,407 @@ +// Modal editor used for both "create" and "edit". Holds a local draft +// copy of the adapter until the user clicks save (so cancel really does +// throw away changes). Validation is minimal — blank-name and dup-name +// disable the save button; everything else is best-effort coercion. + +import { useState } from 'react'; +import { Button } from '@/components/ui/button'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { cn } from '@/lib/utils'; +import type { + HttpClientNetwork, + HttpServerNetwork, + MessageFormat, + NetworkKind, + OneBotNetworks, + WsClientNetwork, + WsRole, + WsServerNetwork, +} from '@/types'; +import { NETWORK_TABS } from './defaults'; + +type AnyAdapter = OneBotNetworks[K][number]; + +interface NodeEditDialogProps { + open: boolean; + onOpenChange: (open: boolean) => void; + kind: K; + /** Initial draft state — caller seeds it with `defaultEntry` for create + * or the existing item for edit. */ + initial: AnyAdapter; + /** True when editing an existing adapter (drives title + button copy). */ + isEdit: boolean; + /** Names of every other adapter in the same list, for duplicate check. */ + otherNames: string[]; + onSubmit: (item: AnyAdapter) => void; +} + +export function NodeEditDialog(props: NodeEditDialogProps) { + const { open, onOpenChange, kind, initial, isEdit, otherNames, onSubmit } = props; + const tab = NETWORK_TABS[kind]; + + // Local draft. The parent unmounts this component on close so each + // open gets a fresh `initial` via useState's lazy init — no effect-based + // resync needed, which keeps the lifecycle linear. + const [draft, setDraft] = useState>(initial); + + const trimmedName = draft.name?.trim() ?? ''; + const blankName = trimmedName.length === 0; + const duplicateName = !blankName && otherNames.includes(trimmedName); + + const canSave = !blankName && !duplicateName; + + const patch = (changes: Partial>) => setDraft({ ...draft, ...changes } as AnyAdapter); + + return ( + + + + {isEdit ? `编辑 ${tab.noun}` : `新建 ${tab.noun}`} + {tab.description} + + +
+ patch({ name: v } as Partial>)} + error={blankName ? '请填写名称' : duplicateName ? '名称与其它节点重复' : undefined} + /> + + + + patch({ accessToken: v || undefined } as Partial>)} + /> + +
+ patch({ messageFormat: v } as Partial>)} + /> + patch({ reportSelfMessage: v === 'on' } as Partial>)} + /> +
+ +
+
+ +

+ 关闭后保存即可保留配置但不启动该节点 +

+
+ + patch({ enabled: v ? undefined : false } as Partial>) + } + ariaLabel="启用" + /> +
+
+ + + + + +
+
+ ); +} + +// ─────────────── kind-specific field strips ─────────────── + +interface KindFieldsProps { + kind: K; + draft: AnyAdapter; + patch: (changes: Partial>) => void; +} + +function KindFields({ kind, draft, patch }: KindFieldsProps) { + // Per-branch narrowing — TS can't follow the generic relationship so + // each arm casts once. Field components receive specific shapes. + if (kind === 'httpServers') { + const it = draft as HttpServerNetwork; + const set = patch as (c: Partial) => void; + return ( +
+ set({ host: v || undefined })} + /> + set({ port: Number(v) || 0 })} + /> + set({ path: v || undefined })} + /> +
+ ); + } + if (kind === 'httpClients') { + const it = draft as HttpClientNetwork; + const set = patch as (c: Partial) => void; + return ( +
+ set({ url: v })} + /> + set({ timeoutMs: Number(v) || undefined })} + /> +
+ ); + } + if (kind === 'wsServers') { + const it = draft as WsServerNetwork; + const set = patch as (c: Partial) => void; + return ( + <> +
+ set({ host: v || undefined })} + /> + set({ port: Number(v) || 0 })} + /> + set({ path: v || undefined })} + /> +
+ set({ role: v })} + /> + + ); + } + if (kind === 'wsClients') { + const it = draft as WsClientNetwork; + const set = patch as (c: Partial) => void; + return ( + <> + set({ url: v })} + /> +
+ set({ role: v })} + /> + set({ reconnectIntervalMs: Number(v) || undefined })} + /> +
+ + ); + } + return null; +} + +// ─────────────── shared form bits ─────────────── + +interface FieldProps { + label: string; + value: string | number | undefined; + onChange: (v: string) => void; + placeholder?: string; + type?: 'text' | 'number' | 'url'; + error?: string; +} + +function Field({ label, value, onChange, placeholder, type = 'text', error }: FieldProps) { + return ( +
+ + onChange(e.target.value)} + placeholder={placeholder} + className={cn(error && 'border-destructive focus-visible:ring-destructive/40')} + /> + {error &&

{error}

} +
+ ); +} + +interface SegmentedOption { + value: T; + label: string; +} + +function SegmentedField({ + label, + value, + options, + onChange, +}: { + label: string; + value: T; + options: ReadonlyArray>; + onChange: (v: T) => void; +}) { + return ( +
+ +
+ {options.map((opt) => { + const active = value === opt.value; + return ( + + ); + })} +
+
+ ); +} + +function SelectField({ + label, + value, + options, + onChange, +}: { + label: string; + value: T; + options: ReadonlyArray>; + onChange: (v: T) => void; +}) { + return ( +
+ + +
+ ); +} + +interface ToggleSwitchProps { + value: boolean; + onChange: (v: boolean) => void; + ariaLabel: string; +} + +function ToggleSwitch({ value, onChange, ariaLabel }: ToggleSwitchProps) { + return ( + + ); +} + +const FORMAT_OPTIONS: ReadonlyArray> = [ + { value: 'array', label: '数组' }, + { value: 'string', label: 'CQ 码' }, +]; + +const REPORT_OPTIONS: ReadonlyArray> = [ + { value: 'on', label: '开启' }, + { value: 'off', label: '关闭' }, +]; + +const WS_ROLE_OPTIONS: ReadonlyArray> = [ + { value: 'Universal', label: 'Universal' }, + { value: 'Event', label: 'Event' }, + { value: 'Api', label: 'Api' }, +]; diff --git a/packages/webui/src/components/config/node-summary-card.tsx b/packages/webui/src/components/config/node-summary-card.tsx new file mode 100644 index 00000000..f2e3fae7 --- /dev/null +++ b/packages/webui/src/components/config/node-summary-card.tsx @@ -0,0 +1,130 @@ +// One row in the per-kind list view. Shows just enough to identify the +// adapter at a glance (name + projected summary + token state + the two +// flags) plus the inline enable toggle. Real editing always goes through +// the dialog — there are no live-typed inputs here. + +import { motion } from 'motion/react'; +import { Pencil, Trash2 } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { Badge } from '@/components/ui/badge'; +import { cn } from '@/lib/utils'; +import type { AdapterCommon } from './defaults'; + +interface NodeSummaryCardProps { + item: T; + summary: string; + duplicateName: boolean; + onToggleEnabled: (next: boolean) => void; + onEdit: () => void; + onDelete: () => void; +} + +export function NodeSummaryCard({ + item, + summary, + duplicateName, + onToggleEnabled, + onEdit, + onDelete, +}: NodeSummaryCardProps) { + const enabled = item.enabled !== false; + const blankName = !item.name?.trim(); + + return ( + +
+
+ + {item.name || '(未命名)'} + + {duplicateName && ( + 名称重复 + )} + {!enabled && ( + 已停用 + )} +
+
{summary}
+
+ + {item.messageFormat === 'string' ? 'CQ 码' : '数组'} + + + {item.reportSelfMessage ? '上报自身' : '不上报自身'} + + {item.accessToken ? ( + + 已设 Token + + ) : ( + + 无 Token + + )} +
+
+ +
+ + + +
+
+ ); +} + +interface ToggleSwitchProps { + value: boolean; + onChange: (v: boolean) => void; + ariaLabel: string; +} + +function ToggleSwitch({ value, onChange, ariaLabel }: ToggleSwitchProps) { + return ( + + ); +} diff --git a/packages/webui/src/components/pages/config-page.tsx b/packages/webui/src/components/pages/config-page.tsx index 4154be6c..a9954fac 100644 --- a/packages/webui/src/components/pages/config-page.tsx +++ b/packages/webui/src/components/pages/config-page.tsx @@ -1,93 +1,42 @@ -import { useState } from 'react'; +// OneBot per-UIN configuration page. +// +// Layout: collapsible left sidebar for account selection + tabbed right +// pane (通用 / 4 network kinds). Each network tab is a list view of +// summary cards with inline enable/disable; create + edit both go +// through `NodeEditDialog`. The dirty-modify guard from the original +// hook is preserved end-to-end — switching accounts or kinds doesn't +// drop unsaved changes silently. + +import { useMemo, useState } from 'react'; import { motion } from 'motion/react'; -import { MousePointerClick, Plus, Save, Trash2 } from 'lucide-react'; +import { MousePointerClick, Plus, Save } from 'lucide-react'; import { Button } from '@/components/ui/button'; -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { ScrollArea } from '@/components/ui/scroll-area'; -import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; -import { Badge } from '@/components/ui/badge'; import { Skeleton } from '@/components/ui/skeleton'; +import { Badge } from '@/components/ui/badge'; import { ConfirmDialog } from '@/components/confirm-dialog'; import { cn } from '@/lib/utils'; import type { - MessageFormat, NetworkKind, OneBotConfig, OneBotNetworks, - WsRole, } from '@/types'; import { useOneBotInstanceConfig } from '@/hooks/use-onebot-instance-config'; import { useAppState } from '@/contexts/AppStateContext'; +import { AccountSidebar } from '@/components/config/account-sidebar'; +import { GeneralSettingsTab } from '@/components/config/general-settings-tab'; +import { NodeSummaryCard } from '@/components/config/node-summary-card'; +import { NodeEditDialog } from '@/components/config/node-edit-dialog'; +import { + ALL_TABS, + NETWORK_TABS, + nextUniqueSuffix, + type TabKey, +} from '@/components/config/defaults'; -function qqAvatarUrl(uin: string) { - return `/avatar/${encodeURIComponent(uin)}`; -} - -function generateAccessToken(): string { - const bytes = new Uint8Array(32); - globalThis.crypto.getRandomValues(bytes); - return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join(''); -} - -function Field({ - label, - value, - onChange, - placeholder, - type = 'text', - className, -}: { - label: string; - value: string | number | undefined; - onChange: (v: string) => void; - placeholder?: string; - type?: 'text' | 'number' | 'url'; - className?: string; -}) { - return ( -
- - onChange(e.target.value)} - placeholder={placeholder} - /> -
- ); -} - -interface SectionProps { - title: string; - description?: string; - onAdd?: () => void; - children: React.ReactNode; - count?: number; -} - -function Section({ title, description, onAdd, children, count }: SectionProps) { - return ( - - -
-
- {title} - {typeof count === 'number' && {count}} -
- {description &&

{description}

} -
- {onAdd && ( - - )} -
- {children} -
- ); -} +type DialogState = + | { open: false } + | { open: true; kind: NetworkKind; index: number | null; seed: OneBotNetworks[NetworkKind][number] }; +// index: null → create with `seed`, otherwise edit the item at that position. export function ConfigPage() { const { qqList, selectedUin, setSelectedUin } = useAppState(); @@ -105,322 +54,137 @@ export function ConfigPage() { selectedUin, onSelectedUinChange: setSelectedUin, }); - const [confirmSave, setConfirmSave] = useState(false); - const update = (next: OneBotConfig) => setConfig(next); - const pendingSwitchAccount = pendingSwitchUin - ? qqList.find((q) => q.uin === pendingSwitchUin) ?? null - : null; + const [activeTab, setActiveTab] = useState('general'); + const [sidebarCollapsed, setSidebarCollapsed] = useState(false); + const [confirmSave, setConfirmSave] = useState(false); + // The edit dialog is modal and blocks every other click in the page, + // so `selectedUin` cannot change while it's open — no defensive close + // wiring needed beyond the dialog's own open/close. + const [dialog, setDialog] = useState({ open: false }); + + const pendingSwitchAccount = useMemo( + () => (pendingSwitchUin ? qqList.find((q) => q.uin === pendingSwitchUin) ?? null : null), + [pendingSwitchUin, qqList], + ); + + // Per-kind helpers (typed at the call site so the dialog's onSubmit + // payload is exactly the kind's adapter shape). + function updateKind(kind: K, next: OneBotNetworks[K]): void { + if (!config) return; + setConfig({ ...config, networks: { ...config.networks, [kind]: next } }); + } + + function handleCreate(kind: K, item: OneBotNetworks[K][number]): void { + if (!config) return; + const list = config.networks[kind] as OneBotNetworks[K]; + updateKind(kind, [...list, item] as OneBotNetworks[K]); + } + + function handleEdit(kind: K, index: number, item: OneBotNetworks[K][number]): void { + if (!config) return; + const list = config.networks[kind] as OneBotNetworks[K]; + const next = list.map((it, i) => (i === index ? item : it)) as OneBotNetworks[K]; + updateKind(kind, next); + } + + function handleDelete(kind: K, index: number): void { + if (!config) return; + const list = config.networks[kind] as OneBotNetworks[K]; + const next = list.filter((_, i) => i !== index) as OneBotNetworks[K]; + updateKind(kind, next); + } + + function handleToggleEnabled(kind: K, index: number, enabled: boolean): void { + if (!config) return; + const list = config.networks[kind] as OneBotNetworks[K]; + const next = list.map((it, i) => + i === index ? ({ ...it, enabled: enabled ? undefined : false } as OneBotNetworks[K][number]) : it, + ) as OneBotNetworks[K]; + updateKind(kind, next); + } + + const openCreate = (kind: NetworkKind) => { + if (!config) return; + const tab = NETWORK_TABS[kind]; + const list = config.networks[kind]; + const suffix = nextUniqueSuffix(list, tab.defaultEntry); + setDialog({ open: true, kind, index: null, seed: tab.defaultEntry(suffix) }); + }; + + const openEdit = (kind: NetworkKind, index: number) => { + if (!config) return; + const item = config.networks[kind][index]; + if (!item) return; + setDialog({ open: true, kind, index, seed: item }); + }; return ( -
- {/* Account list */} - - - 在线连接 - - - {qqList.length === 0 ? ( -

暂无在线会话

- ) : ( - -
- {qqList.map((q) => { - const isActive = selectedUin === q.uin; - return ( - requestSwitchUin(q.uin)} - className={cn( - 'flex items-center gap-2.5 rounded-lg border px-2.5 py-2 text-left transition-colors cursor-pointer', - isActive ? 'border-primary/30 bg-primary/10' : 'border-transparent hover:bg-accent/40' - )} - > - - - {(q.nickname || q.uin).slice(0, 2)} - -
-
- {q.nickname} -
-
{q.uin}
-
-
- ); - })} -
-
- )} -
-
+
+ setSidebarCollapsed((v) => !v)} + /> - {/* Editor */} -
+
{!selectedUin ? ( -
- -

请在左栏选择会话以配置通信节点

-
+ ) : !config ? ( -
- - - -
+ ) : (
- {/* Header */} -
-
-

OneBot 协议端点

- UIN {selectedUin} -
-
- {saveStatus && ( - - {saveStatus} - - )} - {dirty && !saveStatus && ( - - 未保存 - - )} - -
-
+ setConfirmSave(true)} + activeTab={activeTab} + onCreate={ + activeTab !== 'general' ? () => openCreate(activeTab as NetworkKind) : undefined + } + /> -
- update({ ...config, musicSignUrl: v || undefined })} + + + {activeTab === 'general' ? ( + + ) : ( + openCreate(activeTab)} + onEdit={(idx) => openEdit(activeTab, idx)} + onDelete={(idx) => handleDelete(activeTab, idx)} + onToggleEnabled={(idx, v) => handleToggleEnabled(activeTab, idx, v)} /> -
- - {/* HTTP Servers */} - updateNetworks(config, update, 'httpServers', arr)} - renderFields={(item, patch) => ( - <> - patch({ host: v || undefined })} - className="sm:w-40" - /> - patch({ port: Number(v) || 0 })} - className="sm:w-28" - /> - patch({ path: v || undefined })} - className="sm:w-32" - /> - patch({ accessToken: v || undefined })} - className="flex-1" - /> - - )} - defaultEntry={(suffix) => ({ - name: `http-${suffix}`, - host: '0.0.0.0', - port: 3000, - path: '/', - accessToken: generateAccessToken(), - messageFormat: 'array', - reportSelfMessage: false, - })} - /> - - {/* HTTP Clients (POST push) */} - updateNetworks(config, update, 'httpClients', arr)} - renderFields={(item, patch) => ( - <> - patch({ url: v })} - className="flex-1" - /> - patch({ accessToken: v || undefined })} - className="sm:w-56" - /> - patch({ timeoutMs: Number(v) || undefined })} - className="sm:w-32" - /> - - )} - defaultEntry={(suffix) => ({ - name: `httppost-${suffix}`, - url: 'http://127.0.0.1:5700', - messageFormat: 'array', - reportSelfMessage: false, - })} - /> - - {/* WebSocket Servers */} - updateNetworks(config, update, 'wsServers', arr)} - renderFields={(item, patch) => ( - <> - patch({ host: v || undefined })} - className="sm:w-40" - /> - patch({ port: Number(v) || 0 })} - className="sm:w-28" - /> - patch({ path: v || undefined })} - className="sm:w-32" - /> - patch({ role: v })} - className="sm:w-32" - /> - patch({ accessToken: v || undefined })} - className="flex-1" - /> - - )} - defaultEntry={(suffix) => ({ - name: `ws-${suffix}`, - host: '0.0.0.0', - port: 3001, - path: '/', - role: 'Universal' as WsRole, - accessToken: generateAccessToken(), - messageFormat: 'array', - reportSelfMessage: false, - })} - /> - - {/* WebSocket Clients (reverse) */} - updateNetworks(config, update, 'wsClients', arr)} - renderFields={(item, patch) => ( - <> - patch({ url: v })} - className="flex-1" - /> - patch({ role: v })} - className="sm:w-32" - /> - patch({ reconnectIntervalMs: Number(v) || undefined })} - className="sm:w-36" - /> - patch({ accessToken: v || undefined })} - className="sm:w-56" - /> - - )} - defaultEntry={(suffix) => ({ - name: `wsclient-${suffix}`, - url: 'ws://127.0.0.1:8080/ws', - role: 'Universal' as WsRole, - reconnectIntervalMs: 5000, - messageFormat: 'array', - reportSelfMessage: false, - })} - /> + )}
)}
+ {/* Single dialog covers create + edit across all 4 kinds. */} + {dialog.open && config && ( + !open && setDialog({ open: false })} + kind={dialog.kind} + initial={dialog.seed} + isEdit={dialog.index != null} + otherNames={otherNames(config.networks, dialog.kind, dialog.index)} + onSubmit={(item) => { + if (dialog.index == null) handleCreate(dialog.kind, item); + else handleEdit(dialog.kind, dialog.index, item); + }} + /> + )} + {label}
- ); +// ─────────────── header ─────────────── + +interface HeaderBarProps { + selectedUin: string; + dirty: boolean; + saveStatus: string; + onSave: () => void; + activeTab: TabKey; + onCreate?: () => void; } -interface ToggleFieldProps { - label: string; - description?: string; - value: boolean; - onChange: (v: boolean) => void; -} - -function ToggleField({ label, description, value, onChange }: ToggleFieldProps) { +function HeaderBar({ selectedUin, dirty, saveStatus, onSave, activeTab, onCreate }: HeaderBarProps) { return ( -
-
- - {description && ( -

{description}

- )} +
+
+

OneBot 协议端点

+ + UIN {selectedUin} +
- + {dirty && !saveStatus && ( + + 未保存 + + )} + {onCreate && ( + + )} + +
); } -interface SegmentedOption { - value: T; - label: string; +// ─────────────── tab strip ─────────────── + +interface TabStripProps { + activeTab: TabKey; + onChange: (key: TabKey) => void; + counts: Record; } -function SegmentedField({ - label, - value, - options, - onChange, - className, -}: { - label: string; - value: T; - options: ReadonlyArray>; - onChange: (v: T) => void; - className?: string; -}) { +function TabStrip({ activeTab, onChange, counts }: TabStripProps) { return ( -
- -
- {options.map((opt) => { - const active = value === opt.value; +
+ {ALL_TABS.map((key) => { + const label = key === 'general' ? '通用设置' : NETWORK_TABS[key].title; + const count = key === 'general' ? null : counts[key]; + const active = activeTab === key; + return ( + + ); + })} +
+ ); +} + +function countMap(networks: OneBotNetworks): Record { + return { + httpServers: networks.httpServers.length, + httpClients: networks.httpClients.length, + wsServers: networks.wsServers.length, + wsClients: networks.wsClients.length, + }; +} + +// ─────────────── network tab body ─────────────── + +interface NetworkTabViewProps { + kind: NetworkKind; + config: OneBotConfig; + onCreateClick: () => void; + onEdit: (index: number) => void; + onDelete: (index: number) => void; + onToggleEnabled: (index: number, enabled: boolean) => void; +} + +function NetworkTabView({ + kind, + config, + onCreateClick, + onEdit, + onDelete, + onToggleEnabled, +}: NetworkTabViewProps) { + const tab = NETWORK_TABS[kind]; + const list = config.networks[kind]; + // `summarize` is typed per K in NETWORK_TABS; the union here forces a + // widening cast at the call site rather than ladder-of-ifs per tab. + const summarize = tab.summarize as (it: typeof list[number]) => string; + + if (list.length === 0) { + return ( +
+

暂无 {tab.title} 节点

+ +
+ ); + } + + return ( +
+

{tab.description}

+
+ {list.map((item, idx) => { + const others = list.filter((_, i) => i !== idx).map((n) => n.name); + const duplicate = !!item.name && others.includes(item.name); return ( - + onToggleEnabled(idx, v)} + onEdit={() => onEdit(idx)} + onDelete={() => onDelete(idx)} + /> ); })}
@@ -543,211 +388,39 @@ function SegmentedField({ ); } -function SelectField({ - label, - value, - options, - onChange, - className, -}: { - label: string; - value: T; - options: ReadonlyArray>; - onChange: (v: T) => void; - className?: string; -}) { +// ─────────────── empty + loading ─────────────── + +function EmptyState() { return ( -
- - +
+ +

请在左栏选择会话以配置通信节点

); } -const ADAPTER_FORMAT_OPTIONS: ReadonlyArray> = [ - { value: 'array', label: '数组' }, - { value: 'string', label: 'CQ 码' }, -]; - -const ADAPTER_REPORT_OPTIONS: ReadonlyArray> = [ - { value: 'on', label: '开启' }, - { value: 'off', label: '关闭' }, -]; - -const WS_ROLE_OPTIONS: ReadonlyArray> = [ - { value: 'Universal', label: 'Universal' }, - { value: 'Event', label: 'Event' }, - { value: 'Api', label: 'Api' }, -]; - -interface BaseAdapter { - name: string; - enabled?: boolean; - accessToken?: string; - messageFormat: MessageFormat; - reportSelfMessage: boolean; -} - -interface NetworkSectionProps { - title: string; - description?: string; - kind: NetworkKind; - networks: T[]; - onChange: (next: T[]) => void; - renderFields: (item: T, patch: (changes: Partial) => void) => React.ReactNode; - defaultEntry: (suffix: number) => T; -} - -function NetworkSection({ - title, - description, - networks, - onChange, - renderFields, - defaultEntry, -}: NetworkSectionProps) { - const handleAdd = () => { - const used = new Set(networks.map((n) => n.name)); - let suffix = networks.length + 1; - let entry = defaultEntry(suffix); - while (used.has(entry.name)) { - suffix += 1; - entry = defaultEntry(suffix); - } - onChange([...networks, entry]); - }; - - const patchAt = (idx: number, changes: Partial) => { - onChange(networks.map((it, i) => (i === idx ? { ...it, ...changes } : it))); - }; - - const removeAt = (idx: number) => { - onChange(networks.filter((_, i) => i !== idx)); - }; - +function LoadingSkeleton() { return ( -
- {networks.length === 0 ? ( - - ) : ( - networks.map((item, idx) => ( - i !== idx).map((n) => n.name)} - onPatch={(changes) => patchAt(idx, changes)} - onRemove={() => removeAt(idx)} - renderFields={renderFields} - /> - )) - )} -
+
+ + + + +
); } -interface AdapterRowProps { - item: T; - otherNames: string[]; - onPatch: (changes: Partial) => void; - onRemove: () => void; - renderFields: (item: T, patch: (changes: Partial) => void) => React.ReactNode; -} +// ─────────────── helpers ─────────────── -function AdapterRow({ - item, - otherNames, - onPatch, - onRemove, - renderFields, -}: AdapterRowProps) { - const enabled = item.enabled !== false; - const duplicateName = !!item.name && otherNames.includes(item.name); - const blankName = !item.name?.trim(); - - const formatValue: MessageFormat = item.messageFormat ?? 'array'; - const reportValue: 'on' | 'off' = item.reportSelfMessage ? 'on' : 'off'; - - return ( - -
- onPatch({ name: v } as Partial)} - className="sm:w-44" - /> - onPatch({ enabled: v ? undefined : false } as Partial)} - /> - -
- {(blankName || duplicateName) && ( -

- {blankName ? '请填写名称' : '名称与其它适配器重复'} -

- )} - -
{renderFields(item, onPatch)}
- -
- onPatch({ messageFormat: v } as Partial)} - /> - - onPatch({ - reportSelfMessage: v === 'on', - } as Partial) - } - /> -
-
- ); -} - -function updateNetworks( - config: OneBotConfig, - update: (next: OneBotConfig) => void, +/** Names of every adapter except the one currently being edited. */ +function otherNames( + networks: OneBotNetworks, kind: K, - next: OneBotNetworks[K], -): void { - update({ - ...config, - networks: { ...config.networks, [kind]: next }, - }); + excludeIndex: number | null, +): string[] { + const list = networks[kind]; + return list + .filter((_, i) => i !== excludeIndex) + .map((n) => n.name) + .filter((s): s is string => typeof s === 'string' && s.length > 0); } From 7a2de230bfdd45fe54cd8e3e074479dd76232fdd Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 14:31:08 +0800 Subject: [PATCH 5/9] fix(webui): pass aria-checked as a string literal on switch buttons A11y checkers (axe-core / jsx-a11y) flag the boolean form because the ARIA spec defines aria-checked as the enum "true" | "false" | "mixed", not a boolean. React serialized the boolean to the right wire value at runtime, but the inspection layer keys off the JSX expression's static type. Switching to the explicit ternary silences both. --- packages/webui/src/components/config/node-edit-dialog.tsx | 2 +- packages/webui/src/components/config/node-summary-card.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webui/src/components/config/node-edit-dialog.tsx b/packages/webui/src/components/config/node-edit-dialog.tsx index b1ca652b..ac6b0b63 100644 --- a/packages/webui/src/components/config/node-edit-dialog.tsx +++ b/packages/webui/src/components/config/node-edit-dialog.tsx @@ -372,7 +372,7 @@ function ToggleSwitch({ value, onChange, ariaLabel }: ToggleSwitchProps) { + +
+
+ ); +} + interface SegmentedOption { value: T; label: string; From 562fd4f7f9c271796604777c3bead43d2dd81289 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 14:58:58 +0800 Subject: [PATCH 8/9] fix(oidb): set envelope reserved=1 on OIDB 0xFE1_2 (user / stranger) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to c62f517. Dropping the obsolete field 2 from the body was necessary but insufficient: newer QQ NT still rejects the request with [oidb] one of uid/openid is invaild The actual trigger is the OIDB envelope-level `reserved` flag. Lagrange.Core's FetchStrangerByUin sets `Reserved = 1`, our call sent `Reserved = 0`. The server uses that bit to pick its validation path: - reserved=1 → UIN-form variant: server translates body.uin to the internal uid itself - reserved=0 → UID-form variant: server expects a uid/openid string in the body and rejects when it can't find one Our request body has only `uin` + `keys`, so the UID-form path was always going to fail. Setting `isUid: true` (which is the existing flag that flips envelope `reserved` to 1; the parameter name is historical and misleading) puts the call onto the correct branch. Applied to both call sites that target OidbSvcTrpcTcp.0xfe1_2: - fetchUserProfile (bridge-contacts.ts) — fixes the "failed to load self profile for UIN N" warmup warning. - getStrangerStatus (actions/extras.ts) — same OIDB cmd; would have failed identically if exercised against newer QQ NT. Also updated the `isUid` JSDoc on OidbCall to spell out the actual semantic (UIN-form variant marker, not "this call uses UID-keyed data") since the name will keep tripping people otherwise. --- packages/core/src/bridge/actions/extras.ts | 3 +++ packages/core/src/bridge/bridge-contacts.ts | 8 +++++++- packages/core/src/bridge/bridge-oidb.ts | 14 ++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/core/src/bridge/actions/extras.ts b/packages/core/src/bridge/actions/extras.ts index 38a082a0..3aca81ae 100644 --- a/packages/core/src/bridge/actions/extras.ts +++ b/packages/core/src/bridge/actions/extras.ts @@ -66,6 +66,9 @@ export async function getStrangerStatus(bridge: Bridge, uin: number): Promise ({ key: k })), }; + // Set OIDB envelope `reserved = 1` (the `isUid: true` flag — the + // name is historical, the wire semantic is "this is the UIN-form + // variant of the call"). Without it newer QQ NT versions take the + // UID-form validation path, find neither uid nor openid in the body + // and bounce the request with `[oidb] one of uid/openid is invaild`. + // Matches Lagrange.Core's FetchStrangerByUin (Reserved = 1). const resp = await runOidb(bridge, { cmd: 'OidbSvcTrpcTcp.0xfe1_2', oidbCmd: 0xFE1, subCmd: 2, - request: { schema: OidbUserInfoRequestSchema, value: body }, + request: { schema: OidbUserInfoRequestSchema, value: body, isUid: true }, response: { schema: OidbUserInfoResponseSchema }, }); diff --git a/packages/core/src/bridge/bridge-oidb.ts b/packages/core/src/bridge/bridge-oidb.ts index ac7d78c2..23e71579 100644 --- a/packages/core/src/bridge/bridge-oidb.ts +++ b/packages/core/src/bridge/bridge-oidb.ts @@ -20,10 +20,16 @@ export interface OidbCall { schema: ProtoSchema; value: any; /** - * Sets the OIDB envelope `reserved` field to 1 when true. A handful - * of commands (group/friend list, rkey download) operate on - * UID-keyed data and require this flag — the wire format is - * otherwise identical. + * Sets the OIDB envelope `reserved` field to 1 when true. + * + * The name is historical and misleading: empirically (see Lagrange + * FetchStrangerByUin vs FetchStrangerByUid, fetchGroupList, our own + * highway uploads) the `reserved = 1` flag indicates the UIN-form + * variant of an OIDB call — it tells newer QQ NT to translate the + * UIN in the body to an internal UID rather than running the + * UID-form validator that expects a uid/openid string in the body. + * + * Omit (default false) for genuinely UID-keyed calls. */ isUid?: boolean; }; From 941e60dea5a3c977310f7f55716798e84ab82d9f Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 18 May 2026 15:03:45 +0800 Subject: [PATCH 9/9] chore(release): v1.8.5 --- package.json | 2 +- packages/core/package.json | 2 +- packages/runtime/package.json | 2 +- packages/sdk/package.json | 2 +- packages/ui/package.json | 2 +- packages/websocket/package.json | 2 +- packages/webui/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b9bb169e..3029715d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "snowluma-monorepo", - "version": "1.8.4", + "version": "1.8.5", "description": "SnowLuma monorepo workspace (pnpm)", "private": true, "type": "module", diff --git a/packages/core/package.json b/packages/core/package.json index 92e2e788..c832ad06 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@snowluma/core", - "version": "1.8.4", + "version": "1.8.5", "description": "SnowLuma core - NTQQ packet sniffer with Node.js native addon", "private": true, "type": "module", diff --git a/packages/runtime/package.json b/packages/runtime/package.json index c09d8bcf..ac3a169a 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@snowluma/runtime", - "version": "1.8.4", + "version": "1.8.5", "private": true, "type": "module", "main": "index.mjs", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 9aef3210..7462553c 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -4,7 +4,7 @@ "name": "MotricSeven", "email": "motricseven@gmail.com" }, - "version": "1.8.4", + "version": "1.8.5", "description": "TypeScript SDK for SnowLuma OneBot HTTP and WebSocket transports", "keywords": [ "snowluma", diff --git a/packages/ui/package.json b/packages/ui/package.json index f70bab9c..62f6a6f7 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -4,7 +4,7 @@ "name": "MotricSeven", "email": "motricseven@gmail.com" }, - "version": "1.8.4", + "version": "1.8.5", "description": "Shared SnowLuma UI primitives — Tailwind 4 theme tokens + shadcn-style atomic components", "keywords": [ "snowluma", diff --git a/packages/websocket/package.json b/packages/websocket/package.json index e97ce0bd..ed3c0963 100644 --- a/packages/websocket/package.json +++ b/packages/websocket/package.json @@ -1,6 +1,6 @@ { "name": "@snowluma/websocket", - "version": "1.8.4", + "version": "1.8.5", "private": true, "type": "module", "main": "./src/index.ts", diff --git a/packages/webui/package.json b/packages/webui/package.json index 32de0fc1..17b798aa 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -1,7 +1,7 @@ { "name": "webui", "private": true, - "version": "1.8.4", + "version": "1.8.5", "type": "module", "scripts": { "dev": "vite",