@napuketto/kernel 0.12.0 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -7,6 +7,10 @@
7
7
  * apis / cache / login / bridge 均已接入(见下方导出)。
8
8
  */
9
9
  import pino from "pino";
10
+ /** NT RawMessage → canonical 元素(与 toSendElements 对称,接收方向)。 */
11
+ export declare function toCanonicalElements(msg: RawMessage): CanonicalElement[];
12
+ /** canonical 元素 → NT 发送元素(text/at/face/image/voice/reply 核心 + json ARK 透传)。 */
13
+ export declare function toSendElements(elements: CanonicalElement[]): SendMessageElement[];
10
14
  /**
11
15
  * 实体类型层(运行时探测产物 + 公开资料作说明书,ADR-006)
12
16
  *
@@ -450,6 +454,98 @@ interface NodeIKernelMsgService {
450
454
  emojiInfoList?: unknown;
451
455
  }>;
452
456
  }
457
+ /** 好友核心信息(BuddyListEntry.coreInfo,2026-09-08 T10 实测)。 */
458
+ interface BuddyCoreInfo {
459
+ uid: string;
460
+ uin: string;
461
+ nick?: string;
462
+ remark?: string;
463
+ [key: string]: unknown;
464
+ }
465
+ /** 好友列表明细(BuddyCategory.buddyList 成员,2026-09-08 T10 实测快照)。 */
466
+ interface BuddyListEntry {
467
+ uid: string;
468
+ /** 顶层 uin(coreInfo.uin 同值;缺失时回退 coreInfo)。 */
469
+ uin?: string;
470
+ coreInfo?: BuddyCoreInfo;
471
+ baseInfo?: Record<string, unknown>;
472
+ [key: string]: unknown;
473
+ }
474
+ /**
475
+ * 好友列表分类(getBuddyListV2 返回 / onBuddyListChange 全量快照载荷)。
476
+ * ⚠️ 2026-09-08 T10 实测:onBuddyListChange 载荷 = BuddyCategory[],分类项
477
+ * 含 buddyList 明细(uid/uin/coreInfo/baseInfo);实测样本无 buddyUids——
478
+ * 两字段均按 optional 防御(旧描述的 buddyUids 保留兼容)。
479
+ */
480
+ interface BuddyCategory {
481
+ categoryId: number;
482
+ categorySortId: number;
483
+ categroyName: string;
484
+ categroyMbCount: number;
485
+ onlineCount: number;
486
+ buddyUids?: string[];
487
+ /** 好友明细(onBuddyListChange 快照,T10 实证)。 */
488
+ buddyList?: BuddyListEntry[];
489
+ }
490
+ /** 好友申请(getBuddyReq 返回的 buddyReqs 成员,说明书参考,待探测校准)。 */
491
+ interface BuddyReq {
492
+ reqTime: string;
493
+ friendUid: string;
494
+ friendNick?: string;
495
+ sourceId?: number;
496
+ sourceName?: string;
497
+ [key: string]: unknown;
498
+ }
499
+ /** 可疑好友申请(getDoubtBuddyReq 返回的 doubtList 成员,说明书参考)。 */
500
+ interface DoubtBuddyReq {
501
+ uid: string;
502
+ nick?: string;
503
+ source?: string;
504
+ reason?: string;
505
+ msg?: string;
506
+ groupCode?: string;
507
+ reqTime?: string;
508
+ [key: string]: unknown;
509
+ }
510
+ /** 好友服务:apis/friend 用到的核心方法面。 */
511
+ interface NodeIKernelBuddyService {
512
+ addKernelBuddyListener(listener: unknown): number;
513
+ removeKernelBuddyListener(listenerId: number): void;
514
+ getBuddyListV2(callFrom: string, isPullRefresh: boolean, reqType: number): Promise<GeneralCallResult & {
515
+ data: BuddyCategory[];
516
+ }>;
517
+ getBuddyListFromCache(reqType: number): Promise<BuddyCategory[]>;
518
+ getBuddyNick(uid: string): string;
519
+ getBuddyRemark(uid: string): string;
520
+ isBuddy(uid: string): boolean;
521
+ /** 好友申请列表(set_friend_add_request 应答前查找匹配项)。 */
522
+ getBuddyReq(): Promise<GeneralCallResult & {
523
+ buddyReqs?: BuddyReq[];
524
+ }>;
525
+ /** 同意/拒绝加好友请求(set_friend_add_request)。 */
526
+ approvalFriendRequest(arg: {
527
+ friendUid: string;
528
+ reqTime: string;
529
+ accept: boolean;
530
+ }): Promise<void>;
531
+ /** 设置好友备注(set_friend_remark;void 语义乐观处理)。 */
532
+ setBuddyRemark(param: {
533
+ uid: string;
534
+ remark: string;
535
+ }): void;
536
+ /** 删除好友(delete_friend)。 */
537
+ delBuddy(param: {
538
+ friendUid: string;
539
+ tempBlock: boolean;
540
+ tempBothDel: boolean;
541
+ }): Promise<unknown>;
542
+ /** 可疑好友申请列表(get_doubt_friends_add_request;reqId 作回执匹配)。 */
543
+ getDoubtBuddyReq(reqId: string, num: number, uk: string): Promise<GeneralCallResult & {
544
+ doubtList?: DoubtBuddyReq[];
545
+ }>;
546
+ /** 处理可疑好友申请(set_doubt_friends_add_request;str1/str2 语义未知,传空串)。 */
547
+ approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
548
+ }
453
549
  /** 群成员角色(QQ wrapper 契约)。 */
454
550
  export declare const NTGroupMemberRole: {
455
551
  readonly UNSPECIFIED: 0;
@@ -722,357 +818,32 @@ interface NodeIKernelGroupService {
722
818
  /** 群头像(set_group_avatar;参数待校准;Profile setHeader 同名方法)。 */
723
819
  setHeader(groupCode: string, imagePath: string): Promise<unknown>;
724
820
  }
725
- /** 群列表更新类型(说明书参考,值待探测校准)。 */
726
- export declare const GroupListUpdateType: {
727
- /** 全量更新(groupList 为完整列表)。 */
728
- readonly ALL: 0;
729
- /** 增量更新(合并到现有缓存)。 */
730
- readonly PARTIAL: 1;
731
- };
732
- export type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
733
- /** 成员数据来源(onMemberInfoChange 第二参,说明书参考)。 */
734
- declare const GroupMemberDataSource: {
735
- /** 本地缓存。 */
736
- readonly CACHE: 0;
737
- /** 网络拉取。 */
738
- readonly NETWORK: 1;
739
- };
740
- type GroupMemberDataSource = (typeof GroupMemberDataSource)[keyof typeof GroupMemberDataSource];
741
- /** onMemberListChange 参数(sceneId 为群号 groupCode)。 */
742
- interface GroupMemberListChange {
743
- sceneId: string;
744
- ids: string[];
745
- /** uid → GroupMember。 */
746
- infos: Map<string, GroupMember>;
747
- hasPrev: boolean;
748
- hasNext: boolean;
749
- hasRobot: boolean;
750
- }
751
- /** 群服务(GroupService)的原生回调监听接口。 */
752
- type GroupListener = {
753
- /** 群列表初始化完成(listEmpty:是否无群)。 */
754
- onGroupListInited: (listEmpty: boolean) => void;
755
- /** 群列表更新。 */
756
- onGroupListUpdate: (updateType: GroupListUpdateType, groupList: Group[]) => void;
757
- /** 群详情变化。 */
758
- onGroupDetailInfoChange: (detailInfo: GroupDetailInfo) => void;
759
- /** 群成员列表变化(sceneId=groupCode)。 */
760
- onMemberListChange: (arg: GroupMemberListChange) => void;
761
- /** 群成员信息变化(dataSource 区分本地缓存/网络)。 */
762
- onMemberInfoChange: (groupCode: string, dataSource: GroupMemberDataSource, members: Map<string, GroupMember>) => void;
763
- /** 群通知更新(doubt:是否可疑/忽略列表)。 */
764
- onGroupNotifiesUpdated: (doubt: boolean, notifies: GroupNotify[]) => void;
765
- /** 群通知单屏(分页 seq)。 */
766
- onGroupSingleScreenNotifies: (doubt: boolean, seq: string, notifies: GroupNotify[]) => void;
767
- /** 群禁言成员列表变化。 */
768
- onShutUpMemberListChanged: (groupCode: string, members: ShutUpGroupMember[]) => void;
769
- /**
770
- * 群精华列表变化(OB11 group_essence 候选源,2026-09-10 接线)。
771
- * 证据:wrapper.node 9.9.33-52230 字符串——小写名位于 listener 反射字符串簇,
772
- * 与已知 onMemberListChange/onBuddyReqChange 交错(同一字符串表页);
773
- * API 族旁证 addGroupEssence/getGroupLatestEssenceList。
774
- * ⚠️ 参数形状待真实事件校准(unknown 透传,订阅方 raw 日志观测)。
775
- */
776
- onGroupEssenceListChange: (arg: unknown) => void;
777
- };
778
821
  /**
779
- * 登录状态监听转发面(LoginBridge 通道类型,2026-11-01 批次三)
822
+ * NodeIKernelProfileLikeService:资料点赞服务接口面(自研描述,非移植)
780
823
  *
781
- * ⚠️ 参数形状零样本(三轮录制无下线操作)——...args unknown 透传,订阅方
782
- * 防御性收窄 + 校准日志。原生完整回调面见 types/wrapper.ts IKernelLoginListener
783
- * (二进制字符串提取产物);本类型只收 bot_offline 候选的两个回调。
784
- * 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
785
- * 约束;方法必须必选(optional 会破坏事件通道的 Extract 推导)。
824
+ * 依据:运行时反射 + wrapper 外部契约(接口签名是 QQ 的外部事实,自研描述其形状,
825
+ * 零复制实现)。
826
+ * (接口签名是外部系统的事实,我们自研描述其形状,零复制实现)。
827
+ * 只收录 apis/profile-like 需要的方法;其余按需探测后补齐。
786
828
  */
787
- type LoginListener = {
788
- /** 连接断开(bot_offline 候选源;被踢/掉线语义待野捕校准)。 */
789
- onLoginDisConnected: (...args: unknown[]) => void;
790
- /** 登出成功(主动登出路径)。 */
791
- onLogoutSucceed: (...args: unknown[]) => void;
792
- };
793
- /** 消息已读上报(peer + 已读 seq)。 */
794
- interface MsgReadReportItem {
795
- peer: unknown;
796
- readSeq: string;
797
- }
798
- /** 消息回执(msgId + 已读 seq)。 */
799
- interface MsgReceipt {
800
- msgId: string;
801
- readSeq: string;
829
+ /** 点赞返回(setBuddyProfileLike,说明书参考)。 */
830
+ interface BuddyProfileLikeResult {
831
+ result: number;
832
+ errMsg: string;
833
+ succCounts: number;
802
834
  }
803
- /** 消息服务(MsgService)的原生回调监听接口。
804
- * 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
805
- * 约束——interface 无隐式索引签名不兼容;type 对象类型天然满足。
806
- *
807
- * ⚠️ 2026-08-07 运行时探测实证(自建宿主,QQ 9.9.33):onRecvMsg 回调参数是
808
- * **消息数组**(多条批量推送),非单条 RawMessage——此前单条签名错误(收到数组后
809
- * msg.msgId/elements 全 undefined)。信号链:原生回调 → MsgBridge 透传数组 →
810
- * 事件通道 → 订阅方遍历处理。 */
811
- type MsgListener = {
812
- /** 收到新消息(批量数组,运行时实证)。 */
813
- onRecvMsg: (msgs: RawMessage[]) => void;
814
- /** 消息已读上报。 */
815
- onRecvMsgReadReport: (reports: MsgReadReportItem[]) => void;
816
- /** 消息回执。 */
817
- onRecvMsgReceipt: (receipts: MsgReceipt[]) => void;
818
- /** 消息列表更新(含发送状态变化:sendStatus 0=失败 1=发送中 2=成功 3=成功无seq)。
819
- * 2026-08-11 补齐:sendMsg 发送结果以此事件为准(NapCat 同款),
820
- * sendMsg 返回值 result 可能非 0 但实际发送成功(异步确认)。 */
821
- onMsgInfoListUpdate: (msgs: RawMessage[]) => void;
822
- /**
823
- * 收到离线文件消息(OB11 offline_file 事件源,2026-09-10 接线)。
824
- * 证据:wrapper.node 9.9.33-52230 字符串——小写名位于 listener 反射字符串簇
825
- * (与 onRecvMsg 同页,offset 差 ~7KB)+ RTTI
826
- * `OnRecvOfflineFileMsg@KernelMsgService@wrapper@nt`;API 族旁证
827
- * getNewOfflineFileList。2026-11-01 录制实证:参数 = RawMessage 数组
828
- * (chatType=1,fileElement 携带 fileUuid/file10MMd5 等)。
829
- */
830
- onRecvOfflineFileMsg: (msgs: RawMessage[]) => void;
831
- /**
832
- * 收到文件消息(onRecvOfflineFileMsg 同族;2026-11-01 录制实证:与
833
- * onRecvOfflineFileMsg 同载荷(RawMessage 数组)——friend_file_upload
834
- * 第二源,订阅方按 msgId 去重)。
835
- */
836
- onFileMsgCome: (msgs: RawMessage[]) => void;
837
- /**
838
- * 收到在线文件消息(onRecvOfflineFileMsg 同族,字符串簇相邻;
839
- * OB11 无对应通知类型,仅作校准观测)。参数形状待校准。
840
- */
841
- onRecvOnlineFileMsg: (arg: unknown) => void;
842
- /**
843
- * 收到系统消息(sys msg 总闸,2026-09-10 接线):群名片/头衔/精华/荣誉等
844
- * 系统事件的根载体(二进制 55 个 OnSysMsg* 处理器;另有请求式
845
- * registerSysMsgNotification(type, subType, ids, callback) 需 3 参)。
846
- * 证据:小写名与 onRecvMsg 相邻(offset 差 ~1.4KB)+ 日志
847
- * `OnRecvSysMsg msg_type=0x{:x} sub_type=0x{:x} is_online={}`。
848
- * ⚠️ 参数形状待真实事件校准(unknown 透传,订阅方 raw 日志观测)。
849
- */
850
- onRecvSysMsg: (arg: unknown) => void;
851
- };
852
- /** 会话联系人(getRecentContactList 项,说明书参考,待探测校准)。 */
853
- interface RecentContact {
854
- /** 会话 id(群场景 = 群号,好友场景 = uid)。 */
855
- peerUid: string;
856
- /** 会话类型(ChatType 值域)。 */
857
- chatType: number;
858
- /** 置顶标记(get_peer_pins 数据源;listener 实测字段名为 topFlag,1 = 置顶)。 */
859
- topFlag?: number;
860
- /** 置顶标记(布尔别名形态,兼容探测取值)。 */
861
- isTop?: boolean;
862
- /** 置顶时间(topFlag=1 时携带;2026-11-01 置顶实验实证为秒级 unix 字符串)。 */
863
- topFlagTime?: string;
864
- /** 对端 uin(部分返回形态带)。 */
865
- peerUin?: string;
866
- [key: string]: unknown;
867
- }
868
- /** 会话列表拉取参数(getRecentContactList,字段值待探测校准)。 */
869
- interface RecentContactFetchParam {
870
- /** 拉取条数(缺省覆盖置顶集合足够大)。 */
871
- count: number;
872
- }
873
- /** 会话列表服务:apis/recent-contact 与 RecentContactBridge 用到的核心方法面。 */
874
- interface NodeIKernelRecentContactService {
875
- /** 会话列表(get_peer_pins 数据源;返回形状待探测校准)。 */
876
- getRecentContactList(param: RecentContactFetchParam): Promise<GeneralCallResult & {
877
- result?: unknown;
878
- }>;
879
- /** 注册会话列表监听(RecentContactBridge;录制实证方法名,listener 为普通 JS 对象)。 */
880
- addKernelRecentContactListener(listener: unknown): number;
881
- /** 注销会话列表监听。 */
882
- removeKernelRecentContactListener(listenerId: number): void;
883
- }
884
- /** 会话列表变更(onRecentContactListChangedVer2 参数项,录制实证形状)。 */
885
- interface RecentContactListChanged {
886
- /** 列表类别(实测 1/2 两类;翻译侧不依赖,用条目 chatType 判场景)。 */
887
- listType?: number;
888
- /** 全量排序联系人 id(contactId 空间)。 */
889
- sortedContactList?: string[];
890
- /** 变更条目(RecentContact 快照,含 topFlag/topFlagTime/chatType)。 */
891
- changedList?: RecentContact[];
892
- [key: string]: unknown;
893
- }
894
- /** 会话列表服务(RecentContactService)的原生回调监听接口。 */
895
- type RecentContactListener = {
896
- /** 会话列表变更(高频:消息活动快照 + 置顶翻转,订阅方按 topFlag 翻转过滤)。 */
897
- onRecentContactListChangedVer2: (lists: RecentContactListChanged[]) => void;
898
- /** 会话通知(单条快照数组,peerUid 空 / chatType=7 影子条目须过滤)。 */
899
- onRecentContactNotification: (contacts: RecentContact[]) => void;
900
- };
901
- /** NT RawMessage → canonical 元素(与 toSendElements 对称,接收方向)。 */
902
- export declare function toCanonicalElements(msg: RawMessage): CanonicalElement[];
903
- /** canonical 元素 → NT 发送元素(text/at/face/image/voice/reply 核心 + json ARK 透传)。 */
904
- export declare function toSendElements(elements: CanonicalElement[]): SendMessageElement[];
905
- /** 协议无关的规范消息元素。 */
906
- type CanonicalElement = {
907
- type: "text";
908
- text: string;
909
- } | {
910
- type: "at";
911
- target: string;
912
- display?: string;
913
- } | {
914
- type: "image";
915
- path: string;
916
- url?: string;
917
- size?: {
918
- width: number;
919
- height: number;
920
- };
921
- } | {
922
- type: "face";
923
- id: string;
924
- } | {
925
- type: "voice";
926
- path: string;
927
- durationMs?: number;
928
- url?: string;
929
- } | {
930
- type: "video";
931
- path: string;
932
- url?: string;
933
- thumbPath?: string;
934
- width?: number;
935
- height?: number;
936
- durationSec?: number;
937
- } | {
938
- type: "file";
939
- path: string;
940
- name?: string;
941
- size?: number;
942
- } | {
943
- type: "reply";
944
- messageId: string;
945
- } | {
946
- type: "forward";
947
- messageIds: string[];
948
- } | {
949
- type: "json";
950
- raw: unknown;
951
- } | {
952
- type: "xml";
953
- raw: unknown;
954
- } | {
955
- type: "unknown";
956
- raw: unknown;
957
- };
958
- /** 好友核心信息(BuddyListEntry.coreInfo,2026-09-08 T10 实测)。 */
959
- interface BuddyCoreInfo {
960
- uid: string;
961
- uin: string;
962
- nick?: string;
963
- remark?: string;
964
- [key: string]: unknown;
965
- }
966
- /** 好友列表明细(BuddyCategory.buddyList 成员,2026-09-08 T10 实测快照)。 */
967
- interface BuddyListEntry {
968
- uid: string;
969
- /** 顶层 uin(coreInfo.uin 同值;缺失时回退 coreInfo)。 */
970
- uin?: string;
971
- coreInfo?: BuddyCoreInfo;
972
- baseInfo?: Record<string, unknown>;
973
- [key: string]: unknown;
974
- }
975
- /**
976
- * 好友列表分类(getBuddyListV2 返回 / onBuddyListChange 全量快照载荷)。
977
- * ⚠️ 2026-09-08 T10 实测:onBuddyListChange 载荷 = BuddyCategory[],分类项
978
- * 含 buddyList 明细(uid/uin/coreInfo/baseInfo);实测样本无 buddyUids——
979
- * 两字段均按 optional 防御(旧描述的 buddyUids 保留兼容)。
980
- */
981
- interface BuddyCategory {
982
- categoryId: number;
983
- categorySortId: number;
984
- categroyName: string;
985
- categroyMbCount: number;
986
- onlineCount: number;
987
- buddyUids?: string[];
988
- /** 好友明细(onBuddyListChange 快照,T10 实证)。 */
989
- buddyList?: BuddyListEntry[];
990
- }
991
- /** 好友申请(getBuddyReq 返回的 buddyReqs 成员,说明书参考,待探测校准)。 */
992
- interface BuddyReq {
993
- reqTime: string;
994
- friendUid: string;
995
- friendNick?: string;
996
- sourceId?: number;
997
- sourceName?: string;
998
- [key: string]: unknown;
999
- }
1000
- /** 可疑好友申请(getDoubtBuddyReq 返回的 doubtList 成员,说明书参考)。 */
1001
- interface DoubtBuddyReq {
1002
- uid: string;
1003
- nick?: string;
1004
- source?: string;
1005
- reason?: string;
1006
- msg?: string;
1007
- groupCode?: string;
1008
- reqTime?: string;
1009
- [key: string]: unknown;
1010
- }
1011
- /** 好友服务:apis/friend 用到的核心方法面。 */
1012
- interface NodeIKernelBuddyService {
1013
- addKernelBuddyListener(listener: unknown): number;
1014
- removeKernelBuddyListener(listenerId: number): void;
1015
- getBuddyListV2(callFrom: string, isPullRefresh: boolean, reqType: number): Promise<GeneralCallResult & {
1016
- data: BuddyCategory[];
1017
- }>;
1018
- getBuddyListFromCache(reqType: number): Promise<BuddyCategory[]>;
1019
- getBuddyNick(uid: string): string;
1020
- getBuddyRemark(uid: string): string;
1021
- isBuddy(uid: string): boolean;
1022
- /** 好友申请列表(set_friend_add_request 应答前查找匹配项)。 */
1023
- getBuddyReq(): Promise<GeneralCallResult & {
1024
- buddyReqs?: BuddyReq[];
1025
- }>;
1026
- /** 同意/拒绝加好友请求(set_friend_add_request)。 */
1027
- approvalFriendRequest(arg: {
1028
- friendUid: string;
1029
- reqTime: string;
1030
- accept: boolean;
1031
- }): Promise<void>;
1032
- /** 设置好友备注(set_friend_remark;void 语义乐观处理)。 */
1033
- setBuddyRemark(param: {
1034
- uid: string;
1035
- remark: string;
1036
- }): void;
1037
- /** 删除好友(delete_friend)。 */
1038
- delBuddy(param: {
1039
- friendUid: string;
1040
- tempBlock: boolean;
1041
- tempBothDel: boolean;
1042
- }): Promise<unknown>;
1043
- /** 可疑好友申请列表(get_doubt_friends_add_request;reqId 作回执匹配)。 */
1044
- getDoubtBuddyReq(reqId: string, num: number, uk: string): Promise<GeneralCallResult & {
1045
- doubtList?: DoubtBuddyReq[];
1046
- }>;
1047
- /** 处理可疑好友申请(set_doubt_friends_add_request;str1/str2 语义未知,传空串)。 */
1048
- approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
1049
- }
1050
- /**
1051
- * NodeIKernelProfileLikeService:资料点赞服务接口面(自研描述,非移植)
1052
- *
1053
- * 依据:运行时反射 + wrapper 外部契约(接口签名是 QQ 的外部事实,自研描述其形状,
1054
- * 零复制实现)。
1055
- * (接口签名是外部系统的事实,我们自研描述其形状,零复制实现)。
1056
- * 只收录 apis/profile-like 需要的方法;其余按需探测后补齐。
1057
- */
1058
- /** 点赞返回(setBuddyProfileLike,说明书参考)。 */
1059
- interface BuddyProfileLikeResult {
1060
- result: number;
1061
- errMsg: string;
1062
- succCounts: number;
1063
- }
1064
- /** 资料点赞服务。 */
1065
- interface NodeIKernelProfileLikeService {
1066
- addKernelProfileLikeListener(listener: unknown): number;
1067
- removeKernelProfileLikeListener(listenerId: number): void;
1068
- /** 点赞(send_like;sourceId=71 赞来源,doLikeCount 次数)。 */
1069
- setBuddyProfileLike(arg: {
1070
- friendUid: string;
1071
- sourceId: number;
1072
- doLikeCount: number;
1073
- doLikeTollCount: number;
1074
- }): Promise<BuddyProfileLikeResult>;
1075
- isNull(): boolean;
835
+ /** 资料点赞服务。 */
836
+ interface NodeIKernelProfileLikeService {
837
+ addKernelProfileLikeListener(listener: unknown): number;
838
+ removeKernelProfileLikeListener(listenerId: number): void;
839
+ /** 点赞(send_like;sourceId=71 赞来源,doLikeCount 次数)。 */
840
+ setBuddyProfileLike(arg: {
841
+ friendUid: string;
842
+ sourceId: number;
843
+ doLikeCount: number;
844
+ doLikeTollCount: number;
845
+ }): Promise<BuddyProfileLikeResult>;
846
+ isNull(): boolean;
1076
847
  }
1077
848
  /** 用户详情(getUserDetailInfoByUin / getUserDetailInfo 返回,宽松自研描述,待探测校准)。 */
1078
849
  interface UserDetailInfoByUin {
@@ -1123,6 +894,38 @@ interface NodeIKernelProfileService {
1123
894
  getUserDetailInfo(uid: string): Promise<UserDetailInfoByUin>;
1124
895
  isNull(): boolean;
1125
896
  }
897
+ /** 会话联系人(getRecentContactList 项,说明书参考,待探测校准)。 */
898
+ interface RecentContact {
899
+ /** 会话 id(群场景 = 群号,好友场景 = uid)。 */
900
+ peerUid: string;
901
+ /** 会话类型(ChatType 值域)。 */
902
+ chatType: number;
903
+ /** 置顶标记(get_peer_pins 数据源;listener 实测字段名为 topFlag,1 = 置顶)。 */
904
+ topFlag?: number;
905
+ /** 置顶标记(布尔别名形态,兼容探测取值)。 */
906
+ isTop?: boolean;
907
+ /** 置顶时间(topFlag=1 时携带;2026-11-01 置顶实验实证为秒级 unix 字符串)。 */
908
+ topFlagTime?: string;
909
+ /** 对端 uin(部分返回形态带)。 */
910
+ peerUin?: string;
911
+ [key: string]: unknown;
912
+ }
913
+ /** 会话列表拉取参数(getRecentContactList,字段值待探测校准)。 */
914
+ interface RecentContactFetchParam {
915
+ /** 拉取条数(缺省覆盖置顶集合足够大)。 */
916
+ count: number;
917
+ }
918
+ /** 会话列表服务:apis/recent-contact 与 RecentContactBridge 用到的核心方法面。 */
919
+ interface NodeIKernelRecentContactService {
920
+ /** 会话列表(get_peer_pins 数据源;返回形状待探测校准)。 */
921
+ getRecentContactList(param: RecentContactFetchParam): Promise<GeneralCallResult & {
922
+ result?: unknown;
923
+ }>;
924
+ /** 注册会话列表监听(RecentContactBridge;录制实证方法名,listener 为普通 JS 对象)。 */
925
+ addKernelRecentContactListener(listener: unknown): number;
926
+ /** 注销会话列表监听。 */
927
+ removeKernelRecentContactListener(listenerId: number): void;
928
+ }
1126
929
  /** 群文件列表参数(getGroupFileList,说明书参考)。 */
1127
930
  interface GetFileListParam {
1128
931
  sortType: number;
@@ -1211,6 +1014,213 @@ interface NodeIKernelTicketService {
1211
1014
  forceFetchClientKey(arg: string): Promise<ForceFetchClientKeyRetType>;
1212
1015
  isNull(): boolean;
1213
1016
  }
1017
+ /** 群列表更新类型(说明书参考,值待探测校准)。 */
1018
+ export declare const GroupListUpdateType: {
1019
+ /** 全量更新(groupList 为完整列表)。 */
1020
+ readonly ALL: 0;
1021
+ /** 增量更新(合并到现有缓存)。 */
1022
+ readonly PARTIAL: 1;
1023
+ };
1024
+ export type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
1025
+ /** 成员数据来源(onMemberInfoChange 第二参,说明书参考)。 */
1026
+ declare const GroupMemberDataSource: {
1027
+ /** 本地缓存。 */
1028
+ readonly CACHE: 0;
1029
+ /** 网络拉取。 */
1030
+ readonly NETWORK: 1;
1031
+ };
1032
+ type GroupMemberDataSource = (typeof GroupMemberDataSource)[keyof typeof GroupMemberDataSource];
1033
+ /** onMemberListChange 参数(sceneId 为群号 groupCode)。 */
1034
+ interface GroupMemberListChange {
1035
+ sceneId: string;
1036
+ ids: string[];
1037
+ /** uid → GroupMember。 */
1038
+ infos: Map<string, GroupMember>;
1039
+ hasPrev: boolean;
1040
+ hasNext: boolean;
1041
+ hasRobot: boolean;
1042
+ }
1043
+ /** 群服务(GroupService)的原生回调监听接口。 */
1044
+ type GroupListener = {
1045
+ /** 群列表初始化完成(listEmpty:是否无群)。 */
1046
+ onGroupListInited: (listEmpty: boolean) => void;
1047
+ /** 群列表更新。 */
1048
+ onGroupListUpdate: (updateType: GroupListUpdateType, groupList: Group[]) => void;
1049
+ /** 群详情变化。 */
1050
+ onGroupDetailInfoChange: (detailInfo: GroupDetailInfo) => void;
1051
+ /** 群成员列表变化(sceneId=groupCode)。 */
1052
+ onMemberListChange: (arg: GroupMemberListChange) => void;
1053
+ /** 群成员信息变化(dataSource 区分本地缓存/网络)。 */
1054
+ onMemberInfoChange: (groupCode: string, dataSource: GroupMemberDataSource, members: Map<string, GroupMember>) => void;
1055
+ /** 群通知更新(doubt:是否可疑/忽略列表)。 */
1056
+ onGroupNotifiesUpdated: (doubt: boolean, notifies: GroupNotify[]) => void;
1057
+ /** 群通知单屏(分页 seq)。 */
1058
+ onGroupSingleScreenNotifies: (doubt: boolean, seq: string, notifies: GroupNotify[]) => void;
1059
+ /** 群禁言成员列表变化。 */
1060
+ onShutUpMemberListChanged: (groupCode: string, members: ShutUpGroupMember[]) => void;
1061
+ /**
1062
+ * 群精华列表变化(OB11 group_essence 候选源,2026-09-10 接线)。
1063
+ * 证据:wrapper.node 9.9.33-52230 字符串——小写名位于 listener 反射字符串簇,
1064
+ * 与已知 onMemberListChange/onBuddyReqChange 交错(同一字符串表页);
1065
+ * API 族旁证 addGroupEssence/getGroupLatestEssenceList。
1066
+ * ⚠️ 参数形状待真实事件校准(unknown 透传,订阅方 raw 日志观测)。
1067
+ */
1068
+ onGroupEssenceListChange: (arg: unknown) => void;
1069
+ };
1070
+ /**
1071
+ * 登录状态监听转发面(LoginBridge 通道类型,2026-11-01 批次三)
1072
+ *
1073
+ * ⚠️ 参数形状零样本(三轮录制无下线操作)——...args unknown 透传,订阅方
1074
+ * 防御性收窄 + 校准日志。原生完整回调面见 types/wrapper.ts KernelLoginListener
1075
+ * (二进制字符串提取产物);本类型只收 bot_offline 候选的两个回调。
1076
+ * 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
1077
+ * 约束;方法必须必选(optional 会破坏事件通道的 Extract 推导)。
1078
+ */
1079
+ type LoginListener = {
1080
+ /** 连接断开(bot_offline 候选源;被踢/掉线语义待野捕校准)。 */
1081
+ onLoginDisConnected: (...args: unknown[]) => void;
1082
+ /** 登出成功(主动登出路径)。 */
1083
+ onLogoutSucceed: (...args: unknown[]) => void;
1084
+ };
1085
+ /** 消息已读上报(peer + 已读 seq)。 */
1086
+ interface MsgReadReportItem {
1087
+ peer: unknown;
1088
+ readSeq: string;
1089
+ }
1090
+ /** 消息回执(msgId + 已读 seq)。 */
1091
+ interface MsgReceipt {
1092
+ msgId: string;
1093
+ readSeq: string;
1094
+ }
1095
+ /** 消息服务(MsgService)的原生回调监听接口。
1096
+ * 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
1097
+ * 约束——interface 无隐式索引签名不兼容;type 对象类型天然满足。
1098
+ *
1099
+ * ⚠️ 2026-08-07 运行时探测实证(自建宿主,QQ 9.9.33):onRecvMsg 回调参数是
1100
+ * **消息数组**(多条批量推送),非单条 RawMessage——此前单条签名错误(收到数组后
1101
+ * msg.msgId/elements 全 undefined)。信号链:原生回调 → MsgBridge 透传数组 →
1102
+ * 事件通道 → 订阅方遍历处理。 */
1103
+ type MsgListener = {
1104
+ /** 收到新消息(批量数组,运行时实证)。 */
1105
+ onRecvMsg: (msgs: RawMessage[]) => void;
1106
+ /** 消息已读上报。 */
1107
+ onRecvMsgReadReport: (reports: MsgReadReportItem[]) => void;
1108
+ /** 消息回执。 */
1109
+ onRecvMsgReceipt: (receipts: MsgReceipt[]) => void;
1110
+ /** 消息列表更新(含发送状态变化:sendStatus 0=失败 1=发送中 2=成功 3=成功无seq)。
1111
+ * 2026-08-11 补齐:sendMsg 发送结果以此事件为准(NapCat 同款),
1112
+ * sendMsg 返回值 result 可能非 0 但实际发送成功(异步确认)。 */
1113
+ onMsgInfoListUpdate: (msgs: RawMessage[]) => void;
1114
+ /**
1115
+ * 收到离线文件消息(OB11 offline_file 事件源,2026-09-10 接线)。
1116
+ * 证据:wrapper.node 9.9.33-52230 字符串——小写名位于 listener 反射字符串簇
1117
+ * (与 onRecvMsg 同页,offset 差 ~7KB)+ RTTI
1118
+ * `OnRecvOfflineFileMsg@KernelMsgService@wrapper@nt`;API 族旁证
1119
+ * getNewOfflineFileList。2026-11-01 录制实证:参数 = RawMessage 数组
1120
+ * (chatType=1,fileElement 携带 fileUuid/file10MMd5 等)。
1121
+ */
1122
+ onRecvOfflineFileMsg: (msgs: RawMessage[]) => void;
1123
+ /**
1124
+ * 收到文件消息(onRecvOfflineFileMsg 同族;2026-11-01 录制实证:与
1125
+ * onRecvOfflineFileMsg 同载荷(RawMessage 数组)——friend_file_upload
1126
+ * 第二源,订阅方按 msgId 去重)。
1127
+ */
1128
+ onFileMsgCome: (msgs: RawMessage[]) => void;
1129
+ /**
1130
+ * 收到在线文件消息(onRecvOfflineFileMsg 同族,字符串簇相邻;
1131
+ * OB11 无对应通知类型,仅作校准观测)。参数形状待校准。
1132
+ */
1133
+ onRecvOnlineFileMsg: (arg: unknown) => void;
1134
+ /**
1135
+ * 收到系统消息(sys msg 总闸,2026-09-10 接线):群名片/头衔/精华/荣誉等
1136
+ * 系统事件的根载体(二进制 55 个 OnSysMsg* 处理器;另有请求式
1137
+ * registerSysMsgNotification(type, subType, ids, callback) 需 3 参)。
1138
+ * 证据:小写名与 onRecvMsg 相邻(offset 差 ~1.4KB)+ 日志
1139
+ * `OnRecvSysMsg msg_type=0x{:x} sub_type=0x{:x} is_online={}`。
1140
+ * ⚠️ 参数形状待真实事件校准(unknown 透传,订阅方 raw 日志观测)。
1141
+ */
1142
+ onRecvSysMsg: (arg: unknown) => void;
1143
+ };
1144
+ /** 会话列表变更(onRecentContactListChangedVer2 参数项,录制实证形状)。 */
1145
+ interface RecentContactListChanged {
1146
+ /** 列表类别(实测 1/2 两类;翻译侧不依赖,用条目 chatType 判场景)。 */
1147
+ listType?: number;
1148
+ /** 全量排序联系人 id(contactId 空间)。 */
1149
+ sortedContactList?: string[];
1150
+ /** 变更条目(RecentContact 快照,含 topFlag/topFlagTime/chatType)。 */
1151
+ changedList?: RecentContact[];
1152
+ [key: string]: unknown;
1153
+ }
1154
+ /** 会话列表服务(RecentContactService)的原生回调监听接口。 */
1155
+ type RecentContactListener = {
1156
+ /** 会话列表变更(高频:消息活动快照 + 置顶翻转,订阅方按 topFlag 翻转过滤)。 */
1157
+ onRecentContactListChangedVer2: (lists: RecentContactListChanged[]) => void;
1158
+ /** 会话通知(单条快照数组,peerUid 空 / chatType=7 影子条目须过滤)。 */
1159
+ onRecentContactNotification: (contacts: RecentContact[]) => void;
1160
+ };
1161
+ /**
1162
+ * canonical 消息元素模型(协议无关,ADR-008 延伸)
1163
+ *
1164
+ * 描述 QQ 消息的事实结构,是各协议翻译层的公共中间表示。
1165
+ *
1166
+ * 2026-11:运行时转换函数(picLocalCandidates / toCanonicalElements /
1167
+ * toSendElements)已下沉至 `../codec/message-element.ts`——类型层保持纯声明,
1168
+ * 不再 import `node:fs` 与 `../infra/**` 运行时值;本文件末行保留桥接重导出,
1169
+ * 既有导入坐标(含单测)零破坏。
1170
+ */
1171
+ /** 协议无关的规范消息元素。 */
1172
+ type CanonicalElement = {
1173
+ type: "text";
1174
+ text: string;
1175
+ } | {
1176
+ type: "at";
1177
+ target: string;
1178
+ display?: string;
1179
+ } | {
1180
+ type: "image";
1181
+ path: string;
1182
+ url?: string;
1183
+ size?: {
1184
+ width: number;
1185
+ height: number;
1186
+ };
1187
+ } | {
1188
+ type: "face";
1189
+ id: string;
1190
+ } | {
1191
+ type: "voice";
1192
+ path: string;
1193
+ durationMs?: number;
1194
+ url?: string;
1195
+ } | {
1196
+ type: "video";
1197
+ path: string;
1198
+ url?: string;
1199
+ thumbPath?: string;
1200
+ width?: number;
1201
+ height?: number;
1202
+ durationSec?: number;
1203
+ } | {
1204
+ type: "file";
1205
+ path: string;
1206
+ name?: string;
1207
+ size?: number;
1208
+ } | {
1209
+ type: "reply";
1210
+ messageId: string;
1211
+ } | {
1212
+ type: "forward";
1213
+ messageIds: string[];
1214
+ } | {
1215
+ type: "json";
1216
+ raw: unknown;
1217
+ } | {
1218
+ type: "xml";
1219
+ raw: unknown;
1220
+ } | {
1221
+ type: "unknown";
1222
+ raw: unknown;
1223
+ };
1214
1224
  /**
1215
1225
  * wrapper.node 的 NAPI 接口面(自研描述,非移植)
1216
1226
  *
@@ -1425,7 +1435,7 @@ interface NodeIDispatcherAdapter {
1425
1435
  dispatchCallWithJson?(arg: unknown): void;
1426
1436
  }
1427
1437
  /** 登录监听器接口(普通 JS 对象,传给 loginService.addKernelLoginListener)。自研描述。 */
1428
- interface IKernelLoginListener {
1438
+ interface KernelLoginListener {
1429
1439
  onLoginConnected?(...args: unknown[]): void;
1430
1440
  onLoginDisConnected?(...args: unknown[]): void;
1431
1441
  onLoginConnecting?(...args: unknown[]): void;
@@ -1727,6 +1737,54 @@ export declare class NTEventChannel<L extends ListenerShape, Name extends string
1727
1737
  /** 订阅错误通知(监听器抛出的异常 / 其他内部错误)。 */
1728
1738
  onError(handler: (err: unknown) => void): () => void;
1729
1739
  }
1740
+ /** 好友事件通道的固定类型(事件名前缀 "Buddy")。 */
1741
+ type BuddyEventChannel = NTEventChannel<BuddyListener, "Buddy">;
1742
+ /**
1743
+ * 好友事件桥:注册原生监听 → 回调 emit 到 channel。
1744
+ * 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
1745
+ */
1746
+ export declare class FriendBridge {
1747
+ private readonly service;
1748
+ private readonly channel;
1749
+ private listenerId;
1750
+ constructor(session: NodeIQQNTWrapperSession, channel: BuddyEventChannel);
1751
+ /** 注册原生监听(幂等)。 */
1752
+ register(): void;
1753
+ /** 注销原生监听(幂等)。 */
1754
+ unregister(): void;
1755
+ }
1756
+ /** 群事件通道的固定类型(事件名前缀 "Group")。 */
1757
+ type GroupEventChannel = NTEventChannel<GroupListener, "Group">;
1758
+ /**
1759
+ * 群事件桥:注册原生监听 → 回调 emit 到 channel。
1760
+ * 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
1761
+ */
1762
+ export declare class GroupBridge {
1763
+ private readonly service;
1764
+ private readonly channel;
1765
+ private listenerId;
1766
+ constructor(session: NodeIQQNTWrapperSession, channel: GroupEventChannel);
1767
+ /** 注册原生监听(幂等)。 */
1768
+ register(): void;
1769
+ /** 注销原生监听(幂等)。 */
1770
+ unregister(): void;
1771
+ }
1772
+ /** 登录事件通道的固定类型(事件名前缀 "Login")。 */
1773
+ type LoginEventChannel = NTEventChannel<LoginListener, "Login">;
1774
+ /**
1775
+ * 登录事件桥:注册原生监听 → 回调 emit 到 channel。
1776
+ * 无全局单例(ADR-015 推论)——每进程一份。
1777
+ */
1778
+ export declare class LoginBridge {
1779
+ private readonly service;
1780
+ private readonly channel;
1781
+ private listenerId;
1782
+ constructor(loginService: unknown, channel: LoginEventChannel);
1783
+ /** 注册原生监听(幂等)。 */
1784
+ register(): void;
1785
+ /** 注销原生监听(幂等)。 */
1786
+ unregister(): void;
1787
+ }
1730
1788
  /** 消息事件通道的固定类型(事件名前缀 "Msg")。 */
1731
1789
  type MsgEventChannel = NTEventChannel<MsgListener, "Msg">;
1732
1790
  /**
@@ -1749,6 +1807,22 @@ export declare class MsgBridge {
1749
1807
  /** 注销原生监听(幂等)。 */
1750
1808
  unregister(): void;
1751
1809
  }
1810
+ /** 会话列表事件通道的固定类型(事件名前缀 "RecentContact")。 */
1811
+ type RecentContactEventChannel = NTEventChannel<RecentContactListener, "RecentContact">;
1812
+ /**
1813
+ * 会话列表事件桥:注册原生监听 → 回调 emit 到 channel。
1814
+ * 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
1815
+ */
1816
+ export declare class RecentContactBridge {
1817
+ private readonly service;
1818
+ private readonly channel;
1819
+ private listenerId;
1820
+ constructor(session: NodeIQQNTWrapperSession, channel: RecentContactEventChannel);
1821
+ /** 注册原生监听(幂等)。 */
1822
+ register(): void;
1823
+ /** 注销原生监听(幂等)。 */
1824
+ unregister(): void;
1825
+ }
1752
1826
  /** 消息 API:从 session 拿 msg service,包装成语义化方法。 */
1753
1827
  export declare class MsgApi {
1754
1828
  private readonly service;
@@ -1940,6 +2014,15 @@ export declare class ProfileApi {
1940
2014
  setHeader(filePath: string): Promise<void>;
1941
2015
  /** 获取陌生人信息(get_stranger_info;uin 为用户 QQ 号)。 */
1942
2016
  getStrangerInfo(uin: string): Promise<StrangerInfo>;
2017
+ /**
2018
+ * uid → uin(弱身份兜底;issue #122)。
2019
+ *
2020
+ * `GroupApi.uidToUin` 走群成员口径(getUinByUids),好友申请 / 陌生人这类不在任何群
2021
+ * 的 uid 必然解析失败,此处用资料详情反查 `detail.uin`。查不到返回 `null`(不抛错:
2022
+ * 「可能没有值」的读操作,调用方 fail-soft);`detail.uin` 未经真实样本确认,见
2023
+ * docs/design.md「已知边界」。
2024
+ */
2025
+ getUinByUid(uid: string): Promise<string | null>;
1943
2026
  }
1944
2027
  /** 点赞 API:从 session 拿 profile like service,包装成语义化方法。 */
1945
2028
  export declare class ProfileLikeApi {
@@ -2076,70 +2159,6 @@ export declare class WebApi {
2076
2159
  /** 拉取单类荣誉列表(honorlist 接口,正则提取 __INITIAL_STATE__)。 */
2077
2160
  private fetchHonorList;
2078
2161
  }
2079
- /** 好友事件通道的固定类型(事件名前缀 "Buddy")。 */
2080
- type BuddyEventChannel = NTEventChannel<BuddyListener, "Buddy">;
2081
- /**
2082
- * 好友事件桥:注册原生监听 → 回调 emit 到 channel。
2083
- * 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
2084
- */
2085
- export declare class FriendBridge {
2086
- private readonly service;
2087
- private readonly channel;
2088
- private listenerId;
2089
- constructor(session: NodeIQQNTWrapperSession, channel: BuddyEventChannel);
2090
- /** 注册原生监听(幂等)。 */
2091
- register(): void;
2092
- /** 注销原生监听(幂等)。 */
2093
- unregister(): void;
2094
- }
2095
- /** 群事件通道的固定类型(事件名前缀 "Group")。 */
2096
- type GroupEventChannel = NTEventChannel<GroupListener, "Group">;
2097
- /**
2098
- * 群事件桥:注册原生监听 → 回调 emit 到 channel。
2099
- * 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
2100
- */
2101
- export declare class GroupBridge {
2102
- private readonly service;
2103
- private readonly channel;
2104
- private listenerId;
2105
- constructor(session: NodeIQQNTWrapperSession, channel: GroupEventChannel);
2106
- /** 注册原生监听(幂等)。 */
2107
- register(): void;
2108
- /** 注销原生监听(幂等)。 */
2109
- unregister(): void;
2110
- }
2111
- /** 登录事件通道的固定类型(事件名前缀 "Login")。 */
2112
- type LoginEventChannel = NTEventChannel<LoginListener, "Login">;
2113
- /**
2114
- * 登录事件桥:注册原生监听 → 回调 emit 到 channel。
2115
- * 无全局单例(ADR-015 推论)——每进程一份。
2116
- */
2117
- export declare class LoginBridge {
2118
- private readonly service;
2119
- private readonly channel;
2120
- private listenerId;
2121
- constructor(loginService: unknown, channel: LoginEventChannel);
2122
- /** 注册原生监听(幂等)。 */
2123
- register(): void;
2124
- /** 注销原生监听(幂等)。 */
2125
- unregister(): void;
2126
- }
2127
- /** 会话列表事件通道的固定类型(事件名前缀 "RecentContact")。 */
2128
- type RecentContactEventChannel = NTEventChannel<RecentContactListener, "RecentContact">;
2129
- /**
2130
- * 会话列表事件桥:注册原生监听 → 回调 emit 到 channel。
2131
- * 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
2132
- */
2133
- export declare class RecentContactBridge {
2134
- private readonly service;
2135
- private readonly channel;
2136
- private listenerId;
2137
- constructor(session: NodeIQQNTWrapperSession, channel: RecentContactEventChannel);
2138
- /** 注册原生监听(幂等)。 */
2139
- register(): void;
2140
- /** 注销原生监听(幂等)。 */
2141
- unregister(): void;
2142
- }
2143
2162
  /** BuddyCache diff 事件 listener(归一化「新增/删除」事件)。 */
2144
2163
  type BuddyCacheListener = {
2145
2164
  onBuddyAdded: (entry: BuddyListEntry) => void;
@@ -2348,6 +2367,8 @@ export declare class KernelError extends Error {
2348
2367
  export declare function kernelError(message: string, code?: KernelErrorCode, options?: ErrorOptions): KernelError;
2349
2368
  /** 类型守卫:协议层 catch 统一映射时区分 KernelError 与意外错误。 */
2350
2369
  export declare function isKernelError(err: unknown): err is KernelError;
2370
+ /** 提取未知异常的文本消息(Error 取 message,其余转字符串)。 */
2371
+ export declare function errorMessage(err: unknown): string;
2351
2372
  /**
2352
2373
  * 配置校验失败(INVALID_PARAM 子型,2026-10-25 嵌入式宿主契约):仅用于
2353
2374
  * 「配置未就绪」一族——主配置校验/反序列化、内联配置、协议段 seed 校验。
@@ -2364,46 +2385,6 @@ export declare function configError(message: string, options?: ErrorOptions): Co
2364
2385
  export declare const EXIT_CONFIG_INVALID = 78;
2365
2386
  /** 日志级别(pino 标准级别 + silent)。 */
2366
2387
  type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
2367
- /**
2368
- * 可选属性统一带 `| undefined`(2026-10-25):exactOptionalPropertyTypes 下
2369
- * 纯直传调用点(装配层透传 LogConfig 字段)可写 `format: cfg.format` 一类
2370
- * 直赋值,免去逐字段条件展开(展开链是复杂度热点)。
2371
- */
2372
- type Optional<T> = T | undefined;
2373
- interface LoggerOptions {
2374
- /** 控制台级别,默认 `info`。 */
2375
- level?: Optional<LogLevel>;
2376
- /** 是否输出到 console,默认 true。 */
2377
- console?: Optional<boolean>;
2378
- /** 文件日志路径;不传则不写文件(父目录自动创建)。 */
2379
- file?: Optional<string>;
2380
- /** 文件目的地级别(缺省同 level;可低于控制台级别保留排查信息)。 */
2381
- fileLevel?: Optional<LogLevel>;
2382
- /**
2383
- * 输出格式,默认按 TTY 自动:TTY = pretty(终端体验不变)/ pipe = single-line
2384
- * (嵌入式逐行转发友好)。显式指定后不受 TTY 影响。
2385
- */
2386
- format?: Optional<LogFormat>;
2387
- /** 时间戳渲染模式(local/iso8601/elapsed),默认 local。 */
2388
- timestamp?: Optional<TimestampMode>;
2389
- /** 控制台颜色(缺省自动:pretty 且 TTY 才着色)。 */
2390
- colorize?: Optional<boolean>;
2391
- /** 控制台目的地(缺省 process.stdout;测试注入用)。 */
2392
- destination?: Optional<NodeJS.WriteStream>;
2393
- /** 附加基础字段(如 `{ name: 'kernel' }`),自动保留 pid;name 用 pino 保留字段
2394
- * (logger name),pretty 渲染为 `(name/pid)` 元数据头。 */
2395
- base?: Optional<Record<string, unknown>>;
2396
- /** 追加的敏感字段路径(默认内置 token/票据等,见 DEFAULT_REDACT_PATHS)。 */
2397
- redact?: string[];
2398
- }
2399
- /**
2400
- * 创建 pino logger:console(pretty/single-line/json)+ 可选文件,统一 level / redact。
2401
- *
2402
- * 文件目的地用同步写入(`sync: true`):日志量级下性能可接受,且进程退出不丢日志,
2403
- * 无需额外的 flush 步骤(对比异步 SonicBoom 的 flushSync 时序陷阱)。
2404
- * 文件目的地恒为 JSON 行(数值时间戳),格式/时间戳渲染仅作用于控制台目的地。
2405
- */
2406
- export declare function createLogger(opts?: LoggerOptions): pino.Logger;
2407
2388
  /** 控制台输出格式。 */
2408
2389
  type LogFormat = "pretty" | "single-line" | "json";
2409
2390
  /** 时间戳渲染模式(见 LogConfig.timestamp)。 */
@@ -2452,6 +2433,46 @@ type LogEnvSource = Record<string, string | undefined>;
2452
2433
  * @param env 环境变量快照(默认空对象 = 无 env 覆盖)
2453
2434
  */
2454
2435
  export declare function parseLogConfig(section: unknown, env?: LogEnvSource): LogConfig;
2436
+ /**
2437
+ * 可选属性统一带 `| undefined`(2026-10-25):exactOptionalPropertyTypes 下
2438
+ * 纯直传调用点(装配层透传 LogConfig 字段)可写 `format: cfg.format` 一类
2439
+ * 直赋值,免去逐字段条件展开(展开链是复杂度热点)。
2440
+ */
2441
+ type Optional<T> = T | undefined;
2442
+ interface LoggerOptions {
2443
+ /** 控制台级别,默认 `info`。 */
2444
+ level?: Optional<LogLevel>;
2445
+ /** 是否输出到 console,默认 true。 */
2446
+ console?: Optional<boolean>;
2447
+ /** 文件日志路径;不传则不写文件(父目录自动创建)。 */
2448
+ file?: Optional<string>;
2449
+ /** 文件目的地级别(缺省同 level;可低于控制台级别保留排查信息)。 */
2450
+ fileLevel?: Optional<LogLevel>;
2451
+ /**
2452
+ * 输出格式,默认按 TTY 自动:TTY = pretty(终端体验不变)/ pipe = single-line
2453
+ * (嵌入式逐行转发友好)。显式指定后不受 TTY 影响。
2454
+ */
2455
+ format?: Optional<LogFormat>;
2456
+ /** 时间戳渲染模式(local/iso8601/elapsed),默认 local。 */
2457
+ timestamp?: Optional<TimestampMode>;
2458
+ /** 控制台颜色(缺省自动:pretty 且 TTY 才着色)。 */
2459
+ colorize?: Optional<boolean>;
2460
+ /** 控制台目的地(缺省 process.stdout;测试注入用)。 */
2461
+ destination?: Optional<NodeJS.WriteStream>;
2462
+ /** 附加基础字段(如 `{ name: 'kernel' }`),自动保留 pid;name 用 pino 保留字段
2463
+ * (logger name),pretty 渲染为 `(name/pid)` 元数据头。 */
2464
+ base?: Optional<Record<string, unknown>>;
2465
+ /** 追加的敏感字段路径(默认内置 token/票据等,见 DEFAULT_REDACT_PATHS)。 */
2466
+ redact?: string[];
2467
+ }
2468
+ /**
2469
+ * 创建 pino logger:console(pretty/single-line/json)+ 可选文件,统一 level / redact。
2470
+ *
2471
+ * 文件目的地用同步写入(`sync: true`):日志量级下性能可接受,且进程退出不丢日志,
2472
+ * 无需额外的 flush 步骤(对比异步 SonicBoom 的 flushSync 时序陷阱)。
2473
+ * 文件目的地恒为 JSON 行(数值时间戳),格式/时间戳渲染仅作用于控制台目的地。
2474
+ */
2475
+ export declare function createLogger(opts?: LoggerOptions): pino.Logger;
2455
2476
  /** 默认数据根目录名(项目根下,2026-08-08 用户拍板:不放用户目录)。 */
2456
2477
  export declare const DEFAULT_DATA_ROOT_NAME = ".napuketto";
2457
2478
  /** 全局配置文件名。 */
@@ -2539,10 +2560,12 @@ interface QqDataRootOptions {
2539
2560
  */
2540
2561
  export declare function resolveQqUserDataRoot(exports: WrapperNodeApi, opts?: QqDataRootOptions): string | null;
2541
2562
  /** QQ 版本信息(登录握手用)。 */
2542
- interface QQVersionContext {
2563
+ interface QqVersionContext {
2543
2564
  fullVersion: string;
2544
2565
  buildVersion: string;
2545
2566
  }
2567
+ /** @deprecated 使用 `QqVersionContext`(缩写大小写统一为 `Qq`)。 */
2568
+ type QQVersionContext = QqVersionContext;
2546
2569
  /** 已引导的 wrapper 上下文(运行在 QQ Electron 主进程内)。 */
2547
2570
  interface WrapperContext {
2548
2571
  /** wrapper.node 的 NAPI 顶层导出。 */
@@ -2550,7 +2573,7 @@ interface WrapperContext {
2550
2573
  /** engine 单例(get() 已调用)。 */
2551
2574
  engine: NodeIQQNTWrapperEngine;
2552
2575
  /** 版本信息(供登录握手等使用)。 */
2553
- versionInfo: QQVersionContext;
2576
+ versionInfo: QqVersionContext;
2554
2577
  /** 会话(QQ 拦截捕获 / createSession 后填充)。 */
2555
2578
  session: NodeIQQNTWrapperSession | null;
2556
2579
  /** 启动会话包装(NapCat 同款:StartupSessionWrapper.create(),start() 替代 startNT)。 */
@@ -2562,7 +2585,7 @@ interface WrapperContext {
2562
2585
  * 从 loader 截获的 NAPI exports 创建 wrapper 上下文。
2563
2586
  * 在 QQ 主进程内调用(boot.cjs → kernel 入口)。
2564
2587
  */
2565
- export declare function createWrapper(exports: WrapperNodeApi, versionInfo: QQVersionContext): WrapperContext;
2588
+ export declare function createWrapper(exports: WrapperNodeApi, versionInfo: QqVersionContext): WrapperContext;
2566
2589
  /** engine 初始化(wrapper 契约:先 engine 后 session)。config 为普通 JS 对象。 */
2567
2590
  export declare function initEngine(ctx: WrapperContext, config: EnginInitDesktopConfig): void;
2568
2591
  /**
@@ -2628,6 +2651,25 @@ interface StartNapukettoOptions {
2628
2651
  /** QQ 的 loginService 实例(boot.cjs 拦截 new 捕获)。 */
2629
2652
  qqLoginService?: unknown;
2630
2653
  }
2654
+ /**
2655
+ * 加载 wrapper.node 原生模块并校验核心导出(自建宿主引导原语,2026-11 从
2656
+ * loader self-host.ts 下沉:原生 `dlopen` 是 kernel 的唯一原生层职责,loader
2657
+ * 只编排流程)。
2658
+ *
2659
+ * @param wrapperPath wrapper.node 绝对路径(QQ 安装目录 / 缓存文件根)
2660
+ * @returns NAPI exports(含 NodeIKernelLoginService 等构造器)
2661
+ * @throws KernelError exports 缺 NodeIKernelLoginService(stub 环境异常)或 dlopen 失败
2662
+ */
2663
+ export declare function dlopenWrapper(wrapperPath: string): Record<string, unknown>;
2664
+ /**
2665
+ * 激活自建宿主 O3MiscService 事件分发(三要素之二,V6 实测决定性):
2666
+ * 不激活则 getLoginList 永不 resolve(挂起)。listener 用普通对象
2667
+ * (getOnAmgomDataPiece 空实现,wrapper 契约回调)。
2668
+ *
2669
+ * @param wrapperExports dlopen 产出的 exports(缺失/版本变化时返回 false)
2670
+ * @returns 是否成功激活
2671
+ */
2672
+ export declare function activateO3MiscService(wrapperExports: Record<string, unknown> | undefined): boolean;
2631
2673
  /** 登录结果(QR 或快速登录)。 */
2632
2674
  interface LoginResult {
2633
2675
  uin: string;
@@ -2978,7 +3020,7 @@ interface SessionListenerOptions {
2978
3020
  */
2979
3021
  export declare function createSessionListener(opts?: SessionListenerOptions): NodeIKernelSessionListener;
2980
3022
  /** 创建登录监听器(占位,登录器接入时填充)。 */
2981
- export declare function createLoginListener(): IKernelLoginListener;
3023
+ export declare function createLoginListener(): KernelLoginListener;
2982
3024
  /**
2983
3025
  * 从 major.node 提取 appid(NapCat parseAppidFromMajorV2 的自研等价实现)。
2984
3026
  * major.node 含 `QQAppId/` 标记后跟数字(腾讯工具链产物,实测确认)。
@@ -3042,7 +3084,7 @@ export declare function resolveQQVersion(installDir: string, version: string): Q
3042
3084
  /** 扫描 versions 目录,取可加载的版本列表(按目录名倒序,最新在前)。 */
3043
3085
  export declare function listQQVersions(installDir: string): string[];
3044
3086
  /** QQ 版本信息。 */
3045
- interface QQVersionInfo {
3087
+ interface QqVersionInfo {
3046
3088
  /** 完整版本号,如 "9.9.31-49919"。 */
3047
3089
  fullVersion: string;
3048
3090
  /** 构建号,如 "49919"。 */
@@ -3054,5 +3096,7 @@ interface QQVersionInfo {
3054
3096
  /** 登录握手参数(P1 探测脚本产出,暂为空串)。 */
3055
3097
  qua: string;
3056
3098
  }
3057
- export { type BootEnv, type BuddyCacheEventChannel, type BuddyCacheListener, type BuddyCacheOptions, type BuddyCategory, type BuddyCoreInfo, type BuddyEventChannel, type BuddyListEntry, type BuddyListener, type BuddyReq, type CanonicalElement, type ConfigFormat, type ConfigOptions, type ConfigSchema, type CoreContext, type CoreContextOptions, type CoreLoginOptions, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, type EnginInitDesktopConfig, type EssenceMsgItem, type FlashTransferUploadOptions, type FlashTransferUploadResult, type ForceFetchClientKeyRetType, type Friend, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, type Group, type GroupBulletin, type GroupCacheOptions, type GroupDetailInfo, type GroupEventChannel, type GroupFileItemInfo, type GroupFolderInfo, type GroupHonorWebInfo, type GroupListener, type GroupMember, type GroupMemberDataSource, type GroupMemberListChange, type GroupNotify, type GroupSpaceInfo, type HonorListItem, type KernelErrorCode, type ListenerEvents, type ListenerRecordEvent, type ListenerRecordingResult, type LogConfig, type LogEnvSource, type LogFileConfig, type LogFormat, type LogLevel, type LogModuleName, type LoggerOptions, type LoginAccountInfo, type LoginEventChannel, type LoginListItem, type LoginProgress, type LoginResult, type LoginState, type MsgEventChannel, type MsgListener, type NapukettoCoreOptions, type NodeIDependsAdapter, type NodeIDispatcherAdapter, type NodeIGlobalAdapter, type NodeIKernelBuddyService, type NodeIKernelGroupService, type NodeIKernelLoginService, type NodeIKernelMsgService, type NodeIKernelProfileLikeService, type NodeIKernelProfileService, type NodeIKernelRecentContactService, type NodeIKernelRichMediaService, type NodeIKernelSessionListener, type NodeIKernelTicketService, type NodeIQQNTStartupSessionWrapper, type NodeIQQNTWrapperEngine, type NodeIQQNTWrapperSession, type NodeQQNTWrapperUtil, type NudgeParam, type PathOptions, type Peer, type PinnedContact, type PlatformType, type QQVersionContext, type QQVersionInfo, type QrCodeData, type RDeliveryConfig, type RawElement, type RawMessage, type RecentContact, type RecentContactEventChannel, type RecentContactFetchParam, type RecentContactListChanged, type RecentContactListener, type SelfInfo, type SendMessageElement, type SessionConfigOptions, type ShutUpGroupMember, type StartNapukettoOptions, type StrangerInfo, type TimestampMode, type TipAioOpGrayTipElement, type TipGroupElement, type UserDetailInfoByUin, type VendorType, type WrapperContext, type WrapperNodeApi, type WrapperSessionInitConfig, createSessionListener as createLifecycleSessionListener };
3099
+ /** @deprecated 使用 `QqVersionInfo`(缩写大小写统一为 `Qq`)。 */
3100
+ type QQVersionInfo = QqVersionInfo;
3101
+ export { type BootEnv, type BuddyCacheEventChannel, type BuddyCacheListener, type BuddyCacheOptions, type BuddyCategory, type BuddyCoreInfo, type BuddyEventChannel, type BuddyListEntry, type BuddyListener, type BuddyReq, type CanonicalElement, type ConfigFormat, type ConfigOptions, type ConfigSchema, type CoreContext, type CoreContextOptions, type CoreLoginOptions, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, type EnginInitDesktopConfig, type EssenceMsgItem, type FlashTransferUploadOptions, type FlashTransferUploadResult, type ForceFetchClientKeyRetType, type Friend, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, type Group, type GroupBulletin, type GroupCacheOptions, type GroupDetailInfo, type GroupEventChannel, type GroupFileItemInfo, type GroupFolderInfo, type GroupHonorWebInfo, type GroupListener, type GroupMember, type GroupMemberDataSource, type GroupMemberListChange, type GroupNotify, type GroupSpaceInfo, type HonorListItem, type KernelErrorCode, type ListenerEvents, type ListenerRecordEvent, type ListenerRecordingResult, type LogConfig, type LogEnvSource, type LogFileConfig, type LogFormat, type LogLevel, type LogModuleName, type LoggerOptions, type LoginAccountInfo, type LoginEventChannel, type LoginListItem, type LoginProgress, type LoginResult, type LoginState, type MsgEventChannel, type MsgListener, type NapukettoCoreOptions, type NodeIDependsAdapter, type NodeIDispatcherAdapter, type NodeIGlobalAdapter, type NodeIKernelBuddyService, type NodeIKernelGroupService, type NodeIKernelLoginService, type NodeIKernelMsgService, type NodeIKernelProfileLikeService, type NodeIKernelProfileService, type NodeIKernelRecentContactService, type NodeIKernelRichMediaService, type NodeIKernelSessionListener, type NodeIKernelTicketService, type NodeIQQNTStartupSessionWrapper, type NodeIQQNTWrapperEngine, type NodeIQQNTWrapperSession, type NodeQQNTWrapperUtil, type NudgeParam, type PathOptions, type Peer, type PinnedContact, type PlatformType, type QQVersionContext, type QQVersionInfo, type QqVersionContext, type QqVersionInfo, type QrCodeData, type RDeliveryConfig, type RawElement, type RawMessage, type RecentContact, type RecentContactEventChannel, type RecentContactFetchParam, type RecentContactListChanged, type RecentContactListener, type SelfInfo, type SendMessageElement, type SessionConfigOptions, type ShutUpGroupMember, type StartNapukettoOptions, type StrangerInfo, type TimestampMode, type TipAioOpGrayTipElement, type TipGroupElement, type UserDetailInfoByUin, type VendorType, type WrapperContext, type WrapperNodeApi, type WrapperSessionInitConfig, createSessionListener as createLifecycleSessionListener };
3058
3102
  //# sourceMappingURL=index.d.mts.map