diff --git a/package.json b/package.json index 4a9040c2..0ca75850 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "snowluma-monorepo", - "version": "1.14.12", + "version": "1.14.13", "description": "SnowLuma monorepo workspace (pnpm)", "private": true, "type": "module", diff --git a/packages/bridge/package.json b/packages/bridge/package.json index cbe20ced..ac764e44 100644 --- a/packages/bridge/package.json +++ b/packages/bridge/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/bridge", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "description": "SnowLuma bridge — QQ NT desktop client lifecycle: hook injection (via native addon), per-PID HookSession orchestration, pipe-watcher for process discovery, and the BridgeManagerSink interface that lets the hook layer call back into a UIN-keyed session router without depending on @snowluma/core. Consumed by the top-level app entry (which constructs the BridgeManager from @snowluma/core and injects it as the sink) and by the WebUI server (read-only HookProcessInfo views).", diff --git a/packages/common/package.json b/packages/common/package.json index c652566d..3ee9d179 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/common", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "description": "SnowLuma shared infrastructure — leaf-package utilities with zero business dependencies. Logger / hex codec / log file transport / log line summariser / packet sender wire-protocol types / runtime config loader. Consumed by @snowluma/protocol, @snowluma/core, and @snowluma/onebot. Per-file subpath exports keep import sites unambiguous and let the bundler tree-shake aggressively (importing `@snowluma/common/hex` doesn't pull in `node:fs` from the logger transport).", diff --git a/packages/common/src/log-file-transport.ts b/packages/common/src/log-file-transport.ts index 2e03404e..6e943060 100644 --- a/packages/common/src/log-file-transport.ts +++ b/packages/common/src/log-file-transport.ts @@ -506,7 +506,13 @@ class FileWriter { } if (!this.quota.reserve(this.file.path, bytes)) return false; - this.file.stream.write(data); + try { + this.file.stream.write(data); + } catch (error) { + this.disabled = true; + this.quota.writeFailed(this.file.path, error); + return false; + } this.file.bytes += bytes; return true; } diff --git a/packages/common/src/logger.ts b/packages/common/src/logger.ts index 73f0f301..4903f82c 100644 --- a/packages/common/src/logger.ts +++ b/packages/common/src/logger.ts @@ -264,7 +264,13 @@ function emit( // and ESC (0x1B) so multi-line records (stack traces) and ANSI color // sequences emitted by render() pass through intact. // eslint-disable-next-line no-control-regex - stream.write(line.replace(/[\x00-\x08\x0B-\x1A\x1C-\x1F\x7F]/g, '') + '\n'); + const consoleLine = line.replace(/[\x00-\x08\x0B-\x1A\x1C-\x1F\x7F]/g, '') + '\n'; + try { + stream.write(consoleLine); + } catch { + // A full Docker json-file log volume can make stdout/stderr throw. + // Logging must not take down message handling or the WebUI. + } } // File transport sees levels >= currentFileLevel (SNOWLUMA_LOG_FILE_LEVEL, diff --git a/packages/common/tests/logger.test.ts b/packages/common/tests/logger.test.ts index db08e896..a536bc24 100644 --- a/packages/common/tests/logger.test.ts +++ b/packages/common/tests/logger.test.ts @@ -60,6 +60,13 @@ describe('logger UIN slot padding', () => { expect(() => createLogger('Test').info('no uin')).not.toThrow(); }); + it('does not throw when the console stream cannot accept the line', () => { + vi.mocked(process.stderr.write).mockImplementation(() => { + throw Object.assign(new Error('ENOSPC: no space left on device'), { code: 'ENOSPC' }); + }); + expect(() => createLogger('Test').error('disk is full')).not.toThrow(); + }); + it('keeps structured subscriber lines plain while terminal output stays colored', () => { const captured: LogEntry[] = []; const unsubscribe = subscribeLogs((entry) => captured.push(entry)); diff --git a/packages/core/package.json b/packages/core/package.json index dfa50dc5..67b88694 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/core", - "version": "1.14.12", + "version": "1.14.13", "description": "SnowLuma core - NTQQ packet sniffer with Node.js native addon", "private": true, "type": "module", diff --git a/packages/core/src/bridge/apis/group-admin.ts b/packages/core/src/bridge/apis/group-admin.ts index 7b7b65ec..ba0ff25b 100644 --- a/packages/core/src/bridge/apis/group-admin.ts +++ b/packages/core/src/bridge/apis/group-admin.ts @@ -33,8 +33,13 @@ import { import { SetSearch } from '@snowluma/protocol/oidb-services/group-admin/set-search'; import { SetSpecialTitle } from '@snowluma/protocol/oidb-services/group-admin/set-special-title'; import { ModifyGroupExtInfo } from '@snowluma/protocol/oidb-services/group-admin/modify-group-ext-info'; +import { OidbError } from '@snowluma/protocol/oidb-service'; import type { BridgeContext } from '../bridge-context'; +/** QQ only accepts this write from the group owner (#411). */ +export const MEMBER_PERMISSIONS_OWNER_ONLY = + 'only the group owner can change group member permissions'; + export type GroupAdminSettings = { add_type: number; group_question: string; @@ -138,12 +143,23 @@ export class GroupAdminApi { } private async fetchGroupPrivilegeFlag(groupId: number, setting: string, phase: string): Promise { + return (await this.fetchGroupPrivilegeState(groupId, setting, phase)).privilegeFlag; + } + + private async fetchGroupPrivilegeState( + groupId: number, + setting: string, + phase: string, + ): Promise<{ privilegeFlag: number; ownerUid?: string }> { const detail = await FetchGroupDetail.invoke(this.ctx, { groupUin: groupId }); const results = detail.groupInfo?.results; if (!results) { throw new Error(`unable to read ${setting} ${phase} for group ${groupId}`); } - return results.privilegeFlag ?? 0; + return { + privilegeFlag: results.privilegeFlag ?? 0, + ownerUid: results.ownerUid, + }; } async setMemberPermissions(groupId: number, permissions: GroupMemberPermissions): Promise { @@ -156,21 +172,34 @@ export class GroupAdminApi { throw new Error('at least one member permission must be specified'); } - let expectedPrivilegeFlag = await this.fetchGroupPrivilegeFlag( + const before = await this.fetchGroupPrivilegeState( groupId, 'group member permissions', 'before update', ); + const selfUid = this.ctx.identity.selfUid; + if (selfUid && before.ownerUid && selfUid !== before.ownerUid) { + throw new Error(MEMBER_PERMISSIONS_OWNER_ONLY); + } + + let expectedPrivilegeFlag = before.privilegeFlag; let combinedMask = 0n; for (const [permission, allow] of updates) { if (allow === undefined) continue; - await SetMemberPermission.invoke(this.ctx, { - groupId, - currentPrivilegeFlag: expectedPrivilegeFlag, - permission, - allow, - }); + try { + await SetMemberPermission.invoke(this.ctx, { + groupId, + currentPrivilegeFlag: expectedPrivilegeFlag, + permission, + allow, + }); + } catch (error) { + if (error instanceof OidbError && error.code === 1287) { + throw new Error(MEMBER_PERMISSIONS_OWNER_ONLY); + } + throw error; + } expectedPrivilegeFlag = mergeGroupMemberPermission(expectedPrivilegeFlag, permission, allow); combinedMask |= BigInt(GROUP_MEMBER_PERMISSION_MASKS[permission]); } diff --git a/packages/core/src/bridge/apis/interaction.ts b/packages/core/src/bridge/apis/interaction.ts index 4ace0f61..27c63fe4 100644 --- a/packages/core/src/bridge/apis/interaction.ts +++ b/packages/core/src/bridge/apis/interaction.ts @@ -33,11 +33,7 @@ export class InteractionApi { return SetEssence.invoke(this.ctx, { groupId, sequence, random, enable }); } - /** - * Legacy stub: see `GetEmojiLikes` namespace comment for why this - * SSO path can never surface the user list. Real data lives in - * ReactionStore on the OneBot side. - */ + /** Fetch the reactor list for one emoji on a group message. */ async getEmojiLikes( groupId: number, sequence: number, @@ -54,10 +50,7 @@ export class InteractionApi { } /** - * Fetch the per-emoji reaction summary on a group message via - * 0x9084_1 — emoji_id + reactor count + last-reaction timestamp. - * Cross-checked against the local ReactionStore cache for callers - * that need to detect cache gaps. + * Recent-used emoji catalog (0x9084_1). Not a per-message reaction list. */ fetchReactionSummary( groupId: number, diff --git a/packages/core/tests/actions/group-admin.test.ts b/packages/core/tests/actions/group-admin.test.ts index 5401ddcf..2f20949f 100644 --- a/packages/core/tests/actions/group-admin.test.ts +++ b/packages/core/tests/actions/group-admin.test.ts @@ -14,6 +14,7 @@ import type { OidbGroupDetailRequest, OidbGroupRequestAction, OidbKickMember, + OidbKickMemberResponse, OidbLeaveGroup, OidbMuteAll, OidbMuteMember, @@ -26,7 +27,7 @@ import type { // Post-namespace migration: GroupAdminApi forwards through namespaces // under @snowluma/protocol/oidb-services/group-admin. Tests assert // against bridge.sendRawPacket directly — no module-level mocks. -import { GroupAdminApi } from '../../src/bridge/apis/group-admin'; +import { GroupAdminApi, MEMBER_PERMISSIONS_OWNER_ONLY } from '../../src/bridge/apis/group-admin'; import { mockBridge } from './_helpers'; function packResponse(body: Uint8Array) { @@ -36,17 +37,27 @@ function packResponse(body: Uint8Array) { }; } -function packPrivilegeFlag(privilegeFlag?: number) { +function packPrivilegeFlag(privilegeFlag?: number, ownerUid?: string) { return packResponse(protobuf_encode>({ body: { groupInfo: { uin: 12345n, - results: privilegeFlag === undefined ? {} : { privilegeFlag }, + results: { + ...(privilegeFlag === undefined ? {} : { privilegeFlag }), + ...(ownerUid === undefined ? {} : { ownerUid }), + }, }, }, })); } +function packOidbFail(code: number) { + return { + success: false, gotResponse: true, errorCode: code, errorMessage: '', + responseData: Buffer.alloc(0), + }; +} + function packGroupFlagExt4(groupFlagExt4?: number) { return packResponse(protobuf_encode>({ body: { @@ -125,18 +136,30 @@ describe('apis/group-admin', () => { }); }); - it('kickMember rejects a server business error instead of reporting success (#298)', async () => { + it('kickMember treats a zero per-member result as success (#413)', async () => { const bridge = mockBridge(); bridge.sendRawPacket.mockResolvedValueOnce(packResponse( - Buffer.from( - '222008b960121be7bea4e4b8bbe697a0e6b395e8a2abe7a7bbe587bae7bea4e8818a', - 'hex', - ), + protobuf_encode>({ + body: { groupUin: 12345, results: [{ result: 0, uid: 'u_abcdefghijklmnopqrstuv' }] }, + }), )); await expect( new GroupAdminApi(bridge as any).kickMember(12345, 67890, false), - ).rejects.toThrow('群主无法被移出群聊'); + ).resolves.toBeUndefined(); + }); + + it('kickMember rejects a server business error instead of reporting success (#298)', async () => { + const bridge = mockBridge(); + bridge.sendRawPacket.mockResolvedValueOnce(packResponse( + protobuf_encode>({ + body: { groupUin: 12345, results: [{ result: 1, uid: 'u_abcdefghijklmnopqrstuv' }] }, + }), + )); + + await expect( + new GroupAdminApi(bridge as any).kickMember(12345, 67890, false), + ).rejects.toThrow('kick member failed: result=1'); }); it('kickMembers resolves each UID in parallel', async () => { @@ -155,15 +178,14 @@ describe('apis/group-admin', () => { it('kickMembers rejects the same command-level business error', async () => { const bridge = mockBridge(); bridge.sendRawPacket.mockResolvedValueOnce(packResponse( - Buffer.from( - '222008b960121be7bea4e4b8bbe697a0e6b395e8a2abe7a7bbe587bae7bea4e8818a', - 'hex', - ), + protobuf_encode>({ + body: { groupUin: 12345, results: [{ result: 1, uid: 'u_abcdefghijklmnopqrstuv' }] }, + }), )); await expect( new GroupAdminApi(bridge as any).kickMembers(12345, [67890], false), - ).rejects.toThrow('群主无法被移出群聊'); + ).rejects.toThrow('kick members failed: result=1'); }); it('leave sends 0x1097_1, emits a self group_member_leave, and forgets the group (#133)', async () => { @@ -503,6 +525,53 @@ describe('apis/group-admin', () => { expect(bridge.sendRawPacket).toHaveBeenCalledOnce(); }); + it('setMemberPermissions rejects a non-owner before writing (#411)', async () => { + const bridge = mockBridge(); + bridge.sendRawPacket.mockResolvedValueOnce(packPrivilegeFlag(0x80000001, 'u_owner')); + + await expect( + new GroupAdminApi(bridge as any).setMemberPermissions(12345, { + allowMemberUploadAlbum: true, + }), + ).rejects.toThrow(MEMBER_PERMISSIONS_OWNER_ONLY); + expect(bridge.sendRawPacket).toHaveBeenCalledOnce(); + expect(bridge.sendRawPacket.mock.calls[0]![0]).toBe('OidbSvcTrpcTcp.0x88d_0'); + }); + + it('setMemberPermissions maps a not-owner server refusal to a readable error (#411)', async () => { + const bridge = mockBridge(); + bridge.sendRawPacket + .mockResolvedValueOnce(packPrivilegeFlag(0x80000001)) + .mockResolvedValueOnce(packOidbFail(1287)); + + await expect( + new GroupAdminApi(bridge as any).setMemberPermissions(12345, { + allowMemberUploadAlbum: true, + }), + ).rejects.toThrow(MEMBER_PERMISSIONS_OWNER_ONLY); + expect(bridge.sendRawPacket.mock.calls.map((call) => call[0])).toEqual([ + 'OidbSvcTrpcTcp.0x88d_0', + 'OidbSvcTrpcTcp.0x89a_0', + ]); + }); + + it('setMemberPermissions writes when the bot is the group owner', async () => { + const bridge = mockBridge(); + bridge.sendRawPacket + .mockResolvedValueOnce(packPrivilegeFlag(0x80000001, 'self-uid')) + .mockResolvedValueOnce(packResponse(Buffer.alloc(0))) + .mockResolvedValueOnce(packPrivilegeFlag(0, 'self-uid')); + + await new GroupAdminApi(bridge as any).setMemberPermissions(12345, { + allowMemberUploadAlbum: true, + }); + expect(bridge.sendRawPacket.mock.calls.map((call) => call[0])).toEqual([ + 'OidbSvcTrpcTcp.0x88d_0', + 'OidbSvcTrpcTcp.0x89a_0', + 'OidbSvcTrpcTcp.0x88d_0', + ]); + }); + it('setMemberPermissions rejects an ack when final read-back does not match', async () => { const bridge = mockBridge(); bridge.sendRawPacket diff --git a/packages/core/tests/actions/interaction.test.ts b/packages/core/tests/actions/interaction.test.ts index a2d6dc65..156196c8 100644 --- a/packages/core/tests/actions/interaction.test.ts +++ b/packages/core/tests/actions/interaction.test.ts @@ -51,20 +51,21 @@ describe('apis/interaction', () => { expect(cmds).toEqual(['OidbSvcTrpcTcp.0xeac_1', 'OidbSvcTrpcTcp.0xeac_2']); }); - it('getEmojiLikes decodes user list, base64-encodes cookie, and reports isLast', async () => { + it('getEmojiLikes decodes user list, returns the cookie, and reports isLast', async () => { const bridge = mockBridge(); bridge.sendRawPacket.mockResolvedValueOnce({ success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData: Buffer.from(protobuf_encode>({ body: { - inner: { userInfo: [{ uin: 10001n }, { uin: 20002n }] }, - cookie: new Uint8Array([0xCA, 0xFE]), - } as any, + users: [{ uin: 10001n }, { uin: 20002n }], + cookie: 'next-page', + isLast: false, + }, })), }); const out = await new InteractionApi(bridge as any).getEmojiLikes(12345, 99, '128516'); expect(out.users).toEqual([{ uin: 10001 }, { uin: 20002 }]); - expect(out.cookie).toBe(Buffer.from([0xCA, 0xFE]).toString('base64')); + expect(out.cookie).toBe('next-page'); expect(out.isLast).toBe(false); }); diff --git a/packages/core/tests/bridge-member-identity.test.ts b/packages/core/tests/bridge-member-identity.test.ts index f86b6d68..0f0891e7 100644 --- a/packages/core/tests/bridge-member-identity.test.ts +++ b/packages/core/tests/bridge-member-identity.test.ts @@ -47,6 +47,9 @@ function emptyProfile(uin: number, uid: string) { sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, + qidianCrewFlag: 0, + qidianCrewFlag2: 0, }; } diff --git a/packages/core/tests/identity-service.test.ts b/packages/core/tests/identity-service.test.ts index c5d49090..0faf49cc 100644 --- a/packages/core/tests/identity-service.test.ts +++ b/packages/core/tests/identity-service.test.ts @@ -589,6 +589,23 @@ describe('IdentityService', () => { lastError: expect.stringMatching(/locked/i), lastFailureAt: suspendedFailureAt, }); + const skipLogsBeforeBurst = seen.filter((entry) => + /persistence write skipped/.test(entry.message), + ).length; + expect(skipLogsBeforeBurst).toBe(1); + for (let i = 0; i < 50; i += 1) { + identity.rememberRequestIdentity({ + uid: `u_skip_burst_${i}`, + uin: 500_000 + i, + }); + } + expect(seen.filter((entry) => /persistence write skipped/.test(entry.message))) + .toHaveLength(1); + await vi.advanceTimersByTimeAsync(60_000); + identity.rememberRequestIdentity({ uid: 'u_skip_after_minute', uin: 600_000 }); + const skipLogs = seen.filter((entry) => /persistence write skipped/.test(entry.message)); + expect(skipLogs).toHaveLength(2); + expect(skipLogs[1]?.message).toMatch(/suppressed=50/); releaseLock(); identity.close(); @@ -757,6 +774,9 @@ describe('IdentityService', () => { sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, + qidianCrewFlag: 0, + qidianCrewFlag2: 0, }; const request = { groupId: GROUP_ID, @@ -911,7 +931,10 @@ describe('IdentityService', () => { describe('IdentityService.resolveUid', () => { function makeProfile(uin: number, uid: string): UserProfileInfo { - return { uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 }; + return { + uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, + }; } it('returns the cached uid without invoking the fetcher', async () => { @@ -976,7 +999,10 @@ describe('IdentityService.resolveUid', () => { describe('IdentityService inbound UID→UIN', () => { function makeProfile(uin: number, uid: string): UserProfileInfo { - return { uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 }; + return { + uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, + }; } it('findUinByUid treats a numeric uid as that uin without consulting maps', () => { diff --git a/packages/mcp/package.json b/packages/mcp/package.json index ac539164..14b69d76 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/mcp", - "version": "1.14.12", + "version": "1.14.13", "description": "MCP server exposing the SnowLuma OneBot action catalog (docs + JSON Schemas) and optional execution to LLM clients.", "repository": { "type": "git", diff --git a/packages/mcp/src/generated/catalog.json b/packages/mcp/src/generated/catalog.json index 521b44ab..46623c0d 100644 --- a/packages/mcp/src/generated/catalog.json +++ b/packages/mcp/src/generated/catalog.json @@ -7421,7 +7421,7 @@ "name": "get_stranger_info", "aliases": [], "summary": "获取陌生人信息", - "returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级。", + "returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级与企点标志。", "returnsSchema": { "type": "object", "properties": { @@ -7481,6 +7481,18 @@ "customStatusDescInfo": { "type": "string", "description": "自定义状态说明" + }, + "qidian_master_flag": { + "type": "integer", + "description": "企点主号标志,0 或 1;普通账号为 0" + }, + "qidian_crew_flag": { + "type": "integer", + "description": "企点员工标志,0 或 1;普通账号为 0" + }, + "qidian_crew_flag_2": { + "type": "integer", + "description": "企点保留标志,0 或 1;普通账号为 0" } }, "required": [ @@ -10548,7 +10560,7 @@ { "name": "set_group_member_permissions", "aliases": [], - "summary": "设置群成员权限", + "summary": "设置群成员权限(仅群主可改)", "readOnly": false, "params": [ { diff --git a/packages/mcp/src/generated/catalog.ts b/packages/mcp/src/generated/catalog.ts index 1aaf8257..e83c5946 100644 --- a/packages/mcp/src/generated/catalog.ts +++ b/packages/mcp/src/generated/catalog.ts @@ -7424,7 +7424,7 @@ export const ACTIONS: CatalogAction[] = [ "name": "get_stranger_info", "aliases": [], "summary": "获取陌生人信息", - "returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级。", + "returns": "用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级与企点标志。", "returnsSchema": { "type": "object", "properties": { @@ -7484,6 +7484,18 @@ export const ACTIONS: CatalogAction[] = [ "customStatusDescInfo": { "type": "string", "description": "自定义状态说明" + }, + "qidian_master_flag": { + "type": "integer", + "description": "企点主号标志,0 或 1;普通账号为 0" + }, + "qidian_crew_flag": { + "type": "integer", + "description": "企点员工标志,0 或 1;普通账号为 0" + }, + "qidian_crew_flag_2": { + "type": "integer", + "description": "企点保留标志,0 或 1;普通账号为 0" } }, "required": [ @@ -10551,7 +10563,7 @@ export const ACTIONS: CatalogAction[] = [ { "name": "set_group_member_permissions", "aliases": [], - "summary": "设置群成员权限", + "summary": "设置群成员权限(仅群主可改)", "readOnly": false, "params": [ { diff --git a/packages/onebot/package.json b/packages/onebot/package.json index 16e69893..54dc021e 100644 --- a/packages/onebot/package.json +++ b/packages/onebot/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/onebot", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "description": "SnowLuma OneBot v11 adapter — the protocol translation layer that maps the public OneBot vocabulary (HTTP / WebSocket actions, message segments, post events) onto @snowluma/core's typed Api hub (`bridge.apis..method()`). Owns network adapters (HTTP server / HTTP client / WS server / WS client), the registered action handlers, the receive-side event→OneBot converter, message-id hashing, message store (SQLite-backed event history), media store, and the OneBot instance + manager that ties one OneBotConfig to one Bridge. Per-file subpath exports mirror the legacy `core/src/onebot/*` layout 1:1 so the previous `import { … } from '../onebot/'` collapses to `import { … } from '@snowluma/onebot/'`.", diff --git a/packages/onebot/src/actions/friend.ts b/packages/onebot/src/actions/friend.ts index 92e4a7b7..69e303c2 100644 --- a/packages/onebot/src/actions/friend.ts +++ b/packages/onebot/src/actions/friend.ts @@ -32,7 +32,7 @@ export const actions = [ name: 'get_stranger_info', summary: '获取陌生人信息', readOnly: true, - returns: '用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级。', + returns: '用户资料:QQ 号、昵称、好友备注、性别、年龄与个性签名,命中资料时另含等级与企点标志。', returnsSchema: { type: 'object', properties: { @@ -50,6 +50,9 @@ export const actions = [ batteryStatus: { type: 'integer', description: '电量状态' }, customStatus: { type: 'object', description: '自定义状态', nullable: true }, customStatusDescInfo: { type: 'string', description: '自定义状态说明' }, + qidian_master_flag: { type: 'integer', description: '企点主号标志,0 或 1;普通账号为 0' }, + qidian_crew_flag: { type: 'integer', description: '企点员工标志,0 或 1;普通账号为 0' }, + qidian_crew_flag_2: { type: 'integer', description: '企点保留标志,0 或 1;普通账号为 0' }, }, required: ['user_id', 'nickname', 'remark', 'sex', 'age', 'long_nick'], }, diff --git a/packages/onebot/src/actions/group-admin.ts b/packages/onebot/src/actions/group-admin.ts index 98db5d8c..a875f59c 100644 --- a/packages/onebot/src/actions/group-admin.ts +++ b/packages/onebot/src/actions/group-admin.ts @@ -100,7 +100,7 @@ export const actions = [ groupAction({ name: 'set_group_member_permissions', - summary: '设置群成员权限', + summary: '设置群成员权限(仅群主可改)', params: { allow_member_upload_album: f.bool().optional(), allow_member_temporary_session: f.bool().optional(), diff --git a/packages/onebot/src/instance-context.ts b/packages/onebot/src/instance-context.ts index 903a5f4b..f735d95b 100644 --- a/packages/onebot/src/instance-context.ts +++ b/packages/onebot/src/instance-context.ts @@ -128,31 +128,51 @@ export function buildApiContext(ref: OneBotInstanceContext): ApiActionContext { if (!meta.isGroup) throw new Error('emoji reactions are not supported on private messages'); if (!hasAuthoritativeSequence(meta)) throw new Error('message has no authoritative QQ sequence'); await bridge.apis.interaction.setReaction(meta.targetId, meta.sequence, emojiId, set); + const emojiType = emojiId.length > 3 ? 2 : 1; + if (set) { + reactionStore.recordAdd( + meta.targetId, meta.sequence, emojiId, emojiType, + ref.selfId, '', Math.floor(Date.now() / 1000), + ); + } else { + reactionStore.recordRemove(meta.targetId, meta.sequence, emojiId, ref.selfId); + } }, fetchEmojiLikeSummary: async (messageId) => { const meta = messageStore.findMeta(messageId); if (!meta) throw new Error('message not found'); if (!meta.isGroup) throw new Error('emoji reactions are not supported on private messages'); if (!hasAuthoritativeSequence(meta)) throw new Error('message has no authoritative QQ sequence'); - let summary: Array<{ emojiId: string; emojiType: number; count: number; lastReactionTime: number }>; - try { - summary = await bridge.apis.interaction.fetchReactionSummary(meta.targetId, meta.sequence); - } catch { - summary = reactionStore.summarizeMessage(meta.targetId, meta.sequence).map((entry) => ({ - emojiId: entry.emojiId, - emojiType: entry.emojiType, - count: entry.count, - lastReactionTime: entry.lastSetAt, - })); + const summary = reactionStore.summarizeMessage(meta.targetId, meta.sequence); + const out: Array<{ + emoji_id: string; + emoji_type: number; + count: number; + last_reaction_time: number; + users: Array<{ user_id: number }>; + }> = []; + for (const entry of summary) { + let users = reactionStore.listUsers(meta.targetId, meta.sequence, entry.emojiId, 1000, 0) + .map((user) => ({ user_id: user.operatorUin })); + try { + const remote = await bridge.apis.interaction.getEmojiLikes( + meta.targetId, meta.sequence, entry.emojiId, entry.emojiType, 1000, + ); + if (remote.users.length > 0) { + users = remote.users.map((user) => ({ user_id: user.uin })); + } + } catch { + /* keep cached users */ + } + out.push({ + emoji_id: entry.emojiId, + emoji_type: entry.emojiType, + count: Math.max(entry.count, users.length), + last_reaction_time: entry.lastSetAt, + users, + }); } - return summary.map((entry) => ({ - emoji_id: entry.emojiId, - emoji_type: entry.emojiType, - count: entry.count, - last_reaction_time: entry.lastReactionTime, - users: reactionStore.listUsers(meta.targetId, meta.sequence, entry.emojiId, 1000, 0) - .map((user) => ({ user_id: user.operatorUin })), - })); + return out; }, fetchEmojiLikeUsers: async (messageId, emojiId, count, offset = 0) => { const meta = messageStore.findMeta(messageId); @@ -160,15 +180,23 @@ export function buildApiContext(ref: OneBotInstanceContext): ApiActionContext { if (!meta.isGroup) throw new Error('emoji reactions are not supported on private messages'); if (!hasAuthoritativeSequence(meta)) throw new Error('message has no authoritative QQ sequence'); const raw = reactionStore.listUsers(meta.targetId, meta.sequence, emojiId, count, offset); - const users = raw.map(r => ({ uin: r.operatorUin, uid: r.operatorUid, setAt: r.setAt })); + let users = raw.map(r => ({ uin: r.operatorUin, uid: r.operatorUid, setAt: r.setAt })); const cachedCount = reactionStore.countUsers(meta.targetId, meta.sequence, emojiId); let serverCount = cachedCount; try { - const summary = await bridge.apis.interaction.fetchReactionSummary(meta.targetId, meta.sequence); - const match = summary.find(s => s.emojiId === emojiId); - if (match) serverCount = match.count; + const remote = await bridge.apis.interaction.getEmojiLikes( + meta.targetId, meta.sequence, emojiId, emojiId.length > 3 ? 2 : 1, count, + ); + if (remote.users.length > 0) { + serverCount = remote.users.length; + if (offset === 0) { + users = remote.users.slice(0, count).map((user) => ({ + uin: user.uin, uid: '', setAt: 0, + })); + } + } } catch { - /* keep serverCount = cachedCount */ + /* keep cached users / count */ } return { users, diff --git a/packages/onebot/src/manager.ts b/packages/onebot/src/manager.ts index 5e8b70cf..eedd216a 100644 --- a/packages/onebot/src/manager.ts +++ b/packages/onebot/src/manager.ts @@ -525,6 +525,7 @@ async function warmUpBridgeState( uin: f.uin, uid: f.uid, nickname: f.nickname || uin, remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, }); bridge.identity.nickname = f.nickname || uin; log.debug('self info: UIN=%s uid=%s nickname=%s', uin, f.uid, f.nickname ?? ''); diff --git a/packages/onebot/src/modules/contact-actions.ts b/packages/onebot/src/modules/contact-actions.ts index fa818057..373e1fd9 100644 --- a/packages/onebot/src/modules/contact-actions.ts +++ b/packages/onebot/src/modules/contact-actions.ts @@ -296,6 +296,9 @@ function formatStrangerInfo(p: UserProfileInfo): JsonObject { batteryStatus: p.batteryStatus ?? 0, customStatus: p.customStatus ?? null, customStatusDescInfo: p.customStatusDesc ?? '', + qidian_master_flag: p.qidianMasterFlag ?? 0, + qidian_crew_flag: p.qidianCrewFlag ?? 0, + qidian_crew_flag_2: p.qidianCrewFlag2 ?? 0, }; } diff --git a/packages/onebot/tests/actions-group-admin.test.ts b/packages/onebot/tests/actions-group-admin.test.ts index 618b387a..6a460639 100644 --- a/packages/onebot/tests/actions-group-admin.test.ts +++ b/packages/onebot/tests/actions-group-admin.test.ts @@ -837,7 +837,7 @@ describe('set_group_member_permissions describe', () => { const doc = setGroupMemberPermissions.describe(); expect(doc.name).toBe('set_group_member_permissions'); - expect(doc.summary).toBe('设置群成员权限'); + expect(doc.summary).toBe('设置群成员权限(仅群主可改)'); expect(doc.invariants).toEqual([ 'at least one of: allow_member_upload_album, allow_member_temporary_session, allow_member_create_group', ]); diff --git a/packages/onebot/tests/contact-actions.test.ts b/packages/onebot/tests/contact-actions.test.ts index cbfe4d9b..065aa408 100644 --- a/packages/onebot/tests/contact-actions.test.ts +++ b/packages/onebot/tests/contact-actions.test.ts @@ -104,7 +104,8 @@ function makeProfile( remark = '', ): UserProfileInfo { return { - uin, uid: `u_${uin}`, nickname, remark, qid: '', sex, age, sign, avatar: '', + uin, uid: `u_${uin}`, nickname, remark, qid: '', sex, age, sign, avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, }; } @@ -547,6 +548,24 @@ describe('onebot/contact-actions / getStrangerInfo', () => { }); }); + it('passes through the qidian (企点) flags from the profile', async () => { + const bridge = fakeBridge({ + fetchUserProfile: vi.fn(async () => ({ + ...makeProfile(55555, 'QidianWorker', 'male'), + qidianMasterFlag: 0, + qidianCrewFlag: 1, + qidianCrewFlag2: 0, + })), + }); + const out = await getStrangerInfo(bridge, 55555); + expect(out).toMatchObject({ + user_id: 55555, + qidian_master_flag: 0, + qidian_crew_flag: 1, + qidian_crew_flag_2: 0, + }); + }); + it('falls back to identity.findUserProfile when fetch fails but the profile is cached', async () => { const bridge = fakeBridge({ fetchUserProfile: vi.fn(async () => { throw new Error('net'); }), diff --git a/packages/onebot/tests/friend-actions.test.ts b/packages/onebot/tests/friend-actions.test.ts index b26885c0..910075d7 100644 --- a/packages/onebot/tests/friend-actions.test.ts +++ b/packages/onebot/tests/friend-actions.test.ts @@ -31,6 +31,9 @@ describe('get_stranger_info action', () => { properties: { remark: { type: 'string', description: '好友备注;非好友或未设置时为空字符串' }, long_nick: { type: 'string', description: '个性签名' }, + qidian_master_flag: { type: 'integer' }, + qidian_crew_flag: { type: 'integer' }, + qidian_crew_flag_2: { type: 'integer' }, }, }); expect(schema?.required).toContain('remark'); diff --git a/packages/onebot/tests/instance-context.test.ts b/packages/onebot/tests/instance-context.test.ts index 075e6d0c..ed0a20f7 100644 --- a/packages/onebot/tests/instance-context.test.ts +++ b/packages/onebot/tests/instance-context.test.ts @@ -200,6 +200,7 @@ function makeRef(overrides: { }, interaction: { setReaction: vi.fn(async () => undefined), + getEmojiLikes: vi.fn(async () => ({ users: [], cookie: '', isLast: true })), fetchReactionSummary: vi.fn(async () => []), setEssence: vi.fn(async () => undefined), ...overrides.apis?.interaction, @@ -232,6 +233,9 @@ function makeRef(overrides: { reactionStore: { listUsers: vi.fn(() => []), countUsers: vi.fn(() => 0), + summarizeMessage: vi.fn(() => []), + recordAdd: vi.fn(), + recordRemove: vi.fn(), ...overrides.reactionStore, }, tempSessions: new TempSessionStore(), @@ -387,8 +391,10 @@ describe('buildApiContext setMsgEmojiLike', () => { it('sets the reaction on the group message', async () => { const setReaction = vi.fn(async () => undefined); + const recordAdd = vi.fn(); const { api, metas, ref } = makeRef({ - apis: { interaction: { setReaction, fetchReactionSummary: vi.fn(async () => []) } }, + reactionStore: { recordAdd }, + apis: { interaction: { setReaction } }, }); metas.set(-5, groupMeta({ targetId: 710201, sequence: 4242 })); @@ -396,32 +402,37 @@ describe('buildApiContext setMsgEmojiLike', () => { expect(setReaction).toHaveBeenCalledWith(710201, 4242, '76', true); expect(ref.bridge.apis.interaction.setReaction).toHaveBeenCalledOnce(); + expect(recordAdd).toHaveBeenCalledWith(710201, 4242, '76', 1, SELF_ID, '', expect.any(Number)); }); it('clears the reaction when set is false', async () => { const setReaction = vi.fn(async () => undefined); + const recordRemove = vi.fn(); const { api, metas } = makeRef({ - apis: { interaction: { setReaction, fetchReactionSummary: vi.fn(async () => []) } }, + reactionStore: { recordRemove }, + apis: { interaction: { setReaction } }, }); metas.set(-6, groupMeta({ targetId: 710202, sequence: 88 })); await api.setMsgEmojiLike(-6, '144', false); expect(setReaction).toHaveBeenCalledWith(710202, 88, '144', false); + expect(recordRemove).toHaveBeenCalledWith(710202, 88, '144', SELF_ID); }); }); describe('buildApiContext fetchEmojiLikeSummary', () => { - it('returns every emoji on the message with cached users', async () => { + it('returns every cached emoji on the message with cached users', async () => { const listUsers = vi.fn(() => [ { operatorUin: 20002, operatorUid: 'u_20002', setAt: 1_700_000_001 }, ]); - const fetchReactionSummary = vi.fn(async () => [ - { emojiId: '76', emojiType: 1, count: 1, lastReactionTime: 1_700_000_001 }, + const summarizeMessage = vi.fn(() => [ + { emojiId: '76', emojiType: 1, count: 1, lastSetAt: 1_700_000_001 }, ]); + const getEmojiLikes = vi.fn(async () => ({ users: [], cookie: '', isLast: true })); const { api, metas } = makeRef({ - reactionStore: { listUsers, summarizeMessage: vi.fn(() => []) }, - apis: { interaction: { setReaction: vi.fn(), fetchReactionSummary } }, + reactionStore: { listUsers, summarizeMessage }, + apis: { interaction: { getEmojiLikes } }, }); metas.set(-20, groupMeta({ targetId: 710301, sequence: 55 })); @@ -434,7 +445,8 @@ describe('buildApiContext fetchEmojiLikeSummary', () => { users: [{ user_id: 20002 }], }, ]); - expect(fetchReactionSummary).toHaveBeenCalledWith(710301, 55); + expect(summarizeMessage).toHaveBeenCalledWith(710301, 55); + expect(getEmojiLikes).toHaveBeenCalledWith(710301, 55, '76', 1, 1000); expect(listUsers).toHaveBeenCalledWith(710301, 55, '76', 1000, 0); }); }); @@ -464,10 +476,8 @@ describe('buildApiContext fetchEmojiLikeUsers', () => { { operatorUin: 20002, operatorUid: 'u_20002', setAt: 1_700_000_001 }, ]); const countUsers = vi.fn(() => 1); - const fetchReactionSummary = vi.fn(async () => [{ emojiId: '76', count: 1 }]); const { api, metas } = makeRef({ reactionStore: { listUsers, countUsers }, - apis: { interaction: { setReaction: vi.fn(), fetchReactionSummary } }, }); metas.set(-7, groupMeta({ targetId: 710301, sequence: 55 })); @@ -494,7 +504,7 @@ describe('buildApiContext fetchEmojiLikeUsers', () => { expect(listUsers).toHaveBeenCalledWith(710302, 9, '144', 5, 3); }); - it('uses the matching server summary count and reports incomplete when cache is short', async () => { + it('uses the native reactor list when the first page has users', async () => { const { api, metas } = makeRef({ reactionStore: { listUsers: () => [{ operatorUin: 1, operatorUid: 'u_1', setAt: 10 }], @@ -502,36 +512,30 @@ describe('buildApiContext fetchEmojiLikeUsers', () => { }, apis: { interaction: { - setReaction: vi.fn(), - fetchReactionSummary: vi.fn(async () => [ - { emojiId: '99', count: 4 }, - { emojiId: '76', count: 8 }, - ]), + getEmojiLikes: vi.fn(async () => ({ + users: Array.from({ length: 8 }, (_, i) => ({ uin: 1000 + i })), + cookie: '', + isLast: true, + })), }, }, }); metas.set(-9, groupMeta({ targetId: 710303, sequence: 12 })); await expect(api.fetchEmojiLikeUsers(-9, '76', 10)).resolves.toEqual({ - users: [{ uin: 1, uid: 'u_1', setAt: 10 }], + users: Array.from({ length: 8 }, (_, i) => ({ uin: 1000 + i, uid: '', setAt: 0 })), cachedCount: 2, serverCount: 8, complete: false, }); }); - it('keeps the cached count when the summary has no matching emoji', async () => { + it('keeps the cached count when the native list is empty', async () => { const { api, metas } = makeRef({ reactionStore: { listUsers: () => [], countUsers: () => 3, }, - apis: { - interaction: { - setReaction: vi.fn(), - fetchReactionSummary: vi.fn(async () => [{ emojiId: '99', count: 9 }]), - }, - }, }); metas.set(-10, groupMeta({ targetId: 710304, sequence: 13 })); @@ -551,21 +555,31 @@ describe('buildApiContext fetchEmojiLikeUsers', () => { }, apis: { interaction: { - fetchReactionSummary: vi.fn(async () => [{ emojiId: '76', count: 5 }]), + getEmojiLikes: vi.fn(async () => ({ + users: [{ uin: 1 }, { uin: 2 }, { uin: 3 }, { uin: 4 }, { uin: 5 }], + cookie: '', + isLast: true, + })), }, }, }); metas.set(-12, groupMeta({ targetId: 710306, sequence: 15 })); await expect(api.fetchEmojiLikeUsers(-12, '76', 10)).resolves.toEqual({ - users: [], + users: [ + { uin: 1, uid: '', setAt: 0 }, + { uin: 2, uid: '', setAt: 0 }, + { uin: 3, uid: '', setAt: 0 }, + { uin: 4, uid: '', setAt: 0 }, + { uin: 5, uid: '', setAt: 0 }, + ], cachedCount: 6, serverCount: 5, complete: true, }); }); - it('keeps the cached count when the summary fetch fails', async () => { + it('keeps the cached count when the native list fetch fails', async () => { const { api, metas } = makeRef({ reactionStore: { listUsers: () => [], @@ -573,9 +587,8 @@ describe('buildApiContext fetchEmojiLikeUsers', () => { }, apis: { interaction: { - setReaction: vi.fn(), - fetchReactionSummary: vi.fn(async () => { - throw new Error('summary down'); + getEmojiLikes: vi.fn(async () => { + throw new Error('list down'); }), }, }, @@ -804,6 +817,9 @@ describe('buildApiContext contact reads', () => { batteryStatus: 0, customStatus: null, customStatusDescInfo: '', + qidian_master_flag: 0, + qidian_crew_flag: 0, + qidian_crew_flag_2: 0, }); }); diff --git a/packages/proto-defs/package.json b/packages/proto-defs/package.json index 719f4438..47159f02 100644 --- a/packages/proto-defs/package.json +++ b/packages/proto-defs/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/proto-defs", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "description": "SnowLuma QQ/Lagrange wire-protobuf type definitions. Pure TypeScript interfaces with proton's `pb` marker types — `@snowluma/proton`'s vite plugin compiles them into zero-runtime encoder/decoder functions at the call sites in `@snowluma/core` (and any downstream consumer). Exposed as per-file subpaths (`@snowluma/proto-defs/oidb`, `@snowluma/proto-defs/message`, …) so the import-site shape mirrors the legacy `bridge/proto/proton/*` layout and avoids name collisions across files (notably `highway.ts` and `oidb-actions/media.ts` share NTV2-prefixed names).", diff --git a/packages/proto-defs/src/oidb-actions/base.ts b/packages/proto-defs/src/oidb-actions/base.ts index 33940b1c..a44e26af 100644 --- a/packages/proto-defs/src/oidb-actions/base.ts +++ b/packages/proto-defs/src/oidb-actions/base.ts @@ -104,13 +104,16 @@ export interface OidbKickMember { rejectAddRequest?: pb<4, bool>; reason?: pb<5, string>; } -// 0x8A0_1 response body. Cross-checked against Lagrange.Core's -// OidbSvcTrpcTcp0x8A0_1Response and the current QQ kick result contract: -// transport/envelope success does not imply the member was removed; a -// command-level refusal is returned in errorMsg. +// 0x8A0_1 response body. Envelope errorCode=0 is not enough: each target +// is listed in `results`. result=0 (or omitted) means that member was +// removed; any other value is a refusal for that member. +export interface OidbKickMemberResult { + result?: pb<1, uint_32>; + uid?: pb<2, string>; +} export interface OidbKickMemberResponse { groupUin?: pb<1, uint_32>; - errorMsg?: pb<2, string>; + results?: pb_repeated<2, OidbKickMemberResult>; } export interface OidbLeaveGroup { groupUin?: pb<1, uint_32>; @@ -905,46 +908,33 @@ export interface FaceroamOpResp { field3?: pb<3, uint_32>; item?: pb<4, FaceroamOpRespItem>; } -// 0x9083_1: fetch emoji-like user list. Field numbers must mirror the -// sibling 0x9082 reaction Req (OidbGroupReaction): field 4 = emoji_id -// (string), field 5 = emoji_type (uint). The pre-fix definition had -// these two swapped, which silently dropped both fields on the server -// side (wire type mismatch → protobuf decoder discards) and made every -// call return an empty list with no error. Cross-checked against -// Lagrange.Core V2 `Internal/Packets/Service/SetGroupReaction.cs`. +// 0x9083_1: fetch emoji-like user list for one emoji on a group message. +// Request/response tags follow Windows QQ EncodeGetMsgEmojiLikesListReq / +// DecodeGetMsgEmojiLikesListRsp. This is not the 0x9082 set-reaction body. export interface Oidb0x9083Req { groupId?: pb<2, uint_64>; - // 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>; + emojiType?: pb<4, uint_32>; + emojiId?: pb<5, string>; + cookie?: pb<6, string>; 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 { - // The server returns one entry per liker — must be repeated. A single - // field collapses N wire entries into "last writer wins", so groups - // with multiple likers used to come back as a single user (or empty - // if the wire layout shifted). - userInfo?: pb_repeated<1, Oidb0x9083RespUserInfo>; - field4?: pb<4, uint_32>; +export interface Oidb0x9083RespUser { + uin?: pb<1, uint_64>; + nick?: pb<2, string>; + headUrl?: pb<3, string>; } export interface Oidb0x9083Resp { - inner?: pb<4, Oidb0x9083RespInner>; - cookie?: pb<5, bytes>; + users?: pb_repeated<1, Oidb0x9083RespUser>; + cookie?: pb<2, string>; + isLast?: pb<3, bool>; + isFirst?: pb<4, bool>; } -// 0x9084_1: fetch reaction summary on a message. Returns one entry per -// emoji used + an "available reactions" catalog tail. Schema decoded -// from production wire dump: +// 0x9084_1: recent-used emoji catalog (GetRecentUseEmojiListForC2CAndGroup). +// Not the per-message reaction list (that is 0x9083_1). Schema from a +// production dump of the catalog body: // { 08 0A ← top-level field 1 (uint, meaning unclear: maybe // "total reactions on msg" or a flag — empirically // constant across messages) diff --git a/packages/protocol/package.json b/packages/protocol/package.json index c830ac54..8db3e07d 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/protocol", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "description": "SnowLuma protocol — the protocol-layer between QQ wire bytes and typed events. Owns: identity service (uid↔uin cache with SQLite persistence), event bus, packet pipeline (incoming SSO packet → QQEventVariant), msg-push decoders, element-builder (MessageElement → wire elems[]), highway upload protocol (file/image/video/ptt), OIDB envelope helper, and the event/notice/request type vocabulary. Consumers (@snowluma/core, @snowluma/onebot) talk to this package through `BridgeContext` for runtime calls and the standalone classes (IdentityService, BridgeEventBus, IncomingPacketPipeline) for composition. Per-file subpath exports mirror the legacy `core/src/bridge/*` layout 1:1 so the previous `import { …} from '../bridge/'` collapses to `import { … } from '@snowluma/protocol/'`.", diff --git a/packages/protocol/src/identity-service.ts b/packages/protocol/src/identity-service.ts index bd29a102..a34302dd 100644 --- a/packages/protocol/src/identity-service.ts +++ b/packages/protocol/src/identity-service.ts @@ -14,6 +14,8 @@ const moduleLogger = createLogger('Identity'); const PERSISTENCE_QUEUE_CAPACITY = 256; const PERSISTENCE_RETRY_DELAYS_MS = [100, 500, 2_000, 10_000, 30_000] as const; +/** After persistence is suspended, do not warn on every skipped write. */ +const SKIPPED_WRITE_LOG_INTERVAL_MS = 60_000; export type IdentityPersistenceState = 'memory-only' | 'healthy' | 'degraded' | 'closed'; @@ -159,6 +161,8 @@ export class IdentityService { private lastFailureAt_: number | null = null; private abandonedWrites_ = 0; private skippedWrites_ = 0; + private skippedWritesSinceLog_ = 0; + private lastSkippedWriteLogAt_ = 0; private persistenceSuspended_ = false; private closed_ = false; @@ -1242,6 +1246,8 @@ export class IdentityService { const attempts = this.retryAttempt_; this.retryAttempt_ = 0; this.nextRetryAt_ = null; + this.skippedWritesSinceLog_ = 0; + this.lastSkippedWriteLogAt_ = 0; this.log.info( 'identity persistence recovered: uin=%s flushed=%d pending=0 retries=%d', this.uin_, pendingAtStart, attempts, @@ -1268,9 +1274,27 @@ export class IdentityService { private recordSkippedWrite(label: string): void { this.skippedWrites_ += 1; this.abandonedWrites_ += 1; + const now = Date.now(); + if ( + this.lastSkippedWriteLogAt_ !== 0 + && now - this.lastSkippedWriteLogAt_ < SKIPPED_WRITE_LOG_INTERVAL_MS + ) { + this.skippedWritesSinceLog_ += 1; + return; + } + const suppressed = this.skippedWritesSinceLog_; + this.skippedWritesSinceLog_ = 0; + this.lastSkippedWriteLogAt_ = now; + if (suppressed > 0) { + this.log.warn( + 'identity persistence write skipped: uin=%s label=%s skipped=%d abandoned=%d suppressed=%d', + this.uin_, label, this.skippedWrites_, this.abandonedWrites_, suppressed, + ); + return; + } this.log.warn( - 'identity persistence write skipped: uin=%s label=%s pending=0 retry=%d skipped=%d abandoned=%d', - this.uin_, label, this.retryAttempt_, this.skippedWrites_, this.abandonedWrites_, + 'identity persistence write skipped: uin=%s label=%s skipped=%d abandoned=%d', + this.uin_, label, this.skippedWrites_, this.abandonedWrites_, ); } } diff --git a/packages/protocol/src/msg-push/helpers.ts b/packages/protocol/src/msg-push/helpers.ts index 623118b6..e15d1e1f 100644 --- a/packages/protocol/src/msg-push/helpers.ts +++ b/packages/protocol/src/msg-push/helpers.ts @@ -23,6 +23,19 @@ export function makeImageUrl(origUrl: string): string { return 'http://gchat.qpic.cn' + origUrl; } +/** Classic group-pic URL used when the wire carries an MD5 and no download path. */ +export function imageUrlFromMd5(md5Hex: string): string { + if (!/^[0-9a-fA-F]{32}$/.test(md5Hex)) return ''; + return `http://gchat.qpic.cn/gchatpic_new/0/0-0-${md5Hex.toUpperCase()}/0`; +} + +/** NT multimedia download URL reconstructed from a file id when the path is omitted. */ +export function ntImageUrlFromFileId(fileId: string, isGroup: boolean): string { + if (!fileId) return ''; + const appid = isGroup ? 1407 : 1406; + return `https://multimedia.nt.qq.com.cn/download?appid=${appid}&fileid=${encodeURIComponent(fileId)}`; +} + export function decompressData( data: Uint8Array, maxOutputBytes = MAX_RICH_CARD_OUTPUT_BYTES, diff --git a/packages/protocol/src/msg-push/rich-body-decoder.ts b/packages/protocol/src/msg-push/rich-body-decoder.ts index 002340df..37a67c8f 100644 --- a/packages/protocol/src/msg-push/rich-body-decoder.ts +++ b/packages/protocol/src/msg-push/rich-body-decoder.ts @@ -19,9 +19,11 @@ import type { MarkdownData } from '@snowluma/proto-defs/action'; import type { FileExtra, MessageBody, PushMsgBody as PushMsgBodyFull, RichText } from '@snowluma/proto-defs/message'; import { decompressData, + imageUrlFromMd5, makeImageUrl, MAX_RICH_CARD_MESSAGE_OUTPUT_BYTES, MAX_RICH_CARD_OUTPUT_BYTES, + ntImageUrlFromFileId, } from './helpers'; type ElemDecoded = Elem; @@ -476,7 +478,7 @@ export function decodeRichBody(body: PushMsgBody | undefined, isGroup: boolean): if (body?.richText) { const rt = body.richText; logUnknownWireFields(rt, 'body.richText'); - if (rt.elems) elements.push(...convertElements(rt.elems as ElemDecoded[])); + if (rt.elems) elements.push(...convertElements(rt.elems as ElemDecoded[], isGroup)); extractRichtextExtras(rt, elements, isGroup); } if (body?.msgContent && body.msgContent.length > 0) { @@ -485,7 +487,7 @@ export function decodeRichBody(body: PushMsgBody | undefined, isGroup: boolean): return elements; } -function convertElements(elems: ElemDecoded[]): MessageElement[] { +function convertElements(elems: ElemDecoded[], isGroup: boolean): MessageElement[] { const result: MessageElement[] = []; // [#146/#337] Rich cards and bot markdown arrive beside a plain compatibility // `text` element for older clients. That sibling has no independent wire @@ -562,7 +564,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { ); if (nested) decoded.push(nested); } - if (decoded.length) reply.replyElements = convertElements(decoded); + if (decoded.length) reply.replyElements = convertElements(decoded, isGroup); } // A C2C quoted FILE lives in RichText.notOnlineFile (message level), not // in elems[] — recover it from sourceMsg (field 9) when elems carried no @@ -666,11 +668,12 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { if (elem.notOnlineImage) { const img = elem.notOnlineImage; if (img.picMd5?.length === 16) { + const md5Hex = toHexUpper(img.picMd5); const urlPath = img.origUrl || img.bigUrl || ''; result.push({ type: 'image', - imageUrl: makeImageUrl(urlPath), - fileId: img.filePath ?? '', + imageUrl: makeImageUrl(urlPath) || (!urlPath ? imageUrlFromMd5(md5Hex) : ''), + fileId: img.filePath || md5Hex, fileSize: img.fileLen ?? 0, width: img.picWidth ?? 0, height: img.picHeight ?? 0, @@ -680,7 +683,7 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { // expect these literal Chinese strings when the wire // doesn't carry a per-image override. summary: img.pbRes?.summary || (img.pbRes?.subType === 1 ? '[动画表情]' : '[图片]'), - md5Hex: toHexUpper(img.picMd5), + md5Hex, }); } } @@ -689,16 +692,18 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { if (elem.customFace) { const img = elem.customFace; if (img.md5?.length === 16) { + const md5Hex = toHexUpper(img.md5); + const origUrl = img.origUrl ?? ''; result.push({ type: 'image', - imageUrl: makeImageUrl(img.origUrl ?? ''), - fileId: img.filePath ?? '', + imageUrl: makeImageUrl(origUrl) || (!origUrl ? imageUrlFromMd5(md5Hex) : ''), + fileId: img.filePath || md5Hex, fileSize: img.size ?? 0, width: img.width ?? 0, height: img.height ?? 0, subType: img.pbRes?.subType ?? 0, summary: img.pbRes?.summary || (img.pbRes?.subType === 1 ? '[动画表情]' : '[图片]'), - md5Hex: toHexUpper(img.md5), + md5Hex, }); } } @@ -849,8 +854,10 @@ function convertElements(elems: ElemDecoded[]): MessageElement[] { } } } + const fileId = fi.fileName || idx.fileUuid || ''; + if (!url && idx.fileUuid) url = ntImageUrlFromFileId(idx.fileUuid, isGroup); const me: MessageElement = { - type: 'image', fileId: fi.fileName ?? '', + type: 'image', fileId, fileSize: fi.fileSize ?? 0, width: fi.width ?? 0, height: fi.height ?? 0, imageUrl: url, }; diff --git a/packages/protocol/src/oidb-services/contacts/fetch-user-profile-by-uid.ts b/packages/protocol/src/oidb-services/contacts/fetch-user-profile-by-uid.ts index 764b3151..d2b43eeb 100644 --- a/packages/protocol/src/oidb-services/contacts/fetch-user-profile-by-uid.ts +++ b/packages/protocol/src/oidb-services/contacts/fetch-user-profile-by-uid.ts @@ -28,6 +28,8 @@ import { invokeOidb, type OidbSender } from '../../oidb-service'; const REQUESTED_KEYS = [ 20002, 27394, 20009, 20031, 101, 103, 102, 20020, 20003, 20026, 105, 27372, 27406, 20037, + // 企点标志(QQ 企点 / 企业版 QQ 账号):员工号实测为 1,普通账号为 0 + 40410, 42031, ]; export namespace FetchUserProfileByUid { @@ -55,6 +57,7 @@ export namespace FetchUserProfileByUid { uin: body.body.uin ?? 0, uid: body.body.uid ?? '', nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, }; if (body.body.properties) { @@ -85,6 +88,9 @@ export namespace FetchUserProfileByUid { info.age = numMap.get(20037) ?? 0; info.level = numMap.get(105) ?? 0; applyOnlineStatus(info, bytesMap, numMap); + // 企点标志:40410 / 42031,服务器仅在返回时才出现(普通账号缺省 → 0) + info.qidianMasterFlag = numMap.get(42031) ?? 0; + info.qidianCrewFlag = numMap.get(40410) ?? 0; } return info; diff --git a/packages/protocol/src/oidb-services/contacts/fetch-user-profile.ts b/packages/protocol/src/oidb-services/contacts/fetch-user-profile.ts index 078c7704..50ed9030 100644 --- a/packages/protocol/src/oidb-services/contacts/fetch-user-profile.ts +++ b/packages/protocol/src/oidb-services/contacts/fetch-user-profile.ts @@ -55,6 +55,8 @@ export function applyOnlineStatus( const REQUESTED_KEYS = [ 20002, 27394, 20009, 20031, 101, 103, 102, 20020, 20003, 20026, 105, 27372, 27406, 20037, + // 企点标志(QQ 企点 / 企业版 QQ 账号):员工号实测为 1,普通账号为 0 + 40410, 42031, ]; export namespace FetchUserProfile { @@ -86,6 +88,7 @@ export namespace FetchUserProfile { uin: body.body.uin ?? requestedUin, uid: body.body.uid ?? '', nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, }; if (body.body.properties) { @@ -116,6 +119,9 @@ export namespace FetchUserProfile { info.age = numMap.get(20037) ?? 0; info.level = numMap.get(105) ?? 0; applyOnlineStatus(info, bytesMap, numMap); + // 企点标志:40410 / 42031,服务器仅在返回时才出现(普通账号缺省 → 0) + info.qidianMasterFlag = numMap.get(42031) ?? 0; + info.qidianCrewFlag = numMap.get(40410) ?? 0; } return info; diff --git a/packages/protocol/src/oidb-services/friend/get-doubt-buddy-req.ts b/packages/protocol/src/oidb-services/friend/get-doubt-buddy-req.ts index f5c0d3d7..d8faac92 100644 --- a/packages/protocol/src/oidb-services/friend/get-doubt-buddy-req.ts +++ b/packages/protocol/src/oidb-services/friend/get-doubt-buddy-req.ts @@ -1,27 +1,17 @@ // 0xd69_0 — getDoubtBuddyReq: list the "doubtful" friend-add requests // (可能认识的人 / 被过滤的好友申请). RE'd from QQNT doubt_codec.cc. // Request {1:1, 2:{1:num, 2:uk}} (reqId is NOT on the wire). Response body -// holds a repeated item list; we surface the fields NapCat exposes. -// READ-only: the string field names (nick/source/msg) are MEDIUM confidence -// (generic serializer), so a mislabel is cosmetic, never a wire/ban risk. -// uid (tag1) and reqTime (tag9) are HIGH confidence. +// holds a repeated item list. DecodePullDoubtReq maps uid as a string and +// the account number as a separate integer field; do not reread the uid +// field as a number. String names (nick/source/msg) are MEDIUM confidence. import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; -import type { pb, pb_repeated, uint_32, uint_64 } from '@snowluma/proton'; import type { OidbBase } from '@snowluma/proto-defs/oidb'; import type { OidbDoubtGetReq, OidbDoubtGetResp, } from '@snowluma/proto-defs/oidb-actions/doubt-buddy'; import { invokeOidb, type OidbSender } from '../../oidb-service'; -interface OidbDoubtItemAccountOnTag1 { - uin?: pb<1, uint_64>; -} -interface OidbDoubtGetRespAccountOnTag1 { - status?: pb<1, uint_32>; - body?: pb<2, { list?: pb_repeated<1, OidbDoubtItemAccountOnTag1> }>; -} - export interface DoubtBuddyRequest { [key: string]: import('@snowluma/common/json').JsonValue; /** Opaque uid — pass back as `flag` to set_doubt_friends_add_request. */ @@ -63,20 +53,8 @@ export namespace GetDoubtBuddyReq { export const encode = (env: OidbBase): Uint8Array => protobuf_encode>(env); - export const decode = (bytes: Uint8Array): OidbBase => { - const decoded = protobuf_decode>(bytes); - const numeric = protobuf_decode>(bytes); - const items = decoded.body?.body?.list ?? []; - const numericItems = numeric.body?.body?.list ?? []; - for (let i = 0; i < items.length; i++) { - const item = items[i]; - if (!item) continue; - if ((item.uin ?? 0n) === 0n && numericItems[i]?.uin) { - item.uin = numericItems[i]!.uin; - } - } - return decoded; - }; + export const decode = (bytes: Uint8Array): OidbBase => + protobuf_decode>(bytes); export const invoke = (deps: Deps, params: Params): Promise => invokeOidb(deps, GetDoubtBuddyReq, params); diff --git a/packages/protocol/src/oidb-services/group-admin/kick-member.ts b/packages/protocol/src/oidb-services/group-admin/kick-member.ts index 42e038ea..c9dfecab 100644 --- a/packages/protocol/src/oidb-services/group-admin/kick-member.ts +++ b/packages/protocol/src/oidb-services/group-admin/kick-member.ts @@ -33,8 +33,11 @@ export namespace KickMember { }); export const deserialize = (_ctx: Deps, body: OidbKickMemberResponse): void => { - if (body.errorMsg) { - throw new Error(`kick member failed: ${body.errorMsg}`); + for (const item of body.results ?? []) { + const code = item.result ?? 0; + if (code !== 0) { + throw new Error(`kick member failed: result=${code}`); + } } }; diff --git a/packages/protocol/src/oidb-services/group-admin/kick-members.ts b/packages/protocol/src/oidb-services/group-admin/kick-members.ts index 5ca2ab9c..7af174f2 100644 --- a/packages/protocol/src/oidb-services/group-admin/kick-members.ts +++ b/packages/protocol/src/oidb-services/group-admin/kick-members.ts @@ -32,8 +32,11 @@ export namespace KickMembers { }); export const deserialize = (_ctx: Deps, body: OidbKickMemberResponse): void => { - if (body.errorMsg) { - throw new Error(`kick members failed: ${body.errorMsg}`); + for (const item of body.results ?? []) { + const code = item.result ?? 0; + if (code !== 0) { + throw new Error(`kick members failed: result=${code}`); + } } }; diff --git a/packages/protocol/src/oidb-services/reaction/fetch-reaction-summary.ts b/packages/protocol/src/oidb-services/reaction/fetch-reaction-summary.ts index 7d445dcb..094b5948 100644 --- a/packages/protocol/src/oidb-services/reaction/fetch-reaction-summary.ts +++ b/packages/protocol/src/oidb-services/reaction/fetch-reaction-summary.ts @@ -1,14 +1,7 @@ -// 0x9084_1 — fetch per-emoji reaction summary on a group message. -// -// Server returns the full summary unconditionally; the emoji_id / -// emoji_type / count fields in the request body are ignored by the -// summary handler but kept to mirror the working 0x9083_1 request shape -// (same `Pick` of fields the wire format prefers). -// -// "Used" entries carry (lastReactionTime, count, emojiType, emojiId). -// Catalog-tail entries (available reactions the server suggests but -// nobody has reacted with) carry only emojiType + emojiId — filtered -// out here so callers see only the meaningful subset. +// 0x9084_1 — recent-used emoji catalog for C2C/group (GetRecentUseEmojiList). +// Not the per-message reaction summary. get_msg_emoji_likes uses 0x9083_1 +// plus the local reaction cache. This namespace is kept for the catalog +// command itself. import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import type { OidbBase } from '@snowluma/proto-defs/oidb'; diff --git a/packages/protocol/src/oidb-services/reaction/get-emoji-likes.ts b/packages/protocol/src/oidb-services/reaction/get-emoji-likes.ts index 25ae06a0..5022c3fd 100644 --- a/packages/protocol/src/oidb-services/reaction/get-emoji-likes.ts +++ b/packages/protocol/src/oidb-services/reaction/get-emoji-likes.ts @@ -1,15 +1,6 @@ -// 0x9083_1 — historic "fetch reactor user list" cmd. CONFIRMED to be -// a real server endpoint (errorCode=0, trace string echoes the cmd -// name), but its reply is always a 4-byte minimal ack `18 01 20 01` -// regardless of the message / emoji / whether the bot just set a -// reaction. The actual "who reacted" data is NOT served via SSO at -// all — NTQQ's own client uses a wrapper-internal cache. SnowLuma -// mirrors that with `ReactionStore` (fed from GroupMsgEmojiLikeEvent -// push) on the OneBot side. -// -// This namespace exists as a legacy stub so older callers don't crash -// — `invoke` always returns an empty user list. Newer code should -// query `ReactionStore` instead. +// 0x9083_1 — fetch the reactor user list for one emoji on a group message. +// Encode/decode follow Windows QQ GetMsgEmojiLikesList. 0x9084_1 is a +// different command (recent-used emoji catalog) and must not be used here. import { protobuf_decode, protobuf_encode } from '@snowluma/proton'; import type { OidbBase } from '@snowluma/proto-defs/oidb'; @@ -28,13 +19,13 @@ export namespace GetEmojiLikes { emojiId: string; emojiType?: number; count?: number; - /** Base64-encoded continuation cookie from a previous page. */ + /** Continuation cookie from a previous page. */ cookie?: string; } export interface Result { users: Array<{ uin: number }>; - /** Base64 cookie for next page (empty when on last page). */ + /** Cookie for next page (empty when on last page). */ cookie: string; isLast: boolean; } @@ -44,20 +35,18 @@ export namespace GetEmojiLikes { export const serialize = (_ctx: Deps, p: Params): Oidb0x9083Req => ({ groupId: BigInt(p.groupId), sequence: BigInt(p.sequence), - emojiId: p.emojiId, emojiType: p.emojiType ?? 1, - cookie: p.cookie ? Buffer.from(p.cookie, 'base64') : new Uint8Array(0), - field7: 0, + emojiId: p.emojiId, + cookie: p.cookie ?? '', count: p.count ?? 10, - field12: 1, }); export const deserialize = (_ctx: Deps, body: Oidb0x9083Resp): Result => { - const users: Array<{ uin: number }> = (body.inner?.userInfo ?? []) + const users: Array<{ uin: number }> = (body.users ?? []) .map(u => ({ uin: Number(u?.uin ?? 0) })) .filter(u => u.uin > 0); - const cookie = body.cookie ? Buffer.from(body.cookie).toString('base64') : ''; - return { users, cookie, isLast: !cookie }; + const cookie = body.cookie ?? ''; + return { users, cookie, isLast: body.isLast ?? !cookie }; }; export const encode = (env: OidbBase): Uint8Array => diff --git a/packages/protocol/src/qq-info.ts b/packages/protocol/src/qq-info.ts index c1203eb9..4b34c4cf 100644 --- a/packages/protocol/src/qq-info.ts +++ b/packages/protocol/src/qq-info.ts @@ -17,6 +17,16 @@ export interface UserProfileInfo { batteryStatus?: number; customStatus?: { faceId: number; wording: string } | null; customStatusDesc?: string; + /** + * 企点标志(QQ 企点 / 企业版 QQ 账号),0/1。 + * 数据来源为 OIDB 0xFE1_2 number-property key 40410 / 42031: + * 真实企点员工号上实测均为 1,普通账号均为 0(见 issue #404 讨论)。 + * 与 NapCat `simpleInfo.relationFlags` 的 qidianMasterFlag / qidianCrewFlag + * 对应;qidianCrewFlag2 未发现独立 key,恒为 0。 + */ + qidianMasterFlag: number; + qidianCrewFlag: number; + qidianCrewFlag2: number; } export interface FriendInfo { diff --git a/packages/protocol/tests/msg-push/rich-body-decoder.test.ts b/packages/protocol/tests/msg-push/rich-body-decoder.test.ts index 1ea65e63..2b32555a 100644 --- a/packages/protocol/tests/msg-push/rich-body-decoder.test.ts +++ b/packages/protocol/tests/msg-push/rich-body-decoder.test.ts @@ -25,7 +25,7 @@ import type { SrcMsgPbReserve, TextElem, } from '@snowluma/proto-defs/element'; -import { makeImageUrl } from '../../src/msg-push/helpers'; +import { imageUrlFromMd5, makeImageUrl, ntImageUrlFromFileId } from '../../src/msg-push/helpers'; function lightAppBytes(json: unknown): Uint8Array { const buf = deflateSync(Buffer.from(JSON.stringify(json), 'utf8')); @@ -1035,6 +1035,64 @@ describe('decodeRichBody / unknown wire element observability', () => { expect(out).toEqual([]); }); + it('rebuilds a download URL from md5 when a customFace has no path', () => { + const out = decodeRichBody({ + richText: { + elems: [customFaceElem(fileName, '', otherMd5)], + }, + }, true); + + expect(out).toEqual([{ + type: 'image', + imageUrl: 'http://gchat.qpic.cn/gchatpic_new/0/0-0-0102030405060708090A0B0C0D0E0F10/0', + fileId: fileName, + fileSize: 10711, + width: 1080, + height: 1080, + subType: 0, + summary: '[图片]', + md5Hex: '0102030405060708090A0B0C0D0E0F10', + }]); + }); + + it('rebuilds an NT download URL from file id when the path is omitted', () => { + const msgInfo: MsgInfo = { + msgInfoBody: [{ + index: { + fileUuid: 'EhRforward', + info: { + fileSize: 10711, + fileHash: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + fileSha1: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', + fileName: '', + width: 1080, + height: 1080, + type: { picFormat: 1001 }, + }, + }, + }], + extBizInfo: { pic: { bizType: 0, textSummary: '[图片]' } }, + }; + const out = decodeRichBody({ + richText: { + elems: [{ + commonElem: { + serviceType: 48, + businessType: 20, + pbElem: protobuf_encode(msgInfo), + }, + }], + }, + }, true); + + expect(out).toEqual([expect.objectContaining({ + type: 'image', + fileId: 'EhRforward', + imageUrl: 'https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=EhRforward', + summary: '[图片]', + })]); + }); + it('keeps two distinct pictures', () => { const second = 'other.png'; const out = decodeRichBody({ @@ -1068,6 +1126,19 @@ describe('decodeRichBody / unknown wire element observability', () => { expect(makeImageUrl('/gchatpic_new/0/0-0-AABB/0')) .toBe('http://gchat.qpic.cn/gchatpic_new/0/0-0-AABB/0'); }); + + it('rebuilds a gchat URL from a 32-char md5', () => { + expect(imageUrlFromMd5('0102030405060708090a0b0c0d0e0f10')) + .toBe('http://gchat.qpic.cn/gchatpic_new/0/0-0-0102030405060708090A0B0C0D0E0F10/0'); + expect(imageUrlFromMd5('short')).toBe(''); + }); + + it('rebuilds an NT URL from a file id', () => { + expect(ntImageUrlFromFileId('EhRforward', true)) + .toBe('https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=EhRforward'); + expect(ntImageUrlFromFileId('EhRprivate', false)) + .toBe('https://multimedia.nt.qq.com.cn/download?appid=1406&fileid=EhRprivate'); + }); }); it('bounds retained card output across the entire message', () => { diff --git a/packages/protocol/tests/oidb-services/contacts/fetch-user-profile-by-uid.test.ts b/packages/protocol/tests/oidb-services/contacts/fetch-user-profile-by-uid.test.ts index 3100d552..49842dcb 100644 --- a/packages/protocol/tests/oidb-services/contacts/fetch-user-profile-by-uid.test.ts +++ b/packages/protocol/tests/oidb-services/contacts/fetch-user-profile-by-uid.test.ts @@ -46,6 +46,41 @@ describe('FetchUserProfileByUid namespace (UID form)', () => { const keys = env.body?.keys?.map(k => k.key); expect(keys).toContain(20002); // nickname — the whole point expect(keys).toContain(105); // QQ level + expect(keys).toContain(40410); + expect(keys).toContain(42031); + }); + + it('decodes qidian flags from number-properties (0 when absent)', async () => { + const qidian = makeSender({ + body: { + uin: 3004251964, uid: 'u', + properties: { + bytesProperties: [], + numberProperties: [ + { number1: 40410, number2: 1 }, + { number1: 42031, number2: 1 }, + ], + }, + } as any, + }); + const out = await FetchUserProfileByUid.invoke(qidian, { uid: 'u' }); + expect(out.qidianMasterFlag).toBe(1); + expect(out.qidianCrewFlag).toBe(1); + expect(out.qidianCrewFlag2).toBe(0); + + const normal = makeSender({ + body: { + uin: 10001, uid: 'u', + properties: { + bytesProperties: [], + numberProperties: [{ number1: 20009, number2: 1 }], + }, + } as any, + }); + const out2 = await FetchUserProfileByUid.invoke(normal, { uid: 'u' }); + expect(out2.qidianMasterFlag).toBe(0); + expect(out2.qidianCrewFlag).toBe(0); + expect(out2.qidianCrewFlag2).toBe(0); }); it('decodes nickname + uin from the response so the pipeline can fill them into the event', async () => { diff --git a/packages/protocol/tests/oidb-services/contacts/fetch-user-profile.test.ts b/packages/protocol/tests/oidb-services/contacts/fetch-user-profile.test.ts index 61432189..5893bfd6 100644 --- a/packages/protocol/tests/oidb-services/contacts/fetch-user-profile.test.ts +++ b/packages/protocol/tests/oidb-services/contacts/fetch-user-profile.test.ts @@ -44,6 +44,43 @@ describe('FetchUserProfile namespace', () => { expect(keys).toContain(101); // avatar expect(keys).toContain(102); // sign expect(keys).toContain(103); // remark + expect(keys).toContain(40410); // qidian crew flag (企点员工标志) + expect(keys).toContain(42031); // qidian master flag (企点主号标志) + }); + + it('decodes qidian flags from number-properties (0 when absent)', async () => { + // 企点员工号:两个标志均为 1;普通账号服务器不返回这两个 key → 缺省 0 + const qidian = makeSender({ + body: { + uin: 3004251964, uid: 'u', + properties: { + bytesProperties: [], + numberProperties: [ + { number1: 40410, number2: 1 }, + { number1: 42031, number2: 1 }, + ], + }, + } as any, + }); + const out = await FetchUserProfile.invoke(qidian, { uin: 3004251964 }); + expect(out.qidianMasterFlag).toBe(1); + expect(out.qidianCrewFlag).toBe(1); + expect(out.qidianCrewFlag2).toBe(0); + + // 普通账号:无企点 key → 全 0 + const normal = makeSender({ + body: { + uin: 10001, uid: 'u', + properties: { + bytesProperties: [], + numberProperties: [{ number1: 20009, number2: 1 }], + }, + } as any, + }); + const out2 = await FetchUserProfile.invoke(normal, { uin: 10001 }); + expect(out2.qidianMasterFlag).toBe(0); + expect(out2.qidianCrewFlag).toBe(0); + expect(out2.qidianCrewFlag2).toBe(0); }); it('decodes nickname / remark / qid / sign from bytes-properties', async () => { diff --git a/packages/protocol/tests/oidb-services/friend/get-doubt-buddy-req.test.ts b/packages/protocol/tests/oidb-services/friend/get-doubt-buddy-req.test.ts index 4033a4bf..9028d46d 100644 --- a/packages/protocol/tests/oidb-services/friend/get-doubt-buddy-req.test.ts +++ b/packages/protocol/tests/oidb-services/friend/get-doubt-buddy-req.test.ts @@ -59,4 +59,26 @@ describe('GetDoubtBuddyReq namespace', () => { it('deserialize returns [] when the body has no list', () => { expect(GetDoubtBuddyReq.deserialize({} as any, { status: 1 })).toEqual([]); }); + + it('keeps the uid string and does not reread it as the account number', async () => { + const respEnv: OidbBase = { + command: 0xD69, subCommand: 0, + body: { status: 1, body: { list: [ + { uid: 'u_alice', nick: 'Alice', msg: 'hi', source: 'QQ号查找', reason: 'caution' }, + ] } }, + }; + const sender = { + sendRawPacket: vi.fn(async () => ({ + success: true, gotResponse: true, errorCode: 0, errorMessage: '', + responseData: Buffer.from(protobuf_encode>(respEnv)), + })), + }; + const list = await GetDoubtBuddyReq.invoke(sender, { count: 10 }); + expect(list).toEqual([ + { + uid: 'u_alice', user_id: 0, nick: 'Alice', source: 'QQ号查找', + reason: 'caution', msg: 'hi', group_code: '', reqTime: 0, + }, + ]); + }); }); diff --git a/packages/protocol/tests/oidb-services/group-admin/kick-member.test.ts b/packages/protocol/tests/oidb-services/group-admin/kick-member.test.ts index 5b2bf030..a2afc5c4 100644 --- a/packages/protocol/tests/oidb-services/group-admin/kick-member.test.ts +++ b/packages/protocol/tests/oidb-services/group-admin/kick-member.test.ts @@ -5,9 +5,22 @@ import type { OidbKickMember } from '@snowluma/proto-defs/oidb-actions/base'; import type { SendPacketResult } from '@snowluma/common/packet-sender'; import { KickMember } from '../../../src/oidb-services/group-admin/kick-member'; +import { m, s, v } from '../_pb-oracle'; -function makeDeps() { - const r: SendPacketResult = { success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData: Buffer.alloc(0) }; +/** 24-byte uid: success items on the wire are `{ result:0, uid }` with uid length 0x18. */ +const TRACE_UID = 'u_abcdefghijklmnopqrstuv'; + +function kickResultItem(result: number, uid: string): number[] { + return [...v(1, result), ...s(2, uid)]; +} + +function kickResponseBytes(groupUin: number, items: number[][]): Buffer { + const body = [...v(1, groupUin), ...items.flatMap(item => m(2, item))]; + return Buffer.from(m(4, body)); +} + +function makeDeps(responseData: Buffer = Buffer.alloc(0)) { + const r: SendPacketResult = { success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData }; return { sendRawPacket: vi.fn(async () => r), resolveUserUid: vi.fn(async () => 'resolved-uid'), @@ -40,4 +53,42 @@ describe('KickMember namespace', () => { expect(env.body?.reason ?? '').toBe(''); expect(env.body?.rejectAddRequest ?? false).toBe(false); }); + + it('treats an empty body as success', async () => { + await expect(KickMember.invoke(makeDeps(), { + groupId: 1, userId: 2, reject: false, + })).resolves.toBeUndefined(); + }); + + it('treats a zero per-member result plus uid as success (#413)', async () => { + const bytes = kickResponseBytes(12345, [kickResultItem(0, TRACE_UID)]); + const decoded = KickMember.decode(bytes); + expect(decoded.body?.groupUin).toBe(12345); + expect(decoded.body?.results).toEqual([{ result: 0, uid: TRACE_UID }]); + + await expect(KickMember.invoke(makeDeps(bytes), { + groupId: 12345, userId: 67890, reject: false, + })).resolves.toBeUndefined(); + }); + + it('rejects a non-zero per-member result with the numeric code, not the uid (#298)', async () => { + const bytes = kickResponseBytes(12345, [kickResultItem(7, TRACE_UID)]); + await expect(KickMember.invoke(makeDeps(bytes), { + groupId: 12345, userId: 67890, reject: false, + })).rejects.toThrow('kick member failed: result=7'); + }); + + it('deserialize: omitted/zero results succeed; non-zero throws', () => { + expect(() => KickMember.deserialize({} as never, {})).not.toThrow(); + expect(() => KickMember.deserialize({} as never, { results: [] })).not.toThrow(); + expect(() => KickMember.deserialize({} as never, { + results: [{ result: 0, uid: TRACE_UID }], + })).not.toThrow(); + expect(() => KickMember.deserialize({} as never, { + results: [{ uid: TRACE_UID }], + })).not.toThrow(); + expect(() => KickMember.deserialize({} as never, { + results: [{ result: 1, uid: TRACE_UID }], + })).toThrow('kick member failed: result=1'); + }); }); diff --git a/packages/protocol/tests/oidb-services/group-admin/kick-members.test.ts b/packages/protocol/tests/oidb-services/group-admin/kick-members.test.ts index 1c979adf..4df3d1a6 100644 --- a/packages/protocol/tests/oidb-services/group-admin/kick-members.test.ts +++ b/packages/protocol/tests/oidb-services/group-admin/kick-members.test.ts @@ -5,9 +5,25 @@ import type { Oidb0x8a0Req } from '@snowluma/proto-defs/oidb-actions/base'; import type { SendPacketResult } from '@snowluma/common/packet-sender'; import { KickMembers } from '../../../src/oidb-services/group-admin/kick-members'; +import { m, s, v } from '../_pb-oracle'; -function makeDeps(resolveSequence: string[] = ['uid-a', 'uid-b']) { - const r: SendPacketResult = { success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData: Buffer.alloc(0) }; +const TRACE_UID_A = 'u_abcdefghijklmnopqrstuv'; +const TRACE_UID_B = 'u_bbbbbbbbbbbbbbbbbbbbbb'; + +function kickResultItem(result: number, uid: string): number[] { + return [...v(1, result), ...s(2, uid)]; +} + +function kickResponseBytes(groupUin: number, items: number[][]): Buffer { + const body = [...v(1, groupUin), ...items.flatMap(item => m(2, item))]; + return Buffer.from(m(4, body)); +} + +function makeDeps( + resolveSequence: string[] = ['uid-a', 'uid-b'], + responseData: Buffer = Buffer.alloc(0), +) { + const r: SendPacketResult = { success: true, gotResponse: true, errorCode: 0, errorMessage: '', responseData }; const resolveUserUid = vi.fn(); for (const uid of resolveSequence) resolveUserUid.mockResolvedValueOnce(uid); return { @@ -41,4 +57,36 @@ describe('KickMembers namespace', () => { const env = protobuf_decode>(bytes); expect(env.body?.rejectAddRequest).toBe(1); }); + + it('treats an empty body as success', async () => { + await expect(KickMembers.invoke(makeDeps(['u']), { + groupId: 1, userIds: [2], reject: false, + })).resolves.toBeUndefined(); + }); + + it('treats zero per-member results as success (#413)', async () => { + const bytes = kickResponseBytes(12345, [ + kickResultItem(0, TRACE_UID_A), + kickResultItem(0, TRACE_UID_B), + ]); + const decoded = KickMembers.decode(bytes); + expect(decoded.body?.results).toEqual([ + { result: 0, uid: TRACE_UID_A }, + { result: 0, uid: TRACE_UID_B }, + ]); + + await expect(KickMembers.invoke(makeDeps(['uid-a', 'uid-b'], bytes), { + groupId: 12345, userIds: [11, 22], reject: false, + })).resolves.toBeUndefined(); + }); + + it('rejects when any per-member result is non-zero, with the numeric code', async () => { + const bytes = kickResponseBytes(12345, [ + kickResultItem(0, TRACE_UID_A), + kickResultItem(7, TRACE_UID_B), + ]); + await expect(KickMembers.invoke(makeDeps(['uid-a', 'uid-b'], bytes), { + groupId: 12345, userIds: [11, 22], reject: false, + })).rejects.toThrow('kick members failed: result=7'); + }); }); diff --git a/packages/protocol/tests/oidb-services/reaction/get-emoji-likes.test.ts b/packages/protocol/tests/oidb-services/reaction/get-emoji-likes.test.ts index 5e1224e5..63eb5d36 100644 --- a/packages/protocol/tests/oidb-services/reaction/get-emoji-likes.test.ts +++ b/packages/protocol/tests/oidb-services/reaction/get-emoji-likes.test.ts @@ -5,6 +5,7 @@ import type { Oidb0x9083Req, Oidb0x9083Resp } from '@snowluma/proto-defs/oidb-ac import type { SendPacketResult } from '@snowluma/common/packet-sender'; import { GetEmojiLikes } from '../../../src/oidb-services/reaction/get-emoji-likes'; +import { env, s, v } from '../_pb-oracle'; function makeSender(resp?: Buffer) { const defaultResp: SendPacketResult = { @@ -54,39 +55,32 @@ describe('GetEmojiLikes namespace', () => { expect(out.count).toBe(50); }); - it('decodes base64 cookie into the bytes field for continuation', () => { - const cookie = Buffer.from([0xCA, 0xFE]).toString('base64'); - const out = GetEmojiLikes.serialize({} as any, { groupId: 1, sequence: 1, emojiId: 'x', cookie }); - expect(out.cookie).toBeInstanceOf(Uint8Array); - expect(Buffer.from(out.cookie!).equals(Buffer.from([0xCA, 0xFE]))).toBe(true); + it('passes the continuation cookie through as a string', () => { + const out = GetEmojiLikes.serialize({} as any, { groupId: 1, sequence: 1, emojiId: 'x', cookie: 'next' }); + expect(out.cookie).toBe('next'); }); - it('emits a 0-length cookie buffer for the first page (no cookie supplied)', () => { + it('emits an empty cookie for the first page', () => { const out = GetEmojiLikes.serialize({} as any, { groupId: 1, sequence: 1, emojiId: 'x' }); - expect(out.cookie!.length).toBe(0); - }); - - it('sets field7=0 and field12=1 (magic values matching the historic wire shape)', () => { - const out = GetEmojiLikes.serialize({} as any, { groupId: 1, sequence: 1, emojiId: 'x' }); - expect(out.field7).toBe(0); - expect(out.field12).toBe(1); + expect(out.cookie).toBe(''); }); }); describe('deserialize', () => { - it('extracts users from inner.userInfo and base64-encodes the cookie', () => { + it('extracts users from the repeated list and returns the cookie', () => { const result = GetEmojiLikes.deserialize({} as any, { - inner: { userInfo: [{ uin: 10001n }, { uin: 20002n }] }, - cookie: new Uint8Array([0xCA, 0xFE]), + users: [{ uin: 10001n }, { uin: 20002n }], + cookie: 'next', + isLast: false, }); expect(result.users).toEqual([{ uin: 10001 }, { uin: 20002 }]); - expect(result.cookie).toBe(Buffer.from([0xCA, 0xFE]).toString('base64')); + expect(result.cookie).toBe('next'); expect(result.isLast).toBe(false); }); it('filters out users with uin=0 (placeholder / zero-value)', () => { const result = GetEmojiLikes.deserialize({} as any, { - inner: { userInfo: [{ uin: 10001n }, { uin: 0n }, { uin: 20002n }] }, + users: [{ uin: 10001n }, { uin: 0n }, { uin: 20002n }], }); expect(result.users).toEqual([{ uin: 10001 }, { uin: 20002 }]); }); @@ -100,13 +94,13 @@ describe('GetEmojiLikes namespace', () => { it('returns isLast=true when cookie is absent (final page)', () => { const result = GetEmojiLikes.deserialize({} as any, { - inner: { userInfo: [{ uin: 10001n }] }, + users: [{ uin: 10001n }], }); expect(result.isLast).toBe(true); }); - it('handles missing userInfo entries field', () => { - const result = GetEmojiLikes.deserialize({} as any, { inner: {} }); + it('handles a missing users field', () => { + const result = GetEmojiLikes.deserialize({} as any, {}); expect(result.users).toEqual([]); }); }); @@ -122,14 +116,15 @@ describe('GetEmojiLikes namespace', () => { const respEnvelope = Buffer.from(protobuf_encode>({ command: 0x9083, subCommand: 1, body: { - inner: { userInfo: [{ uin: 10001n }] }, - cookie: new Uint8Array([0xDE, 0xAD]), - } as any, + users: [{ uin: 10001n }], + cookie: 'next', + isLast: false, + }, })); const sender = makeSender(respEnvelope); const result = await GetEmojiLikes.invoke(sender, { groupId: 1, sequence: 1, emojiId: '76' }); expect(result.users).toEqual([{ uin: 10001 }]); - expect(result.cookie).toBe(Buffer.from([0xDE, 0xAD]).toString('base64')); + expect(result.cookie).toBe('next'); expect(result.isLast).toBe(false); }); @@ -154,5 +149,21 @@ describe('GetEmojiLikes namespace', () => { expect(env.body?.emojiType).toBe(2); expect(env.body?.count).toBe(20); }); + + it('byte-oracle: request body uses type then emoji id, not the set-reaction order', async () => { + const sender = makeSender(); + await GetEmojiLikes.invoke(sender, { + groupId: 12345, sequence: 99, emojiId: '76', emojiType: 1, count: 20, + }); + const [, reqBytes] = sender.sendRawPacket.mock.calls[0]!; + const body = [ + ...v(2, 12345), + ...v(3, 99), + ...v(4, 1), + ...s(5, '76'), + ...v(8, 20), + ]; + expect(Buffer.from(reqBytes).toString('hex')).toBe(env(0x9083, 1, body, false)); + }); }); }); diff --git a/packages/protocol/tests/packet-pipeline-roster-refresh.test.ts b/packages/protocol/tests/packet-pipeline-roster-refresh.test.ts index dd1ce164..d5191964 100644 --- a/packages/protocol/tests/packet-pipeline-roster-refresh.test.ts +++ b/packages/protocol/tests/packet-pipeline-roster-refresh.test.ts @@ -16,7 +16,10 @@ afterEach(() => { }); function makeProfile(uin: number, uid = ''): UserProfileInfo { - return { uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 }; + return { + uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, + }; } function makeMember(uin: number, uid: string): GroupMemberInfo { diff --git a/packages/protocol/tests/packet-pipeline-stranger-resolve.test.ts b/packages/protocol/tests/packet-pipeline-stranger-resolve.test.ts index 77a3e440..93c9ecdc 100644 --- a/packages/protocol/tests/packet-pipeline-stranger-resolve.test.ts +++ b/packages/protocol/tests/packet-pipeline-stranger-resolve.test.ts @@ -17,7 +17,10 @@ import type { GroupMemberInfo, QQGroupInfo, UserProfileInfo } from '@snowluma/pr import type { PacketInfo } from '@snowluma/common/protocol-types'; function makeProfile(uin: number, uid = '', nickname = ''): UserProfileInfo { - return { uin, uid, nickname, remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 }; + return { + uin, uid, nickname, remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, + }; } function makePipeline(opts: { diff --git a/packages/protocol/tests/packet-pipeline-trace.test.ts b/packages/protocol/tests/packet-pipeline-trace.test.ts index 5e5f3420..b565abb5 100644 --- a/packages/protocol/tests/packet-pipeline-trace.test.ts +++ b/packages/protocol/tests/packet-pipeline-trace.test.ts @@ -76,7 +76,11 @@ function msgPushContext( function makePipeline(opts: { fetchGroupList?: () => Promise; fetchGroupMemberList?: (groupId: number) => Promise; - fetchProfileByUid?: () => Promise<{ uin: number; uid: string; nickname: string; remark: string; qid: string; sex: string; age: number; sign: string; avatar: string; level: number }>; + fetchProfileByUid?: () => Promise<{ + uin: number; uid: string; nickname: string; remark: string; qid: string; + sex: string; age: number; sign: string; avatar: string; level: number; + qidianMasterFlag: number; qidianCrewFlag: number; qidianCrewFlag2: number; + }>; } = {}) { const identity = IdentityService.memory('10001'); if (opts.fetchProfileByUid) { @@ -84,6 +88,7 @@ function makePipeline(opts: { fetchProfile: async () => ({ uin: 0, uid: '', nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, qidianCrewFlag: 0, qidianCrewFlag2: 0, }), fetchProfileByUid: opts.fetchProfileByUid, }); @@ -327,6 +332,9 @@ describe('IncomingPacketPipeline TRACE lifecycle', () => { sign: '', avatar: '', level: 0, + qidianMasterFlag: 0, + qidianCrewFlag: 0, + qidianCrewFlag2: 0, }; }, }); diff --git a/packages/proton/package.json b/packages/proton/package.json index b2092310..6754862c 100644 --- a/packages/proton/package.json +++ b/packages/proton/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/proton", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "description": "Compile-time protobuf encoder/decoder generator for SnowLuma. TypeScript interfaces → fully-inlined, zero-runtime protobuf codec functions. Vendored from SnowLuma/protobuf-dsl (reference copy under dev/protobuf-dsl/) with edge-case fixes applied.", diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 4262cceb..0a74e9ca 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/runtime", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "main": "index.mjs", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 36628d87..1d56fc6f 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -4,7 +4,7 @@ "name": "MotricSeven", "email": "motricseven@gmail.com" }, - "version": "1.14.12", + "version": "1.14.13", "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 57e1536f..b3b03401 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -4,7 +4,7 @@ "name": "MotricSeven", "email": "motricseven@gmail.com" }, - "version": "1.14.12", + "version": "1.14.13", "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 98d87ede..09e3d7f2 100644 --- a/packages/websocket/package.json +++ b/packages/websocket/package.json @@ -1,7 +1,7 @@ { "license": "SEE LICENSE IN LICENSE", "name": "@snowluma/websocket", - "version": "1.14.12", + "version": "1.14.13", "private": true, "type": "module", "main": "./src/index.ts", diff --git a/packages/webui/package.json b/packages/webui/package.json index 50e3fb1e..e7d393d0 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -2,7 +2,7 @@ "license": "SEE LICENSE IN LICENSE", "name": "webui", "private": true, - "version": "1.14.12", + "version": "1.14.13", "type": "module", "scripts": { "dev": "vite",