@napuketto/kernel 0.7.3 → 0.9.0
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 +211 -218
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +175 -118
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -17
- package/dist/index.cjs +0 -5551
- package/dist/index.d.cts +0 -2987
- package/dist/index.d.cts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import pino from "pino";
|
|
2
|
-
//#region src/types/entities.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* 实体类型层(运行时探测产物 + 公开资料作说明书,ADR-006)
|
|
5
4
|
*
|
|
@@ -7,14 +6,14 @@ import pino from "pino";
|
|
|
7
6
|
* 探测(probe.ts)校准——接口签名是外部系统事实,自研描述其形状。
|
|
8
7
|
*/
|
|
9
8
|
/** 会话类型(QQ wrapper 外部契约)。 */
|
|
10
|
-
declare const ChatType: {
|
|
9
|
+
export declare const ChatType: {
|
|
11
10
|
readonly C2C: 1;
|
|
12
11
|
readonly GROUP: 2;
|
|
13
12
|
readonly DISC: 3;
|
|
14
13
|
readonly GUILD: 4;
|
|
15
14
|
readonly C2C_TEMP: 100;
|
|
16
15
|
};
|
|
17
|
-
type ChatType = (typeof ChatType)[keyof typeof ChatType];
|
|
16
|
+
export type ChatType = (typeof ChatType)[keyof typeof ChatType];
|
|
18
17
|
/** 会话对象(peer 目标:群号 / 用户 uid)。 */
|
|
19
18
|
interface Peer {
|
|
20
19
|
chatType: ChatType;
|
|
@@ -139,9 +138,21 @@ interface FileElement {
|
|
|
139
138
|
fileName?: string;
|
|
140
139
|
fileSize?: string;
|
|
141
140
|
fileUuid?: string;
|
|
141
|
+
/** 文件 md5(2026-11-01 录制实证:私聊文件消息必带;官方 Milky file_hash 为 TriSHA1,见 milky.md §0.8.6)。 */
|
|
142
|
+
file10MMd5?: string;
|
|
143
|
+
/** 文件 sha1(录制实证:接收侧为空,上传侧携带)。 */
|
|
144
|
+
fileSha?: string;
|
|
145
|
+
/** 文件 sha3(录制实证:接收侧为空)。 */
|
|
146
|
+
fileSha3?: string;
|
|
147
|
+
/** 过期时间(秒级 unix,录制实证)。 */
|
|
148
|
+
expireTime?: number;
|
|
149
|
+
/** 传输状态(录制实证)。 */
|
|
150
|
+
transferStatus?: number;
|
|
151
|
+
/** 文件子类型(录制实证:私聊离线文件 = 9)。 */
|
|
152
|
+
subElementType?: number;
|
|
142
153
|
}
|
|
143
154
|
/** 灰色提示子类型(系统事件类型,QQ wrapper 契约)。 */
|
|
144
|
-
declare const GrayTipSubType: {
|
|
155
|
+
export declare const GrayTipSubType: {
|
|
145
156
|
readonly REVOKE: 1;
|
|
146
157
|
readonly PROCLAMATION: 2;
|
|
147
158
|
readonly GROUP: 4;
|
|
@@ -153,9 +164,9 @@ declare const GrayTipSubType: {
|
|
|
153
164
|
readonly FILE: 10;
|
|
154
165
|
readonly JSON: 17;
|
|
155
166
|
};
|
|
156
|
-
type GrayTipSubType = (typeof GrayTipSubType)[keyof typeof GrayTipSubType];
|
|
167
|
+
export type GrayTipSubType = (typeof GrayTipSubType)[keyof typeof GrayTipSubType];
|
|
157
168
|
/** 群成员变动类型(TipGroupElement.type)。 */
|
|
158
|
-
declare const TipGroupElementType: {
|
|
169
|
+
export declare const TipGroupElementType: {
|
|
159
170
|
readonly MEMBER_ADD: 1;
|
|
160
171
|
readonly DISBANDED: 2;
|
|
161
172
|
readonly QUIT: 3;
|
|
@@ -165,7 +176,7 @@ declare const TipGroupElementType: {
|
|
|
165
176
|
readonly UNBLOCK: 7;
|
|
166
177
|
readonly SHUT_UP: 8;
|
|
167
178
|
};
|
|
168
|
-
type TipGroupElementType = (typeof TipGroupElementType)[keyof typeof TipGroupElementType];
|
|
179
|
+
export type TipGroupElementType = (typeof TipGroupElementType)[keyof typeof TipGroupElementType];
|
|
169
180
|
/** 撤回元素(revokeElement)。 */
|
|
170
181
|
interface GrayTipRevokeElement {
|
|
171
182
|
operatorUid: string;
|
|
@@ -263,13 +274,13 @@ interface RawMessage {
|
|
|
263
274
|
sendMemberName?: string;
|
|
264
275
|
/** 发送状态(0=失败 1=发送中 2=成功 3=成功无seq)。onMsgInfoListUpdate 事件填充。 */
|
|
265
276
|
sendStatus?: number;
|
|
277
|
+
/** 发送方向(2026-11-01 录制实证:文件消息 0=收到 2=自己发出;is_self 判据)。 */
|
|
278
|
+
sendType?: number;
|
|
266
279
|
elements: RawElement[];
|
|
267
280
|
records?: RawMessage[];
|
|
268
281
|
guildId?: string;
|
|
269
282
|
[key: string]: unknown;
|
|
270
283
|
}
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/types/listeners/buddy.d.ts
|
|
273
284
|
/**
|
|
274
285
|
* Buddy 服务(BuddyService)的原生回调监听类型(2026-09-08)。
|
|
275
286
|
*
|
|
@@ -292,15 +303,13 @@ type BuddyListener = {
|
|
|
292
303
|
/** 好友被删除(参数形状待真实事件校准)。 */
|
|
293
304
|
onBuddyDeleted: (arg: unknown) => void;
|
|
294
305
|
};
|
|
295
|
-
//#endregion
|
|
296
|
-
//#region src/types/services/msg-service.d.ts
|
|
297
306
|
/** 原生通用返回:result 非 0 即失败(errMsg 附原因)。 */
|
|
298
307
|
interface GeneralCallResult {
|
|
299
308
|
result: number;
|
|
300
309
|
errMsg: string;
|
|
301
310
|
}
|
|
302
311
|
/** 消息元素类型枚举(QQ wrapper 外部契约,自研描述)。 */
|
|
303
|
-
declare const ElementType: {
|
|
312
|
+
export declare const ElementType: {
|
|
304
313
|
readonly UNKNOWN: 0;
|
|
305
314
|
readonly TEXT: 1;
|
|
306
315
|
readonly PIC: 2;
|
|
@@ -322,7 +331,7 @@ declare const ElementType: {
|
|
|
322
331
|
readonly INTEXT_GIFT: 18;
|
|
323
332
|
readonly CALENDAR: 19;
|
|
324
333
|
};
|
|
325
|
-
type ElementType = (typeof ElementType)[keyof typeof ElementType];
|
|
334
|
+
export type ElementType = (typeof ElementType)[keyof typeof ElementType];
|
|
326
335
|
/** 发送消息元素(session 发送用,elementType + 各子元素互斥)。 */
|
|
327
336
|
interface SendMessageElement {
|
|
328
337
|
elementType: ElementType;
|
|
@@ -433,17 +442,15 @@ interface NodeIKernelMsgService {
|
|
|
433
442
|
emojiInfoList?: unknown;
|
|
434
443
|
}>;
|
|
435
444
|
}
|
|
436
|
-
//#endregion
|
|
437
|
-
//#region src/types/services/group-service.d.ts
|
|
438
445
|
/** 群成员角色(QQ wrapper 契约)。 */
|
|
439
|
-
declare const NTGroupMemberRole: {
|
|
446
|
+
export declare const NTGroupMemberRole: {
|
|
440
447
|
readonly UNSPECIFIED: 0;
|
|
441
448
|
readonly STRANGER: 1;
|
|
442
449
|
readonly MEMBER: 2;
|
|
443
450
|
readonly ADMIN: 3;
|
|
444
451
|
readonly OWNER: 4;
|
|
445
452
|
};
|
|
446
|
-
type NTGroupMemberRole = (typeof NTGroupMemberRole)[keyof typeof NTGroupMemberRole];
|
|
453
|
+
export type NTGroupMemberRole = (typeof NTGroupMemberRole)[keyof typeof NTGroupMemberRole];
|
|
447
454
|
/** 踢人请求项(KickMemberV2Req.kickList 成员,说明书参考,字段值待探测校准)。 */
|
|
448
455
|
interface KickMemberInfo {
|
|
449
456
|
optFlag: number;
|
|
@@ -468,7 +475,7 @@ interface GroupRemainAtTimes {
|
|
|
468
475
|
canNotAtAllMsg: string;
|
|
469
476
|
}
|
|
470
477
|
/** 群通知类型(GroupNotifyMsgType,说明书参考)。 */
|
|
471
|
-
declare const GroupNotifyMsgType: {
|
|
478
|
+
export declare const GroupNotifyMsgType: {
|
|
472
479
|
readonly UN_SPECIFIED: 0;
|
|
473
480
|
readonly INVITED_BY_MEMBER: 1;
|
|
474
481
|
readonly REFUSE_INVITED: 2;
|
|
@@ -486,25 +493,25 @@ declare const GroupNotifyMsgType: {
|
|
|
486
493
|
readonly TRANSFER_GROUP_NOTIFY_OLDOWNER: 14;
|
|
487
494
|
readonly TRANSFER_GROUP_NOTIFY_ADMIN: 15;
|
|
488
495
|
};
|
|
489
|
-
type GroupNotifyMsgType = (typeof GroupNotifyMsgType)[keyof typeof GroupNotifyMsgType];
|
|
496
|
+
export type GroupNotifyMsgType = (typeof GroupNotifyMsgType)[keyof typeof GroupNotifyMsgType];
|
|
490
497
|
/** 群通知处理状态(GroupNotifyMsgStatus,说明书参考)。 */
|
|
491
|
-
declare const GroupNotifyMsgStatus: {
|
|
498
|
+
export declare const GroupNotifyMsgStatus: {
|
|
492
499
|
readonly KINIT: 0;
|
|
493
500
|
readonly KUNHANDLE: 1;
|
|
494
501
|
readonly KAGREED: 2;
|
|
495
502
|
readonly KREFUSED: 3;
|
|
496
503
|
readonly KIGNORED: 4;
|
|
497
504
|
};
|
|
498
|
-
type GroupNotifyMsgStatus = (typeof GroupNotifyMsgStatus)[keyof typeof GroupNotifyMsgStatus];
|
|
505
|
+
export type GroupNotifyMsgStatus = (typeof GroupNotifyMsgStatus)[keyof typeof GroupNotifyMsgStatus];
|
|
499
506
|
/** 群请求操作类型(NTGroupRequestOperateTypes,说明书参考)。 */
|
|
500
|
-
declare const NTGroupRequestOperateTypes: {
|
|
507
|
+
export declare const NTGroupRequestOperateTypes: {
|
|
501
508
|
readonly KUNSPECIFIED: 0;
|
|
502
509
|
readonly KAGREE: 1;
|
|
503
510
|
readonly KREFUSE: 2;
|
|
504
511
|
readonly KIGNORE: 3;
|
|
505
512
|
readonly KDELETE: 4;
|
|
506
513
|
};
|
|
507
|
-
type NTGroupRequestOperateTypes = (typeof NTGroupRequestOperateTypes)[keyof typeof NTGroupRequestOperateTypes];
|
|
514
|
+
export type NTGroupRequestOperateTypes = (typeof NTGroupRequestOperateTypes)[keyof typeof NTGroupRequestOperateTypes];
|
|
508
515
|
/** 群通知(getSingleScreenNotifies 返回项,说明书参考,待探测校准)。 */
|
|
509
516
|
interface GroupNotify {
|
|
510
517
|
seq: string;
|
|
@@ -707,16 +714,14 @@ interface NodeIKernelGroupService {
|
|
|
707
714
|
/** 群头像(set_group_avatar;参数待校准;Profile setHeader 同名方法)。 */
|
|
708
715
|
setHeader(groupCode: string, imagePath: string): Promise<unknown>;
|
|
709
716
|
}
|
|
710
|
-
//#endregion
|
|
711
|
-
//#region src/types/listeners/group.d.ts
|
|
712
717
|
/** 群列表更新类型(说明书参考,值待探测校准)。 */
|
|
713
|
-
declare const GroupListUpdateType: {
|
|
718
|
+
export declare const GroupListUpdateType: {
|
|
714
719
|
/** 全量更新(groupList 为完整列表)。 */
|
|
715
720
|
readonly ALL: 0;
|
|
716
721
|
/** 增量更新(合并到现有缓存)。 */
|
|
717
722
|
readonly PARTIAL: 1;
|
|
718
723
|
};
|
|
719
|
-
type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
|
|
724
|
+
export type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
|
|
720
725
|
/** 成员数据来源(onMemberInfoChange 第二参,说明书参考)。 */
|
|
721
726
|
declare const GroupMemberDataSource: {
|
|
722
727
|
/** 本地缓存。 */
|
|
@@ -762,8 +767,21 @@ type GroupListener = {
|
|
|
762
767
|
*/
|
|
763
768
|
onGroupEssenceListChange: (arg: unknown) => void;
|
|
764
769
|
};
|
|
765
|
-
|
|
766
|
-
|
|
770
|
+
/**
|
|
771
|
+
* 登录状态监听转发面(LoginBridge 通道类型,2026-11-01 批次三)
|
|
772
|
+
*
|
|
773
|
+
* ⚠️ 参数形状零样本(三轮录制无下线操作)——...args unknown 透传,订阅方
|
|
774
|
+
* 防御性收窄 + 校准日志。原生完整回调面见 types/wrapper.ts IKernelLoginListener
|
|
775
|
+
* (二进制字符串提取产物);本类型只收 bot_offline 候选的两个回调。
|
|
776
|
+
* 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
|
|
777
|
+
* 约束;方法必须必选(optional 会破坏事件通道的 Extract 推导)。
|
|
778
|
+
*/
|
|
779
|
+
type LoginListener = {
|
|
780
|
+
/** 连接断开(bot_offline 候选源;被踢/掉线语义待野捕校准)。 */
|
|
781
|
+
onLoginDisConnected: (...args: unknown[]) => void;
|
|
782
|
+
/** 登出成功(主动登出路径)。 */
|
|
783
|
+
onLogoutSucceed: (...args: unknown[]) => void;
|
|
784
|
+
};
|
|
767
785
|
/** 消息已读上报(peer + 已读 seq)。 */
|
|
768
786
|
interface MsgReadReportItem {
|
|
769
787
|
peer: unknown;
|
|
@@ -798,9 +816,16 @@ type MsgListener = {
|
|
|
798
816
|
* 证据:wrapper.node 9.9.33-52230 字符串——小写名位于 listener 反射字符串簇
|
|
799
817
|
* (与 onRecvMsg 同页,offset 差 ~7KB)+ RTTI
|
|
800
818
|
* `OnRecvOfflineFileMsg@KernelMsgService@wrapper@nt`;API 族旁证
|
|
801
|
-
* getNewOfflineFileList
|
|
819
|
+
* getNewOfflineFileList。2026-11-01 录制实证:参数 = RawMessage 数组
|
|
820
|
+
* (chatType=1,fileElement 携带 fileUuid/file10MMd5 等)。
|
|
802
821
|
*/
|
|
803
|
-
onRecvOfflineFileMsg: (
|
|
822
|
+
onRecvOfflineFileMsg: (msgs: RawMessage[]) => void;
|
|
823
|
+
/**
|
|
824
|
+
* 收到文件消息(onRecvOfflineFileMsg 同族;2026-11-01 录制实证:与
|
|
825
|
+
* onRecvOfflineFileMsg 同载荷(RawMessage 数组)——friend_file_upload
|
|
826
|
+
* 第二源,订阅方按 msgId 去重)。
|
|
827
|
+
*/
|
|
828
|
+
onFileMsgCome: (msgs: RawMessage[]) => void;
|
|
804
829
|
/**
|
|
805
830
|
* 收到在线文件消息(onRecvOfflineFileMsg 同族,字符串簇相邻;
|
|
806
831
|
* OB11 无对应通知类型,仅作校准观测)。参数形状待校准。
|
|
@@ -816,12 +841,59 @@ type MsgListener = {
|
|
|
816
841
|
*/
|
|
817
842
|
onRecvSysMsg: (arg: unknown) => void;
|
|
818
843
|
};
|
|
819
|
-
|
|
820
|
-
|
|
844
|
+
/** 会话联系人(getRecentContactList 项,说明书参考,待探测校准)。 */
|
|
845
|
+
interface RecentContact {
|
|
846
|
+
/** 会话 id(群场景 = 群号,好友场景 = uid)。 */
|
|
847
|
+
peerUid: string;
|
|
848
|
+
/** 会话类型(ChatType 值域)。 */
|
|
849
|
+
chatType: number;
|
|
850
|
+
/** 置顶标记(get_peer_pins 数据源;listener 实测字段名为 topFlag,1 = 置顶)。 */
|
|
851
|
+
topFlag?: number;
|
|
852
|
+
/** 置顶标记(布尔别名形态,兼容探测取值)。 */
|
|
853
|
+
isTop?: boolean;
|
|
854
|
+
/** 置顶时间(topFlag=1 时携带;2026-11-01 置顶实验实证为秒级 unix 字符串)。 */
|
|
855
|
+
topFlagTime?: string;
|
|
856
|
+
/** 对端 uin(部分返回形态带)。 */
|
|
857
|
+
peerUin?: string;
|
|
858
|
+
[key: string]: unknown;
|
|
859
|
+
}
|
|
860
|
+
/** 会话列表拉取参数(getRecentContactList,字段值待探测校准)。 */
|
|
861
|
+
interface RecentContactFetchParam {
|
|
862
|
+
/** 拉取条数(缺省覆盖置顶集合足够大)。 */
|
|
863
|
+
count: number;
|
|
864
|
+
}
|
|
865
|
+
/** 会话列表服务:apis/recent-contact 与 RecentContactBridge 用到的核心方法面。 */
|
|
866
|
+
interface NodeIKernelRecentContactService {
|
|
867
|
+
/** 会话列表(get_peer_pins 数据源;返回形状待探测校准)。 */
|
|
868
|
+
getRecentContactList(param: RecentContactFetchParam): Promise<GeneralCallResult & {
|
|
869
|
+
result?: unknown;
|
|
870
|
+
}>;
|
|
871
|
+
/** 注册会话列表监听(RecentContactBridge;录制实证方法名,listener 为普通 JS 对象)。 */
|
|
872
|
+
addKernelRecentContactListener(listener: unknown): number;
|
|
873
|
+
/** 注销会话列表监听。 */
|
|
874
|
+
removeKernelRecentContactListener(listenerId: number): void;
|
|
875
|
+
}
|
|
876
|
+
/** 会话列表变更(onRecentContactListChangedVer2 参数项,录制实证形状)。 */
|
|
877
|
+
interface RecentContactListChanged {
|
|
878
|
+
/** 列表类别(实测 1/2 两类;翻译侧不依赖,用条目 chatType 判场景)。 */
|
|
879
|
+
listType?: number;
|
|
880
|
+
/** 全量排序联系人 id(contactId 空间)。 */
|
|
881
|
+
sortedContactList?: string[];
|
|
882
|
+
/** 变更条目(RecentContact 快照,含 topFlag/topFlagTime/chatType)。 */
|
|
883
|
+
changedList?: RecentContact[];
|
|
884
|
+
[key: string]: unknown;
|
|
885
|
+
}
|
|
886
|
+
/** 会话列表服务(RecentContactService)的原生回调监听接口。 */
|
|
887
|
+
type RecentContactListener = {
|
|
888
|
+
/** 会话列表变更(高频:消息活动快照 + 置顶翻转,订阅方按 topFlag 翻转过滤)。 */
|
|
889
|
+
onRecentContactListChangedVer2: (lists: RecentContactListChanged[]) => void;
|
|
890
|
+
/** 会话通知(单条快照数组,peerUid 空 / chatType=7 影子条目须过滤)。 */
|
|
891
|
+
onRecentContactNotification: (contacts: RecentContact[]) => void;
|
|
892
|
+
};
|
|
821
893
|
/** NT RawMessage → canonical 元素(与 toSendElements 对称,接收方向)。 */
|
|
822
|
-
declare function toCanonicalElements(msg: RawMessage): CanonicalElement[];
|
|
894
|
+
export declare function toCanonicalElements(msg: RawMessage): CanonicalElement[];
|
|
823
895
|
/** canonical 元素 → NT 发送元素(text/at/face/image/voice/reply 核心 + json ARK 透传)。 */
|
|
824
|
-
declare function toSendElements(elements: CanonicalElement[]): SendMessageElement[];
|
|
896
|
+
export declare function toSendElements(elements: CanonicalElement[]): SendMessageElement[];
|
|
825
897
|
/** 协议无关的规范消息元素。 */
|
|
826
898
|
type CanonicalElement = {
|
|
827
899
|
type: "text";
|
|
@@ -875,8 +947,6 @@ type CanonicalElement = {
|
|
|
875
947
|
type: "unknown";
|
|
876
948
|
raw: unknown;
|
|
877
949
|
};
|
|
878
|
-
//#endregion
|
|
879
|
-
//#region src/types/services/buddy-service.d.ts
|
|
880
950
|
/** 好友核心信息(BuddyListEntry.coreInfo,2026-09-08 T10 实测)。 */
|
|
881
951
|
interface BuddyCoreInfo {
|
|
882
952
|
uid: string;
|
|
@@ -969,8 +1039,6 @@ interface NodeIKernelBuddyService {
|
|
|
969
1039
|
/** 处理可疑好友申请(set_doubt_friends_add_request;str1/str2 语义未知,传空串)。 */
|
|
970
1040
|
approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
|
|
971
1041
|
}
|
|
972
|
-
//#endregion
|
|
973
|
-
//#region src/types/services/profile-like-service.d.ts
|
|
974
1042
|
/**
|
|
975
1043
|
* NodeIKernelProfileLikeService:资料点赞服务接口面(自研描述,非移植)
|
|
976
1044
|
*
|
|
@@ -998,8 +1066,6 @@ interface NodeIKernelProfileLikeService {
|
|
|
998
1066
|
}): Promise<BuddyProfileLikeResult>;
|
|
999
1067
|
isNull(): boolean;
|
|
1000
1068
|
}
|
|
1001
|
-
//#endregion
|
|
1002
|
-
//#region src/types/services/profile-service.d.ts
|
|
1003
1069
|
/** 用户详情(getUserDetailInfoByUin / getUserDetailInfo 返回,宽松自研描述,待探测校准)。 */
|
|
1004
1070
|
interface UserDetailInfoByUin {
|
|
1005
1071
|
detail?: {
|
|
@@ -1049,38 +1115,6 @@ interface NodeIKernelProfileService {
|
|
|
1049
1115
|
getUserDetailInfo(uid: string): Promise<UserDetailInfoByUin>;
|
|
1050
1116
|
isNull(): boolean;
|
|
1051
1117
|
}
|
|
1052
|
-
//#endregion
|
|
1053
|
-
//#region src/types/services/recent-contact-service.d.ts
|
|
1054
|
-
/** 会话联系人(getRecentContactList 项,说明书参考,待探测校准)。 */
|
|
1055
|
-
interface RecentContact {
|
|
1056
|
-
/** 会话 id(群场景 = 群号,好友场景 = uid)。 */
|
|
1057
|
-
peerUid: string;
|
|
1058
|
-
/** 会话类型(ChatType 值域)。 */
|
|
1059
|
-
chatType: number;
|
|
1060
|
-
/** 置顶标记(get_peer_pins 数据源;listener 实测字段名为 topFlag,1 = 置顶)。 */
|
|
1061
|
-
topFlag?: number;
|
|
1062
|
-
/** 置顶标记(布尔别名形态,兼容探测取值)。 */
|
|
1063
|
-
isTop?: boolean;
|
|
1064
|
-
/** 置顶时间(topFlag=1 时携带,毫秒时间戳字符串)。 */
|
|
1065
|
-
topFlagTime?: string;
|
|
1066
|
-
/** 对端 uin(部分返回形态带)。 */
|
|
1067
|
-
peerUin?: string;
|
|
1068
|
-
[key: string]: unknown;
|
|
1069
|
-
}
|
|
1070
|
-
/** 会话列表拉取参数(getRecentContactList,字段值待探测校准)。 */
|
|
1071
|
-
interface RecentContactFetchParam {
|
|
1072
|
-
/** 拉取条数(缺省覆盖置顶集合足够大)。 */
|
|
1073
|
-
count: number;
|
|
1074
|
-
}
|
|
1075
|
-
/** 会话列表服务:apis/recent-contact 用到的核心方法面。 */
|
|
1076
|
-
interface NodeIKernelRecentContactService {
|
|
1077
|
-
/** 会话列表(get_peer_pins 数据源;返回形状待探测校准)。 */
|
|
1078
|
-
getRecentContactList(param: RecentContactFetchParam): Promise<GeneralCallResult & {
|
|
1079
|
-
result?: unknown;
|
|
1080
|
-
}>;
|
|
1081
|
-
}
|
|
1082
|
-
//#endregion
|
|
1083
|
-
//#region src/types/services/richmedia-service.d.ts
|
|
1084
1118
|
/** 群文件列表参数(getGroupFileList,说明书参考)。 */
|
|
1085
1119
|
interface GetFileListParam {
|
|
1086
1120
|
sortType: number;
|
|
@@ -1155,8 +1189,6 @@ interface NodeIKernelRichMediaService {
|
|
|
1155
1189
|
}>;
|
|
1156
1190
|
isNull(): boolean;
|
|
1157
1191
|
}
|
|
1158
|
-
//#endregion
|
|
1159
|
-
//#region src/types/services/ticket-service.d.ts
|
|
1160
1192
|
/** forceFetchClientKey 返回(get_clientkey 直接返回,get_cookies 用 clientKey 换跳转票据)。 */
|
|
1161
1193
|
interface ForceFetchClientKeyRetType extends GeneralCallResult {
|
|
1162
1194
|
url: string;
|
|
@@ -1171,8 +1203,6 @@ interface NodeIKernelTicketService {
|
|
|
1171
1203
|
forceFetchClientKey(arg: string): Promise<ForceFetchClientKeyRetType>;
|
|
1172
1204
|
isNull(): boolean;
|
|
1173
1205
|
}
|
|
1174
|
-
//#endregion
|
|
1175
|
-
//#region src/types/wrapper.d.ts
|
|
1176
1206
|
/**
|
|
1177
1207
|
* wrapper.node 的 NAPI 接口面(自研描述,非移植)
|
|
1178
1208
|
*
|
|
@@ -1439,8 +1469,6 @@ interface WrapperNodeApi {
|
|
|
1439
1469
|
/** 构造器:`new wrapper.NodeIKernelLoginService()`。 */
|
|
1440
1470
|
NodeIKernelLoginService: NodeIKernelLoginServiceCtor;
|
|
1441
1471
|
}
|
|
1442
|
-
//#endregion
|
|
1443
|
-
//#region src/apis/friend.d.ts
|
|
1444
1472
|
/** 好友条目(uid + 昵称/备注,昵称由 buddy service 缓存补全)。 */
|
|
1445
1473
|
interface Friend {
|
|
1446
1474
|
uid: string;
|
|
@@ -1475,7 +1503,7 @@ interface FriendApiOptions {
|
|
|
1475
1503
|
uidToUin?: (uids: string[]) => Promise<Map<string, string>>;
|
|
1476
1504
|
}
|
|
1477
1505
|
/** 好友 API:从 session 拿 buddy service,包装成语义化方法。 */
|
|
1478
|
-
declare class FriendApi {
|
|
1506
|
+
export declare class FriendApi {
|
|
1479
1507
|
private readonly service;
|
|
1480
1508
|
private readonly uidToUin;
|
|
1481
1509
|
constructor(session: NodeIQQNTWrapperSession, opts?: FriendApiOptions);
|
|
@@ -1502,10 +1530,8 @@ declare class FriendApi {
|
|
|
1502
1530
|
/** 处理可疑好友申请(set_doubt_friends_add_request;uid=flag)。 */
|
|
1503
1531
|
handleDoubtFriendRequest(uid: string): void;
|
|
1504
1532
|
}
|
|
1505
|
-
//#endregion
|
|
1506
|
-
//#region src/apis/group.d.ts
|
|
1507
1533
|
/** 群 API:从 session 拿 group service,包装成语义化方法。 */
|
|
1508
|
-
declare class GroupApi {
|
|
1534
|
+
export declare class GroupApi {
|
|
1509
1535
|
private readonly service;
|
|
1510
1536
|
/** 精华消息需要 msg service(按 msgId 拉消息取 msgSeq/msgRandom)。 */
|
|
1511
1537
|
private readonly msgService;
|
|
@@ -1586,10 +1612,8 @@ declare class GroupApi {
|
|
|
1586
1612
|
remainAtAllCountForGroup: number;
|
|
1587
1613
|
}>;
|
|
1588
1614
|
}
|
|
1589
|
-
//#endregion
|
|
1590
|
-
//#region src/apis/group-notify.d.ts
|
|
1591
1615
|
/** 群通知 API:从 session 拿 group service,包装成语义化方法。 */
|
|
1592
|
-
declare class GroupNotifyApi {
|
|
1616
|
+
export declare class GroupNotifyApi {
|
|
1593
1617
|
private readonly service;
|
|
1594
1618
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1595
1619
|
/** 单屏通知列表(get_group_system_msg / set_group_add_request 共用)。 */
|
|
@@ -1599,8 +1623,6 @@ declare class GroupNotifyApi {
|
|
|
1599
1623
|
/** 处理群请求(set_group_add_request 应答;approve=true 同意 / false 拒绝)。 */
|
|
1600
1624
|
handleGroupRequest(doubt: boolean, notify: GroupNotify, operateType: NTGroupRequestOperateTypes, reason: string): Promise<void>;
|
|
1601
1625
|
}
|
|
1602
|
-
//#endregion
|
|
1603
|
-
//#region src/event-channel.d.ts
|
|
1604
1626
|
/** Listener 接口形状(宽约束;精确签名由实例化时的具体接口保证)。 */
|
|
1605
1627
|
type ListenerShape = Record<string, unknown>;
|
|
1606
1628
|
/** 事件名:`${Service}/${method}`。 */
|
|
@@ -1627,7 +1649,7 @@ type ListenerEvents<L extends ListenerShape, Name extends string> = { [K in keyo
|
|
|
1627
1649
|
* @typeParam L - Listener 接口(探测产物,如 MsgListener)
|
|
1628
1650
|
* @typeParam Name - Service 名(事件名前缀,如 "Msg")
|
|
1629
1651
|
*/
|
|
1630
|
-
declare class NTEventChannel<L extends ListenerShape, Name extends string> {
|
|
1652
|
+
export declare class NTEventChannel<L extends ListenerShape, Name extends string> {
|
|
1631
1653
|
readonly serviceName: Name;
|
|
1632
1654
|
private readonly emitter;
|
|
1633
1655
|
private readonly errorHandlers;
|
|
@@ -1663,15 +1685,13 @@ declare class NTEventChannel<L extends ListenerShape, Name extends string> {
|
|
|
1663
1685
|
/** 订阅错误通知(监听器抛出的异常 / 其他内部错误)。 */
|
|
1664
1686
|
onError(handler: (err: unknown) => void): () => void;
|
|
1665
1687
|
}
|
|
1666
|
-
//#endregion
|
|
1667
|
-
//#region src/bridge/msg-bridge.d.ts
|
|
1668
1688
|
/** 消息事件通道的固定类型(事件名前缀 "Msg")。 */
|
|
1669
1689
|
type MsgEventChannel = NTEventChannel<MsgListener, "Msg">;
|
|
1670
1690
|
/**
|
|
1671
1691
|
* 消息事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
1672
1692
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
1673
1693
|
*/
|
|
1674
|
-
declare class MsgBridge {
|
|
1694
|
+
export declare class MsgBridge {
|
|
1675
1695
|
private readonly service;
|
|
1676
1696
|
private readonly channel;
|
|
1677
1697
|
private listenerId;
|
|
@@ -1681,10 +1701,8 @@ declare class MsgBridge {
|
|
|
1681
1701
|
/** 注销原生监听(幂等)。 */
|
|
1682
1702
|
unregister(): void;
|
|
1683
1703
|
}
|
|
1684
|
-
//#endregion
|
|
1685
|
-
//#region src/apis/msg.d.ts
|
|
1686
1704
|
/** 消息 API:从 session 拿 msg service,包装成语义化方法。 */
|
|
1687
|
-
declare class MsgApi {
|
|
1705
|
+
export declare class MsgApi {
|
|
1688
1706
|
private readonly service;
|
|
1689
1707
|
/** 消息事件通道(sendMsg 后等 onMsgInfoListUpdate 确认发送结果)。 */
|
|
1690
1708
|
private readonly channel;
|
|
@@ -1836,8 +1854,6 @@ declare class MsgApi {
|
|
|
1836
1854
|
};
|
|
1837
1855
|
}): Promise<void>;
|
|
1838
1856
|
}
|
|
1839
|
-
//#endregion
|
|
1840
|
-
//#region src/apis/stranger-info.d.ts
|
|
1841
1857
|
/** 陌生人信息(get_stranger_info 返回)。 */
|
|
1842
1858
|
interface StrangerInfo {
|
|
1843
1859
|
user_id: number;
|
|
@@ -1856,10 +1872,8 @@ interface StrangerInfo {
|
|
|
1856
1872
|
status: number;
|
|
1857
1873
|
login_days: number;
|
|
1858
1874
|
}
|
|
1859
|
-
//#endregion
|
|
1860
|
-
//#region src/apis/profile.d.ts
|
|
1861
1875
|
/** 资料 API:从 session 拿 profile service,包装成语义化方法。 */
|
|
1862
|
-
declare class ProfileApi {
|
|
1876
|
+
export declare class ProfileApi {
|
|
1863
1877
|
private readonly service;
|
|
1864
1878
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1865
1879
|
/** 设置个性签名(set_self_longnick)。 */
|
|
@@ -1871,33 +1885,29 @@ declare class ProfileApi {
|
|
|
1871
1885
|
/** 获取陌生人信息(get_stranger_info;uin 为用户 QQ 号)。 */
|
|
1872
1886
|
getStrangerInfo(uin: string): Promise<StrangerInfo>;
|
|
1873
1887
|
}
|
|
1874
|
-
//#endregion
|
|
1875
|
-
//#region src/apis/profile-like.d.ts
|
|
1876
1888
|
/** 点赞 API:从 session 拿 profile like service,包装成语义化方法。 */
|
|
1877
|
-
declare class ProfileLikeApi {
|
|
1889
|
+
export declare class ProfileLikeApi {
|
|
1878
1890
|
private readonly service;
|
|
1879
1891
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1880
1892
|
/** 点赞(send_like;uid 为目标 uid,count 次数)。 */
|
|
1881
1893
|
sendLike(uid: string, count?: number): Promise<void>;
|
|
1882
1894
|
}
|
|
1883
|
-
//#endregion
|
|
1884
|
-
//#region src/apis/recent-contact.d.ts
|
|
1885
1895
|
/** 置顶会话(get_peer_pins 数据项):peerUid 按 chatType 归 friend/group。 */
|
|
1886
1896
|
interface PinnedContact {
|
|
1887
1897
|
/** 会话 id(好友 = uid,群 = 群号)。 */
|
|
1888
1898
|
peerUid: string;
|
|
1899
|
+
/** 对端 uin(peer_pin_change 播种键;录制实证条目携带,可能缺省)。 */
|
|
1900
|
+
peerUin?: string;
|
|
1889
1901
|
/** 场景:friend(C2C)/ group(GROUP);temp 不产出。 */
|
|
1890
1902
|
scene: "friend" | "group";
|
|
1891
1903
|
}
|
|
1892
1904
|
/** 会话列表 API:从 session 拿 recent contact service,包装成语义化方法。 */
|
|
1893
|
-
declare class RecentContactApi {
|
|
1905
|
+
export declare class RecentContactApi {
|
|
1894
1906
|
private readonly service;
|
|
1895
1907
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1896
1908
|
/** 置顶会话列表(get_peer_pins;getRecentContactList 返回形状待探测校准)。 */
|
|
1897
1909
|
getPinnedContacts(): Promise<PinnedContact[]>;
|
|
1898
1910
|
}
|
|
1899
|
-
//#endregion
|
|
1900
|
-
//#region src/apis/richmedia.d.ts
|
|
1901
1911
|
/** 群文件列表条目(fileInfo/folderInfo 取其一)。 */
|
|
1902
1912
|
interface GroupFileListItem {
|
|
1903
1913
|
fileInfo?: GroupFileItemInfo;
|
|
@@ -1911,7 +1921,7 @@ interface GroupFileSystemInfo {
|
|
|
1911
1921
|
totalSpace: number;
|
|
1912
1922
|
}
|
|
1913
1923
|
/** 富媒体 API:从 session 拿 rich media service,包装成语义化方法。 */
|
|
1914
|
-
declare class RichMediaApi {
|
|
1924
|
+
export declare class RichMediaApi {
|
|
1915
1925
|
private readonly service;
|
|
1916
1926
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1917
1927
|
/** 英文单词翻译(translate_en2zh)。 */
|
|
@@ -1941,10 +1951,8 @@ declare class RichMediaApi {
|
|
|
1941
1951
|
/** 转存群文件(trans_group_file)。 */
|
|
1942
1952
|
transGroupFile(groupCode: string, fileId: string): Promise<void>;
|
|
1943
1953
|
}
|
|
1944
|
-
//#endregion
|
|
1945
|
-
//#region src/apis/ticket.d.ts
|
|
1946
1954
|
/** 票据 API:从 session 拿 ticket service,包装成语义化方法。 */
|
|
1947
|
-
declare class TicketApi {
|
|
1955
|
+
export declare class TicketApi {
|
|
1948
1956
|
private readonly service;
|
|
1949
1957
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1950
1958
|
/** 获取 clientKey(get_clientkey)。 */
|
|
@@ -1954,8 +1962,6 @@ declare class TicketApi {
|
|
|
1954
1962
|
/** 计算 bkn(get_csrf_token 与 web 接口共用;skey → bkn 哈希)。 */
|
|
1955
1963
|
static getBkn(skey: string): string;
|
|
1956
1964
|
}
|
|
1957
|
-
//#endregion
|
|
1958
|
-
//#region src/apis/webapi.d.ts
|
|
1959
1965
|
/** 精华消息项(digest_list 返回 data.msg_list 成员,说明书参考)。 */
|
|
1960
1966
|
interface EssenceMsgItem {
|
|
1961
1967
|
msg_seq: number;
|
|
@@ -1989,16 +1995,16 @@ interface GroupHonorWebInfo {
|
|
|
1989
1995
|
strong_newbie_list: HonorListItem[];
|
|
1990
1996
|
}
|
|
1991
1997
|
/** 群荣誉类型(1=龙王 2=群聊之火 3=群聊炽热 6=快乐源泉)。 */
|
|
1992
|
-
declare const WebHonorType: {
|
|
1998
|
+
export declare const WebHonorType: {
|
|
1993
1999
|
readonly ALL: 0;
|
|
1994
2000
|
readonly TALKATIVE: 1;
|
|
1995
2001
|
readonly PERFORMER: 2;
|
|
1996
2002
|
readonly LEGEND: 3;
|
|
1997
2003
|
readonly EMOTION: 6;
|
|
1998
2004
|
};
|
|
1999
|
-
type WebHonorType = (typeof WebHonorType)[keyof typeof WebHonorType];
|
|
2005
|
+
export type WebHonorType = (typeof WebHonorType)[keyof typeof WebHonorType];
|
|
2000
2006
|
/** 群空间 web API(Cookie 经 TicketApi 注入)。 */
|
|
2001
|
-
declare class WebApi {
|
|
2007
|
+
export declare class WebApi {
|
|
2002
2008
|
private readonly getCookies;
|
|
2003
2009
|
constructor(opts: {
|
|
2004
2010
|
getCookies: (domain: string) => Promise<Record<string, string>>;
|
|
@@ -2014,15 +2020,13 @@ declare class WebApi {
|
|
|
2014
2020
|
/** 拉取单类荣誉列表(honorlist 接口,正则提取 __INITIAL_STATE__)。 */
|
|
2015
2021
|
private fetchHonorList;
|
|
2016
2022
|
}
|
|
2017
|
-
//#endregion
|
|
2018
|
-
//#region src/bridge/friend-bridge.d.ts
|
|
2019
2023
|
/** 好友事件通道的固定类型(事件名前缀 "Buddy")。 */
|
|
2020
2024
|
type BuddyEventChannel = NTEventChannel<BuddyListener, "Buddy">;
|
|
2021
2025
|
/**
|
|
2022
2026
|
* 好友事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2023
2027
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
2024
2028
|
*/
|
|
2025
|
-
declare class FriendBridge {
|
|
2029
|
+
export declare class FriendBridge {
|
|
2026
2030
|
private readonly service;
|
|
2027
2031
|
private readonly channel;
|
|
2028
2032
|
private listenerId;
|
|
@@ -2032,15 +2036,13 @@ declare class FriendBridge {
|
|
|
2032
2036
|
/** 注销原生监听(幂等)。 */
|
|
2033
2037
|
unregister(): void;
|
|
2034
2038
|
}
|
|
2035
|
-
//#endregion
|
|
2036
|
-
//#region src/bridge/group-bridge.d.ts
|
|
2037
2039
|
/** 群事件通道的固定类型(事件名前缀 "Group")。 */
|
|
2038
2040
|
type GroupEventChannel = NTEventChannel<GroupListener, "Group">;
|
|
2039
2041
|
/**
|
|
2040
2042
|
* 群事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2041
2043
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
2042
2044
|
*/
|
|
2043
|
-
declare class GroupBridge {
|
|
2045
|
+
export declare class GroupBridge {
|
|
2044
2046
|
private readonly service;
|
|
2045
2047
|
private readonly channel;
|
|
2046
2048
|
private listenerId;
|
|
@@ -2050,8 +2052,38 @@ declare class GroupBridge {
|
|
|
2050
2052
|
/** 注销原生监听(幂等)。 */
|
|
2051
2053
|
unregister(): void;
|
|
2052
2054
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
+
/** 登录事件通道的固定类型(事件名前缀 "Login")。 */
|
|
2056
|
+
type LoginEventChannel = NTEventChannel<LoginListener, "Login">;
|
|
2057
|
+
/**
|
|
2058
|
+
* 登录事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2059
|
+
* 无全局单例(ADR-015 推论)——每进程一份。
|
|
2060
|
+
*/
|
|
2061
|
+
export declare class LoginBridge {
|
|
2062
|
+
private readonly service;
|
|
2063
|
+
private readonly channel;
|
|
2064
|
+
private listenerId;
|
|
2065
|
+
constructor(loginService: unknown, channel: LoginEventChannel);
|
|
2066
|
+
/** 注册原生监听(幂等)。 */
|
|
2067
|
+
register(): void;
|
|
2068
|
+
/** 注销原生监听(幂等)。 */
|
|
2069
|
+
unregister(): void;
|
|
2070
|
+
}
|
|
2071
|
+
/** 会话列表事件通道的固定类型(事件名前缀 "RecentContact")。 */
|
|
2072
|
+
type RecentContactEventChannel = NTEventChannel<RecentContactListener, "RecentContact">;
|
|
2073
|
+
/**
|
|
2074
|
+
* 会话列表事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2075
|
+
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
2076
|
+
*/
|
|
2077
|
+
export declare class RecentContactBridge {
|
|
2078
|
+
private readonly service;
|
|
2079
|
+
private readonly channel;
|
|
2080
|
+
private listenerId;
|
|
2081
|
+
constructor(session: NodeIQQNTWrapperSession, channel: RecentContactEventChannel);
|
|
2082
|
+
/** 注册原生监听(幂等)。 */
|
|
2083
|
+
register(): void;
|
|
2084
|
+
/** 注销原生监听(幂等)。 */
|
|
2085
|
+
unregister(): void;
|
|
2086
|
+
}
|
|
2055
2087
|
/** BuddyCache diff 事件 listener(归一化「新增/删除」事件)。 */
|
|
2056
2088
|
type BuddyCacheListener = {
|
|
2057
2089
|
onBuddyAdded: (entry: BuddyListEntry) => void;
|
|
@@ -2072,9 +2104,9 @@ interface BuddyCacheOptions {
|
|
|
2072
2104
|
* 防御性收窄 onBuddyListChange 载荷 → BuddyCategory[](T10 实证形状;
|
|
2073
2105
|
* 非数组返回 null,调用方打 raw 日志积累校准数据)。
|
|
2074
2106
|
*/
|
|
2075
|
-
declare function narrowBuddyCategories(arg: unknown): BuddyCategory[] | null;
|
|
2107
|
+
export declare function narrowBuddyCategories(arg: unknown): BuddyCategory[] | null;
|
|
2076
2108
|
/** 好友缓存:快照维护 + diff 归一化事件。 */
|
|
2077
|
-
declare class BuddyCache {
|
|
2109
|
+
export declare class BuddyCache {
|
|
2078
2110
|
private readonly channel;
|
|
2079
2111
|
private readonly logger;
|
|
2080
2112
|
/** diff 归一化事件通道(协议层订阅 friend_add / IPC 转发消费)。 */
|
|
@@ -2098,8 +2130,6 @@ declare class BuddyCache {
|
|
|
2098
2130
|
/** 快照是否已建(测试/诊断用)。 */
|
|
2099
2131
|
get baselineReady(): boolean;
|
|
2100
2132
|
}
|
|
2101
|
-
//#endregion
|
|
2102
|
-
//#region src/cache/group-cache.d.ts
|
|
2103
2133
|
/** GroupCache 构造参数。 */
|
|
2104
2134
|
interface GroupCacheOptions {
|
|
2105
2135
|
/** 群事件通道(GroupBridge 注册原生监听后 emit 到这里)。 */
|
|
@@ -2111,7 +2141,7 @@ interface GroupCacheOptions {
|
|
|
2111
2141
|
* 群/成员缓存:事件主动维护 + 查询惰性回填。
|
|
2112
2142
|
* 只读接口 getGroupDetail / getMembers / getMember / getGroup(列表项)。
|
|
2113
2143
|
*/
|
|
2114
|
-
declare class GroupCache {
|
|
2144
|
+
export declare class GroupCache {
|
|
2115
2145
|
private readonly channel;
|
|
2116
2146
|
private readonly groupApi;
|
|
2117
2147
|
/** 群列表项(onGroupListUpdate / getGroupList 回填)。 */
|
|
@@ -2174,8 +2204,6 @@ declare class GroupCache {
|
|
|
2174
2204
|
/** 惰性回填并发去重:同 key 并发只拉一次。 */
|
|
2175
2205
|
private dedupe;
|
|
2176
2206
|
}
|
|
2177
|
-
//#endregion
|
|
2178
|
-
//#region src/infra/config.d.ts
|
|
2179
2207
|
/** 配置文本格式。 */
|
|
2180
2208
|
type ConfigFormat = "json" | "toml";
|
|
2181
2209
|
/**
|
|
@@ -2203,7 +2231,7 @@ interface ConfigOptions<T> {
|
|
|
2203
2231
|
* - `load()`:seed 存在 → 直接用 seed;否则读文件(缺失落默认值)。
|
|
2204
2232
|
* - `save()`:按格式序列化(TOML/JSON)原子写。
|
|
2205
2233
|
*/
|
|
2206
|
-
declare class ConfigBase<T> {
|
|
2234
|
+
export declare class ConfigBase<T> {
|
|
2207
2235
|
readonly path: string;
|
|
2208
2236
|
readonly defaults: T;
|
|
2209
2237
|
private readonly schema;
|
|
@@ -2236,11 +2264,9 @@ declare class ConfigBase<T> {
|
|
|
2236
2264
|
private parse;
|
|
2237
2265
|
}
|
|
2238
2266
|
/** 解析 TOML 文本 → 对象(boot.cjs / 探测脚本等无 ConfigBase 场景复用)。 */
|
|
2239
|
-
declare function parseToml(text: string): Record<string, unknown>;
|
|
2267
|
+
export declare function parseToml(text: string): Record<string, unknown>;
|
|
2240
2268
|
/** 对象 → TOML 文本(config init 生成全局配置文件等场景)。 */
|
|
2241
|
-
declare function stringifyToml(value: Record<string, unknown>): string;
|
|
2242
|
-
//#endregion
|
|
2243
|
-
//#region src/infra/errors.d.ts
|
|
2269
|
+
export declare function stringifyToml(value: Record<string, unknown>): string;
|
|
2244
2270
|
/**
|
|
2245
2271
|
* kernel 类型化错误(ADR-009 / ADR-017)
|
|
2246
2272
|
*
|
|
@@ -2256,16 +2282,16 @@ type KernelErrorCode = "SEND_FAILED" | "PERMISSION_DENIED" | "NOT_FOUND" | "TIME
|
|
|
2256
2282
|
* 全部错误码集合。协议层映射表可据此推导:
|
|
2257
2283
|
* `Record<(typeof KERNEL_ERROR_CODES)[number], number>`。
|
|
2258
2284
|
*/
|
|
2259
|
-
declare const KERNEL_ERROR_CODES: readonly ["SEND_FAILED", "PERMISSION_DENIED", "NOT_FOUND", "TIMEOUT", "NOT_LOGIN", "INVALID_PARAM", "INVALID_STATE", "UNKNOWN"];
|
|
2285
|
+
export declare const KERNEL_ERROR_CODES: readonly ["SEND_FAILED", "PERMISSION_DENIED", "NOT_FOUND", "TIMEOUT", "NOT_LOGIN", "INVALID_PARAM", "INVALID_STATE", "UNKNOWN"];
|
|
2260
2286
|
/** kernel 类型化错误:apis / 基础设施层抛出的统一错误形态。 */
|
|
2261
|
-
declare class KernelError extends Error {
|
|
2287
|
+
export declare class KernelError extends Error {
|
|
2262
2288
|
readonly code: KernelErrorCode;
|
|
2263
2289
|
constructor(message: string, code?: KernelErrorCode, options?: ErrorOptions);
|
|
2264
2290
|
}
|
|
2265
2291
|
/** 便捷构造:`kernelError('消息不存在', 'NOT_FOUND', { cause })`。 */
|
|
2266
|
-
declare function kernelError(message: string, code?: KernelErrorCode, options?: ErrorOptions): KernelError;
|
|
2292
|
+
export declare function kernelError(message: string, code?: KernelErrorCode, options?: ErrorOptions): KernelError;
|
|
2267
2293
|
/** 类型守卫:协议层 catch 统一映射时区分 KernelError 与意外错误。 */
|
|
2268
|
-
declare function isKernelError(err: unknown): err is KernelError;
|
|
2294
|
+
export declare function isKernelError(err: unknown): err is KernelError;
|
|
2269
2295
|
/**
|
|
2270
2296
|
* 配置校验失败(INVALID_PARAM 子型,2026-10-25 嵌入式宿主契约):仅用于
|
|
2271
2297
|
* 「配置未就绪」一族——主配置校验/反序列化、内联配置、协议段 seed 校验。
|
|
@@ -2273,15 +2299,13 @@ declare function isKernelError(err: unknown): err is KernelError;
|
|
|
2273
2299
|
* (CLI/self-host 进程以 EXIT_CONFIG_INVALID 退出),与错误文案完全解耦——
|
|
2274
2300
|
* 文案是人读的,退出码是宿主消费的机器契约。
|
|
2275
2301
|
*/
|
|
2276
|
-
declare class ConfigError extends KernelError {
|
|
2302
|
+
export declare class ConfigError extends KernelError {
|
|
2277
2303
|
constructor(message: string, options?: ErrorOptions);
|
|
2278
2304
|
}
|
|
2279
2305
|
/** 便捷构造:`configError('主配置缺少 accounts', { cause })`。 */
|
|
2280
|
-
declare function configError(message: string, options?: ErrorOptions): ConfigError;
|
|
2306
|
+
export declare function configError(message: string, options?: ErrorOptions): ConfigError;
|
|
2281
2307
|
/** 配置校验失败的进程退出码(UNIX sysexits EX_CONFIG 惯例)。 */
|
|
2282
|
-
declare const EXIT_CONFIG_INVALID = 78;
|
|
2283
|
-
//#endregion
|
|
2284
|
-
//#region src/infra/logger.d.ts
|
|
2308
|
+
export declare const EXIT_CONFIG_INVALID = 78;
|
|
2285
2309
|
/** 日志级别(pino 标准级别 + silent)。 */
|
|
2286
2310
|
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
2287
2311
|
/**
|
|
@@ -2316,9 +2340,7 @@ interface LoggerOptions {
|
|
|
2316
2340
|
/** 追加的敏感字段路径(默认内置 token/票据等,见 DEFAULT_REDACT_PATHS)。 */
|
|
2317
2341
|
redact?: string[];
|
|
2318
2342
|
}
|
|
2319
|
-
declare function createLogger(opts?: LoggerOptions): pino.Logger;
|
|
2320
|
-
//#endregion
|
|
2321
|
-
//#region src/infra/log-config.d.ts
|
|
2343
|
+
export declare function createLogger(opts?: LoggerOptions): pino.Logger;
|
|
2322
2344
|
/** 控制台输出格式。 */
|
|
2323
2345
|
type LogFormat = "pretty" | "single-line" | "json";
|
|
2324
2346
|
/** 时间戳渲染模式(见 LogConfig.timestamp)。 */
|
|
@@ -2366,13 +2388,11 @@ type LogEnvSource = Record<string, string | undefined>;
|
|
|
2366
2388
|
* @param section TOML 解析后的 [log] 段(缺失/undefined = 全缺省)
|
|
2367
2389
|
* @param env 环境变量快照(默认空对象 = 无 env 覆盖)
|
|
2368
2390
|
*/
|
|
2369
|
-
declare function parseLogConfig(section: unknown, env?: LogEnvSource): LogConfig;
|
|
2370
|
-
//#endregion
|
|
2371
|
-
//#region src/infra/paths.d.ts
|
|
2391
|
+
export declare function parseLogConfig(section: unknown, env?: LogEnvSource): LogConfig;
|
|
2372
2392
|
/** 默认数据根目录名(项目根下,2026-08-08 用户拍板:不放用户目录)。 */
|
|
2373
|
-
declare const DEFAULT_DATA_ROOT_NAME = ".napuketto";
|
|
2393
|
+
export declare const DEFAULT_DATA_ROOT_NAME = ".napuketto";
|
|
2374
2394
|
/** 全局配置文件名。 */
|
|
2375
|
-
declare const MAIN_CONFIG_FILE = "napuketto.toml";
|
|
2395
|
+
export declare const MAIN_CONFIG_FILE = "napuketto.toml";
|
|
2376
2396
|
interface PathOptions {
|
|
2377
2397
|
/** 显式数据根(cli `--data-dir` 传入,优先级最高)。 */
|
|
2378
2398
|
dataRoot?: string;
|
|
@@ -2384,7 +2404,7 @@ interface PathOptions {
|
|
|
2384
2404
|
* 支持 `~` 前缀(展开为用户主目录)与相对路径(相对 cwd 解析)。
|
|
2385
2405
|
* 返回绝对路径。独立导出便于 cli / 探测脚本复用。
|
|
2386
2406
|
*/
|
|
2387
|
-
declare function resolveDataRoot(dataRoot?: string): string;
|
|
2407
|
+
export declare function resolveDataRoot(dataRoot?: string): string;
|
|
2388
2408
|
interface ConfigPathOptions {
|
|
2389
2409
|
/** 兜底数据根(探测全部失败时用 `<dataRoot>/napuketto.toml`,保持旧行为)。 */
|
|
2390
2410
|
dataRoot?: string;
|
|
@@ -2400,12 +2420,12 @@ interface ConfigPathOptions {
|
|
|
2400
2420
|
*
|
|
2401
2421
|
* 返回绝对路径。独立导出便于 cli / loader 装配链复用。
|
|
2402
2422
|
*/
|
|
2403
|
-
declare function resolveConfigPath(opts?: ConfigPathOptions): string;
|
|
2423
|
+
export declare function resolveConfigPath(opts?: ConfigPathOptions): string;
|
|
2404
2424
|
/**
|
|
2405
2425
|
* 路径装配器:持有账号数据目录下的全部子目录。
|
|
2406
2426
|
* 无全局单例(ADR-015 推论)——每账号每进程实例化一份。
|
|
2407
2427
|
*/
|
|
2408
|
-
declare class PathWrapper {
|
|
2428
|
+
export declare class PathWrapper {
|
|
2409
2429
|
/** 数据根(绝对路径)。 */
|
|
2410
2430
|
readonly root: string;
|
|
2411
2431
|
/** 账号数据目录(绝对路径),缺省 account 时等于 root。 */
|
|
@@ -2427,14 +2447,12 @@ declare class PathWrapper {
|
|
|
2427
2447
|
*/
|
|
2428
2448
|
clearCache(): void;
|
|
2429
2449
|
}
|
|
2430
|
-
//#endregion
|
|
2431
|
-
//#region src/wrapper/wrapper-loader.d.ts
|
|
2432
2450
|
/**
|
|
2433
2451
|
* Electron 进程类型(Node 的 process 类型无此字段)。
|
|
2434
2452
|
* - "browser":QQ 主进程(V1 模式)
|
|
2435
2453
|
* - "utility":utilityProcess Worker(路线 B,2026-08-06)
|
|
2436
2454
|
*/
|
|
2437
|
-
declare function electronProcessType(): string | undefined;
|
|
2455
|
+
export declare function electronProcessType(): string | undefined;
|
|
2438
2456
|
/**
|
|
2439
2457
|
* 解析 QQ 用户数据根(登录数据目录,如 `C:\Users\<user>\Documents\Tencent Files`)。
|
|
2440
2458
|
* 优先 NodeQQNTWrapperUtil.getNTUserDataInfoConfig()(QQ 官方 API),回退默认位置。
|
|
@@ -2445,7 +2463,7 @@ declare function electronProcessType(): string | undefined;
|
|
|
2445
2463
|
* (getLoginList 返回空 → 只能 QR 登录)。V1 主进程模式 QQ 自己 initConfig 过
|
|
2446
2464
|
* 正确路径,无需此解析。
|
|
2447
2465
|
*/
|
|
2448
|
-
declare function resolveQqUserDataRoot(exports: WrapperNodeApi): string | null;
|
|
2466
|
+
export declare function resolveQqUserDataRoot(exports: WrapperNodeApi): string | null;
|
|
2449
2467
|
/** QQ 版本信息(登录握手用)。 */
|
|
2450
2468
|
interface QQVersionContext {
|
|
2451
2469
|
fullVersion: string;
|
|
@@ -2470,9 +2488,9 @@ interface WrapperContext {
|
|
|
2470
2488
|
* 从 loader 截获的 NAPI exports 创建 wrapper 上下文。
|
|
2471
2489
|
* 在 QQ 主进程内调用(boot.cjs → kernel 入口)。
|
|
2472
2490
|
*/
|
|
2473
|
-
declare function createWrapper(exports: WrapperNodeApi, versionInfo: QQVersionContext): WrapperContext;
|
|
2491
|
+
export declare function createWrapper(exports: WrapperNodeApi, versionInfo: QQVersionContext): WrapperContext;
|
|
2474
2492
|
/** engine 初始化(wrapper 契约:先 engine 后 session)。config 为普通 JS 对象。 */
|
|
2475
|
-
declare function initEngine(ctx: WrapperContext, config: EnginInitDesktopConfig): void;
|
|
2493
|
+
export declare function initEngine(ctx: WrapperContext, config: EnginInitDesktopConfig): void;
|
|
2476
2494
|
/**
|
|
2477
2495
|
* 创建会话(2026-08-06 P2-0 实测修正——NapCat 方式自研等价):
|
|
2478
2496
|
* 1. StartupSessionWrapper.create()(启动会话包装)
|
|
@@ -2484,9 +2502,9 @@ declare function initEngine(ctx: WrapperContext, config: EnginInitDesktopConfig)
|
|
|
2484
2502
|
* NapCat 用 StartupSessionWrapper.create() + getNTWrapperSession('nt_1') 解决——
|
|
2485
2503
|
* 返回带完整实现的实例。worker(utilityProcess)继承 QQ env 后同样有效。
|
|
2486
2504
|
*/
|
|
2487
|
-
declare function createSession(ctx: WrapperContext): NodeIQQNTWrapperSession;
|
|
2505
|
+
export declare function createSession(ctx: WrapperContext): NodeIQQNTWrapperSession;
|
|
2488
2506
|
/** session 初始化(4 参全为 JS 对象,NAPI 自动转换)。 */
|
|
2489
|
-
declare function initSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener: NodeIKernelSessionListener): void;
|
|
2507
|
+
export declare function initSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener: NodeIKernelSessionListener): void;
|
|
2490
2508
|
/**
|
|
2491
2509
|
* 启动会话(有 startupSession 用 start(),否则 startNT(0))。
|
|
2492
2510
|
*
|
|
@@ -2495,7 +2513,7 @@ declare function initSession(ctx: WrapperContext, config: WrapperSessionInitConf
|
|
|
2495
2513
|
* 先 start 后 init 业务 service 不挂载(HANDOVER-V9 实测)。本函数保留给
|
|
2496
2514
|
* 已 init 的 session 补启动用;新路径请用 initAndStartSession。
|
|
2497
2515
|
*/
|
|
2498
|
-
declare function startSession(ctx: WrapperContext): void;
|
|
2516
|
+
export declare function startSession(ctx: WrapperContext): void;
|
|
2499
2517
|
/**
|
|
2500
2518
|
* boot 装配入口:createWrapper → initEngine → session。
|
|
2501
2519
|
*
|
|
@@ -2507,7 +2525,7 @@ declare function startSession(ctx: WrapperContext): void;
|
|
|
2507
2525
|
* 由 kernel NapukettoCore(core.ts)装配调用;loader 自建宿主 bootstrap 也直接调用作回退。
|
|
2508
2526
|
* 返回 WrapperContext;失败抛 KernelError。
|
|
2509
2527
|
*/
|
|
2510
|
-
declare function startNapuketto(options: StartNapukettoOptions): WrapperContext;
|
|
2528
|
+
export declare function startNapuketto(options: StartNapukettoOptions): WrapperContext;
|
|
2511
2529
|
/** startNapuketto 的引导环境(由 loader launcher 注入环境变量,boot.cjs 透传)。 */
|
|
2512
2530
|
interface BootEnv {
|
|
2513
2531
|
/** QQ 版本(如 "9.9.31-49919")。 */
|
|
@@ -2534,8 +2552,6 @@ interface StartNapukettoOptions {
|
|
|
2534
2552
|
/** QQ 的 loginService 实例(boot.cjs 拦截 new 捕获)。 */
|
|
2535
2553
|
qqLoginService?: unknown;
|
|
2536
2554
|
}
|
|
2537
|
-
//#endregion
|
|
2538
|
-
//#region src/login/login-connect.d.ts
|
|
2539
2555
|
/** 登录结果(QR 或快速登录)。 */
|
|
2540
2556
|
interface LoginResult {
|
|
2541
2557
|
uin: string;
|
|
@@ -2555,11 +2571,11 @@ interface LoginAccountInfo {
|
|
|
2555
2571
|
* 网络栈未初始化时报 1006511 网络异常——等待 MSF 连接后再重试。
|
|
2556
2572
|
* @returns 是否在超时前就绪。
|
|
2557
2573
|
*/
|
|
2558
|
-
declare function waitForNetworkConnection(ctx: WrapperContext, opts?: {
|
|
2574
|
+
export declare function waitForNetworkConnection(ctx: WrapperContext, opts?: {
|
|
2559
2575
|
timeoutMs?: number;
|
|
2560
2576
|
}): Promise<boolean>;
|
|
2561
2577
|
/** 列出历史登录账号(boot.cjs 启动横幅用,「可用快速登录 of QQ」)。 */
|
|
2562
|
-
declare function listLoginAccounts(ctx: WrapperContext): Promise<LoginAccountInfo[]>;
|
|
2578
|
+
export declare function listLoginAccounts(ctx: WrapperContext): Promise<LoginAccountInfo[]>;
|
|
2563
2579
|
/** quickLogin 参数(uin 指定账号;timeoutMs 网络就绪等待;quickLoginTimeoutMs 单步超时)。 */
|
|
2564
2580
|
interface QuickLoginOptions {
|
|
2565
2581
|
/** 指定快速登录账号(缺省遍历历史列表,优先 isQuickLogin)。 */
|
|
@@ -2576,9 +2592,7 @@ interface QuickLoginOptions {
|
|
|
2576
2592
|
* 已有会话时底层 promise 永久挂起,超时按登录失败(「快速登录失败: 快速登录超时」)
|
|
2577
2593
|
* 抛出,上层 catch/qrFallback 语义自动生效。
|
|
2578
2594
|
*/
|
|
2579
|
-
declare function quickLogin(ctx: WrapperContext, opts?: QuickLoginOptions): Promise<LoginResult>;
|
|
2580
|
-
//#endregion
|
|
2581
|
-
//#region src/login/lifecycle.d.ts
|
|
2595
|
+
export declare function quickLogin(ctx: WrapperContext, opts?: QuickLoginOptions): Promise<LoginResult>;
|
|
2582
2596
|
/**
|
|
2583
2597
|
* 等待 QQ 自己完成 session 初始化(framework 复用模式,2026-08-05 修正)。
|
|
2584
2598
|
*
|
|
@@ -2587,16 +2601,14 @@ declare function quickLogin(ctx: WrapperContext, opts?: QuickLoginOptions): Prom
|
|
|
2587
2601
|
* 也不自己 create(登录前 create() 干扰 QQ,实测 QQ 退出 code=0)。
|
|
2588
2602
|
* 正确做法:等 QQ 的 session 就绪(getMsgService 非 null = 核心 service 已挂载)。
|
|
2589
2603
|
*/
|
|
2590
|
-
declare function waitSessionReady(ctx: WrapperContext, opts: {
|
|
2604
|
+
export declare function waitSessionReady(ctx: WrapperContext, opts: {
|
|
2591
2605
|
timeoutMs?: number;
|
|
2592
2606
|
}): Promise<void>;
|
|
2593
2607
|
/** 登录连接 + 快速登录(quickLogin 等)已拆到 login-connect.ts(见文件头 re-export)。 */
|
|
2594
2608
|
/** session 初始化(4 参全为普通 JS 对象,等 init 完成信号)。 */
|
|
2595
|
-
declare function initAndStartSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener: NodeIKernelSessionListener, opts: {
|
|
2609
|
+
export declare function initAndStartSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener: NodeIKernelSessionListener, opts: {
|
|
2596
2610
|
timeoutMs?: number;
|
|
2597
2611
|
}): Promise<void>;
|
|
2598
|
-
//#endregion
|
|
2599
|
-
//#region src/login/login.d.ts
|
|
2600
2612
|
/** 登录状态。 */
|
|
2601
2613
|
type LoginState = "idle" | "waiting_scan" | "scanned" | "logged_in" | "failed";
|
|
2602
2614
|
/** 二维码数据(png base64 + 解码 url)。 */
|
|
@@ -2618,7 +2630,7 @@ interface LoginListItem {
|
|
|
2618
2630
|
isQuickLogin?: boolean;
|
|
2619
2631
|
}
|
|
2620
2632
|
/** QR 登录会话(状态机 + 回调订阅)。 */
|
|
2621
|
-
declare class QrLoginSession {
|
|
2633
|
+
export declare class QrLoginSession {
|
|
2622
2634
|
private readonly loginService;
|
|
2623
2635
|
private state;
|
|
2624
2636
|
private listenerId;
|
|
@@ -2666,8 +2678,6 @@ declare class QrLoginSession {
|
|
|
2666
2678
|
private setState;
|
|
2667
2679
|
private emitQrCode;
|
|
2668
2680
|
}
|
|
2669
|
-
//#endregion
|
|
2670
|
-
//#region src/context.d.ts
|
|
2671
2681
|
interface CoreContextOptions {
|
|
2672
2682
|
/** pino logger(console + 可选文件,由装配层创建)。 */
|
|
2673
2683
|
logger: pino.Logger;
|
|
@@ -2687,9 +2697,7 @@ interface CoreContext {
|
|
|
2687
2697
|
login: LoginResult | null;
|
|
2688
2698
|
}
|
|
2689
2699
|
/** 创建装配根(初始 wrapper/login 为 null)。 */
|
|
2690
|
-
declare function createCoreContext(opts: CoreContextOptions): CoreContext;
|
|
2691
|
-
//#endregion
|
|
2692
|
-
//#region src/core.d.ts
|
|
2700
|
+
export declare function createCoreContext(opts: CoreContextOptions): CoreContext;
|
|
2693
2701
|
interface NapukettoCoreOptions {
|
|
2694
2702
|
/** 数据根 / 账号(透传给 PathWrapper,见 ADR-016)。 */
|
|
2695
2703
|
paths?: PathOptions;
|
|
@@ -2748,7 +2756,7 @@ interface CoreLoginOptions {
|
|
|
2748
2756
|
* 核心装配器:持有 CoreContext,负责启动/停止编排。
|
|
2749
2757
|
* 无全局单例(ADR-015 推论)——每账号每进程实例化一份。
|
|
2750
2758
|
*/
|
|
2751
|
-
declare class NapukettoCore {
|
|
2759
|
+
export declare class NapukettoCore {
|
|
2752
2760
|
/** 装配根(协议层 / apis / cache 的消费入口)。 */
|
|
2753
2761
|
readonly ctx: CoreContext;
|
|
2754
2762
|
/** QR 登录会话句柄(登录期间非空;登录终态后清空)。refreshQr() 据此可达。 */
|
|
@@ -2809,16 +2817,12 @@ declare class NapukettoCore {
|
|
|
2809
2817
|
/** 停止:日志收尾(资源清理留给 P2 常驻管理)。 */
|
|
2810
2818
|
stop(): void;
|
|
2811
2819
|
}
|
|
2812
|
-
//#endregion
|
|
2813
|
-
//#region src/wrapper/probe/probe.d.ts
|
|
2814
2820
|
/**
|
|
2815
2821
|
* 探测 wrapper 运行时:dump session 方法与各 service 方法名到 JSON。
|
|
2816
2822
|
* 返回探测结果对象;同时写文件(NAPUTO_CFG_DIR/<file>,默认 napuketto-probe.json)。
|
|
2817
2823
|
* 服务枚举逐项增量落盘(persist)——活 session 上原生崩溃时文件保留断点。
|
|
2818
2824
|
*/
|
|
2819
|
-
declare function probeRuntime(ctx: WrapperContext, file?: string): Record<string, unknown>;
|
|
2820
|
-
//#endregion
|
|
2821
|
-
//#region src/wrapper/probe/probe-listener.d.ts
|
|
2825
|
+
export declare function probeRuntime(ctx: WrapperContext, file?: string): Record<string, unknown>;
|
|
2822
2826
|
/** 录制事件(JSONL 一行)。 */
|
|
2823
2827
|
interface ListenerRecordEvent {
|
|
2824
2828
|
/** ISO 时间戳。 */
|
|
@@ -2846,7 +2850,7 @@ interface ListenerRecordingResult {
|
|
|
2846
2850
|
* 查过的名字,即使从未调用);has / ownKeys 也记录(判定原生按名 Get 还是
|
|
2847
2851
|
* 枚举发现回调);非字符串键(Symbol,如 util.inspect 触发)放行默认行为。
|
|
2848
2852
|
*/
|
|
2849
|
-
declare function createRecordingListener(service: string, onEvent: (record: ListenerRecordEvent) => void): object;
|
|
2853
|
+
export declare function createRecordingListener(service: string, onEvent: (record: ListenerRecordEvent) => void): object;
|
|
2850
2854
|
/**
|
|
2851
2855
|
* 启动 listener 录制:session 十服务 + LoginService(exports 单例)逐服务注册
|
|
2852
2856
|
* 万能监听器,JSONL 逐行追加。返回摘要;文件路径写入结果(bootstrap 日志用)。
|
|
@@ -2855,9 +2859,7 @@ declare function createRecordingListener(service: string, onEvent: (record: List
|
|
|
2855
2859
|
* resolveMainFromStartup 会把空壳主 session 写回 ctx.session(session-resolver.ts),
|
|
2856
2860
|
* 空壳的 service getter 函数仍在但调用返回 null(late probe 61/63 null 的根因)。
|
|
2857
2861
|
*/
|
|
2858
|
-
declare function startListenerRecording(ctx: WrapperContext, file?: string): ListenerRecordingResult;
|
|
2859
|
-
//#endregion
|
|
2860
|
-
//#region src/wrapper/qq-data-path.d.ts
|
|
2862
|
+
export declare function startListenerRecording(ctx: WrapperContext, file?: string): ListenerRecordingResult;
|
|
2861
2863
|
/**
|
|
2862
2864
|
* QQ 数据根路径解析(P2-1,2026-08-06)
|
|
2863
2865
|
*
|
|
@@ -2875,23 +2877,19 @@ declare function startListenerRecording(ctx: WrapperContext, file?: string): Lis
|
|
|
2875
2877
|
* 防御:已含 nt_qq/global 后缀(worker 环境下 getNTUserDataInfoConfig 可能
|
|
2876
2878
|
* 返回完整路径)则不重复拼接,避免 `nt_qq/global/nt_qq/global` 错位。
|
|
2877
2879
|
*/
|
|
2878
|
-
declare function resolveQqGlobalPath(root: string): string;
|
|
2879
|
-
//#endregion
|
|
2880
|
-
//#region src/wrapper/session-resolver.d.ts
|
|
2880
|
+
export declare function resolveQqGlobalPath(root: string): string;
|
|
2881
2881
|
/**
|
|
2882
2882
|
* 复用 QQ 已有 session(P1-4:QQ 已登录,直接拿单例避免重复 init)。
|
|
2883
2883
|
* 优先 `NodeIQQNTWrapperSession.get()`;返回 null 时回退 createSession。
|
|
2884
2884
|
*/
|
|
2885
|
-
declare function getExistingSession(ctx: WrapperContext): NodeIQQNTWrapperSession | null;
|
|
2885
|
+
export declare function getExistingSession(ctx: WrapperContext): NodeIQQNTWrapperSession | null;
|
|
2886
2886
|
/**
|
|
2887
2887
|
* 复用 QQ 主 session(P1-4 实测链路):
|
|
2888
2888
|
* `NodeIQQNTStartupSessionWrapper.create()` → `start()` → `getSessionIdList()`(Map
|
|
2889
2889
|
* {nt:"nt_3", gpro:"gpro_3"})→ `NodeIQQNTWrapperSession.getNTWrapperSession("nt_3")`。
|
|
2890
2890
|
* 注:实测这些 session 是空壳(核心 service null),真正可用的是 new + init(lifecycle.ts)。
|
|
2891
2891
|
*/
|
|
2892
|
-
declare function getMainSession(ctx: WrapperContext): NodeIQQNTWrapperSession | null;
|
|
2893
|
-
//#endregion
|
|
2894
|
-
//#region src/wrapper/wrapper-adapters.d.ts
|
|
2892
|
+
export declare function getMainSession(ctx: WrapperContext): NodeIQQNTWrapperSession | null;
|
|
2895
2893
|
/** 会话监听器选项。 */
|
|
2896
2894
|
interface SessionListenerOptions {
|
|
2897
2895
|
/** 事件日志回调(默认静默——boot 阶段事件对用户是噪音;调试时可传回调观察)。 */
|
|
@@ -2902,31 +2900,29 @@ interface SessionListenerOptions {
|
|
|
2902
2900
|
* 回调方法必须存在(NAPI 按方法名反射),但输出与否由调用方决定——
|
|
2903
2901
|
* onNTSessionCreate / onOpentelemetryInit 等对用户无信息量,默认不打 stdout。
|
|
2904
2902
|
*/
|
|
2905
|
-
declare function createSessionListener(opts?: SessionListenerOptions): NodeIKernelSessionListener;
|
|
2903
|
+
export declare function createSessionListener(opts?: SessionListenerOptions): NodeIKernelSessionListener;
|
|
2906
2904
|
/** 创建登录监听器(占位,登录器接入时填充)。 */
|
|
2907
|
-
declare function createLoginListener(): IKernelLoginListener;
|
|
2908
|
-
//#endregion
|
|
2909
|
-
//#region src/wrapper/wrapper-config.d.ts
|
|
2905
|
+
export declare function createLoginListener(): IKernelLoginListener;
|
|
2910
2906
|
/**
|
|
2911
2907
|
* 从 major.node 提取 appid(NapCat parseAppidFromMajorV2 的自研等价实现)。
|
|
2912
2908
|
* major.node 含 `QQAppId/` 标记后跟数字(腾讯工具链产物,实测确认)。
|
|
2913
2909
|
* 返回 null 表示解析失败(调用方应显式报错,不再回退硬编码 appid)。
|
|
2914
2910
|
*/
|
|
2915
|
-
declare function parseAppidFromMajor(majorPath: string): string | null;
|
|
2911
|
+
export declare function parseAppidFromMajor(majorPath: string): string | null;
|
|
2916
2912
|
/**
|
|
2917
2913
|
* 解析 appid / qua(自研,参考 NapCat QQBasicInfoWrapper 思路但独立实现):
|
|
2918
2914
|
* appid 唯一来源 = major.node 提取(实测 9.9.33-51802 = 537376818)。
|
|
2919
2915
|
* majorPath 缺省或解析失败时抛 KernelError——不再静默回退过期 appid。
|
|
2920
2916
|
* majorPath 传 wrapper.node 同目录 major.node。
|
|
2921
2917
|
*/
|
|
2922
|
-
declare function resolveAppidQua(fullVersion: string, majorPath?: string): {
|
|
2918
|
+
export declare function resolveAppidQua(fullVersion: string, majorPath?: string): {
|
|
2923
2919
|
appid: string;
|
|
2924
2920
|
qua: string;
|
|
2925
2921
|
};
|
|
2926
2922
|
/** 生成 engine 桌面配置(wrapper 契约字段)。majorPath 可选(缺失/解析失败会抛错)。 */
|
|
2927
|
-
declare function buildEngineConfig(fullVersion: string, dataPathGlobal: string, majorPath?: string): EnginInitDesktopConfig;
|
|
2923
|
+
export declare function buildEngineConfig(fullVersion: string, dataPathGlobal: string, majorPath?: string): EnginInitDesktopConfig;
|
|
2928
2924
|
/** 生成登录初始化配置(externalVersion: false 与 NapCat 同款,扫码兼容关键)。 */
|
|
2929
|
-
declare function buildLoginConfig(appid: string, fullVersion: string, commonPath: string): Record<string, unknown>;
|
|
2925
|
+
export declare function buildLoginConfig(appid: string, fullVersion: string, commonPath: string): Record<string, unknown>;
|
|
2930
2926
|
/** buildSessionConfig 参数。 */
|
|
2931
2927
|
interface SessionConfigOptions {
|
|
2932
2928
|
appid: string;
|
|
@@ -2939,16 +2935,14 @@ interface SessionConfigOptions {
|
|
|
2939
2935
|
machineGuid?: string;
|
|
2940
2936
|
}
|
|
2941
2937
|
/** 生成 session 初始化配置(登录成功后调用)。 */
|
|
2942
|
-
declare function buildSessionConfig(options: SessionConfigOptions): WrapperSessionInitConfig;
|
|
2938
|
+
export declare function buildSessionConfig(options: SessionConfigOptions): WrapperSessionInitConfig;
|
|
2943
2939
|
/**
|
|
2944
2940
|
* 读取设备指纹 guid(wrapper.node 字符串分析实证,2026-08-12):
|
|
2945
2941
|
* NodeIKernelLoginService::getMachineGuid(0 参,返回机器 GUID 字符串)。
|
|
2946
2942
|
* 无 getMachineId 方法——TODO 里的方法名不存在,等价方法是 getMachineGuid。
|
|
2947
2943
|
* 失败(无该方法 / 调用抛错 / 返回值非字符串)兜底空串。
|
|
2948
2944
|
*/
|
|
2949
|
-
declare function readMachineGuid(loginService: unknown): string;
|
|
2950
|
-
//#endregion
|
|
2951
|
-
//#region src/wrapper/wrapper-version.d.ts
|
|
2945
|
+
export declare function readMachineGuid(loginService: unknown): string;
|
|
2952
2946
|
/**
|
|
2953
2947
|
* QQ 安装目录探测(ADR-018)
|
|
2954
2948
|
*
|
|
@@ -2961,14 +2955,14 @@ declare function readMachineGuid(loginService: unknown): string;
|
|
|
2961
2955
|
* - wrapper.node 是 C++ ABI 模块(非 N-API),导出 INTSessionShell 等符号
|
|
2962
2956
|
*/
|
|
2963
2957
|
/** 解析 wrapper.node 绝对路径(按 ADR-018 目录约定)。 */
|
|
2964
|
-
declare function resolveWrapperPath(installDir: string, version: string): string;
|
|
2958
|
+
export declare function resolveWrapperPath(installDir: string, version: string): string;
|
|
2965
2959
|
/**
|
|
2966
2960
|
* 探测指定版本信息(校验 wrapper.node 存在)。
|
|
2967
2961
|
* 版本号不匹配目录时抛 NOT_FOUND(明确失败而非静默)。
|
|
2968
2962
|
*/
|
|
2969
|
-
declare function resolveQQVersion(installDir: string, version: string): QQVersionInfo;
|
|
2963
|
+
export declare function resolveQQVersion(installDir: string, version: string): QQVersionInfo;
|
|
2970
2964
|
/** 扫描 versions 目录,取可加载的版本列表(按目录名倒序,最新在前)。 */
|
|
2971
|
-
declare function listQQVersions(installDir: string): string[];
|
|
2965
|
+
export declare function listQQVersions(installDir: string): string[];
|
|
2972
2966
|
/** QQ 版本信息。 */
|
|
2973
2967
|
interface QQVersionInfo {
|
|
2974
2968
|
/** 完整版本号,如 "9.9.31-49919"。 */
|
|
@@ -2982,6 +2976,5 @@ interface QQVersionInfo {
|
|
|
2982
2976
|
/** 登录握手参数(P1 探测脚本产出,暂为空串)。 */
|
|
2983
2977
|
qua: string;
|
|
2984
2978
|
}
|
|
2985
|
-
|
|
2986
|
-
export { type BootEnv, BuddyCache, type BuddyCacheEventChannel, type BuddyCacheListener, type BuddyCacheOptions, type BuddyCategory, type BuddyCoreInfo, type BuddyEventChannel, type BuddyListEntry, type BuddyListener, type BuddyReq, type CanonicalElement, ChatType, ConfigBase, ConfigError, type ConfigFormat, type ConfigOptions, type ConfigSchema, type CoreContext, type CoreContextOptions, type CoreLoginOptions, DEFAULT_DATA_ROOT_NAME, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, EXIT_CONFIG_INVALID, ElementType, type EnginInitDesktopConfig, type EssenceMsgItem, type ForceFetchClientKeyRetType, type Friend, FriendApi, FriendBridge, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, GrayTipSubType, type Group, GroupApi, GroupBridge, type GroupBulletin, GroupCache, type GroupCacheOptions, type GroupDetailInfo, type GroupEventChannel, type GroupFileItemInfo, type GroupFolderInfo, type GroupHonorWebInfo, GroupListUpdateType, type GroupListener, type GroupMember, type GroupMemberDataSource, type GroupMemberListChange, type GroupNotify, GroupNotifyApi, GroupNotifyMsgStatus, GroupNotifyMsgType, type GroupSpaceInfo, type HonorListItem, KERNEL_ERROR_CODES, KernelError, 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 LoginListItem, type LoginProgress, type LoginResult, type LoginState, MAIN_CONFIG_FILE, MsgApi, MsgBridge, type MsgEventChannel, type MsgListener, NTEventChannel, NTGroupMemberRole, NTGroupRequestOperateTypes, NapukettoCore, 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, PathWrapper, type Peer, type PlatformType, ProfileApi, ProfileLikeApi, type QQVersionContext, type QQVersionInfo, type QrCodeData, QrLoginSession, type RDeliveryConfig, type RawElement, type RawMessage, type RecentContact, RecentContactApi, type RecentContactFetchParam, RichMediaApi, type SelfInfo, type SendMessageElement, type SessionConfigOptions, type ShutUpGroupMember, type StartNapukettoOptions, type StrangerInfo, TicketApi, type TimestampMode, type TipAioOpGrayTipElement, type TipGroupElement, TipGroupElementType, type UserDetailInfoByUin, type VendorType, WebApi, WebHonorType, type WrapperContext, type WrapperNodeApi, type WrapperSessionInitConfig, buildEngineConfig, buildLoginConfig, buildSessionConfig, configError, createCoreContext, createSessionListener as createLifecycleSessionListener, createSessionListener, createLogger, createLoginListener, createRecordingListener, createSession, createWrapper, electronProcessType, getExistingSession, getMainSession, initAndStartSession, initEngine, initSession, isKernelError, kernelError, listLoginAccounts, listQQVersions, narrowBuddyCategories, parseAppidFromMajor, parseLogConfig, parseToml, probeRuntime, quickLogin, readMachineGuid, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveWrapperPath, startListenerRecording, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitForNetworkConnection, waitSessionReady };
|
|
2979
|
+
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 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 };
|
|
2987
2980
|
//# sourceMappingURL=index.d.mts.map
|