@napuketto/kernel 0.0.1 → 0.0.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/README.md +17 -0
- package/dist/index.d.mts +1032 -988
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1360 -1170
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -287,164 +287,699 @@ interface NodeIKernelMsgService {
|
|
|
287
287
|
}): Promise<GeneralCallResult>;
|
|
288
288
|
}
|
|
289
289
|
//#endregion
|
|
290
|
-
//#region src/types/services/
|
|
291
|
-
/**
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
interface
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
sourceName?: string;
|
|
307
|
-
[key: string]: unknown;
|
|
290
|
+
//#region src/types/services/group-service.d.ts
|
|
291
|
+
/** 群成员角色(QQ wrapper 契约)。 */
|
|
292
|
+
declare const NTGroupMemberRole: {
|
|
293
|
+
readonly UNSPECIFIED: 0;
|
|
294
|
+
readonly STRANGER: 1;
|
|
295
|
+
readonly MEMBER: 2;
|
|
296
|
+
readonly ADMIN: 3;
|
|
297
|
+
readonly OWNER: 4;
|
|
298
|
+
};
|
|
299
|
+
type NTGroupMemberRole = (typeof NTGroupMemberRole)[keyof typeof NTGroupMemberRole];
|
|
300
|
+
/** 踢人请求项(KickMemberV2Req.kickList 成员,说明书参考,字段值待探测校准)。 */
|
|
301
|
+
interface KickMemberInfo {
|
|
302
|
+
optFlag: number;
|
|
303
|
+
optOperate: number;
|
|
304
|
+
optMemberUid: string;
|
|
305
|
+
optBytesMsg: string;
|
|
308
306
|
}
|
|
309
|
-
/**
|
|
310
|
-
interface
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
groupCode?: string;
|
|
317
|
-
reqTime?: string;
|
|
318
|
-
[key: string]: unknown;
|
|
307
|
+
/** 踢人请求(set_group_kick 的 kickMemberV2 参数,说明书参考)。 */
|
|
308
|
+
interface KickMemberV2Req {
|
|
309
|
+
groupCode: string;
|
|
310
|
+
kickFlag: number;
|
|
311
|
+
kickList: KickMemberInfo[];
|
|
312
|
+
kickListUids: string[];
|
|
313
|
+
kickMsg: string;
|
|
319
314
|
}
|
|
320
|
-
/**
|
|
321
|
-
interface
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
getBuddyListFromCache(reqType: number): Promise<BuddyCategory[]>;
|
|
328
|
-
getBuddyNick(uid: string): string;
|
|
329
|
-
getBuddyRemark(uid: string): string;
|
|
330
|
-
isBuddy(uid: string): boolean;
|
|
331
|
-
/** 好友申请列表(set_friend_add_request 应答前查找匹配项)。 */
|
|
332
|
-
getBuddyReq(): Promise<GeneralCallResult & {
|
|
333
|
-
buddyReqs?: BuddyReq[];
|
|
334
|
-
}>;
|
|
335
|
-
/** 同意/拒绝加好友请求(set_friend_add_request)。 */
|
|
336
|
-
approvalFriendRequest(arg: {
|
|
337
|
-
friendUid: string;
|
|
338
|
-
reqTime: string;
|
|
339
|
-
accept: boolean;
|
|
340
|
-
}): Promise<void>;
|
|
341
|
-
/** 设置好友备注(set_friend_remark;void 语义乐观处理)。 */
|
|
342
|
-
setBuddyRemark(param: {
|
|
343
|
-
uid: string;
|
|
344
|
-
remark: string;
|
|
345
|
-
}): void;
|
|
346
|
-
/** 删除好友(delete_friend)。 */
|
|
347
|
-
delBuddy(param: {
|
|
348
|
-
friendUid: string;
|
|
349
|
-
tempBlock: boolean;
|
|
350
|
-
tempBothDel: boolean;
|
|
351
|
-
}): Promise<unknown>;
|
|
352
|
-
/** 可疑好友申请列表(get_doubt_friends_add_request;reqId 作回执匹配)。 */
|
|
353
|
-
getDoubtBuddyReq(reqId: string, num: number, uk: string): Promise<GeneralCallResult & {
|
|
354
|
-
doubtList?: DoubtBuddyReq[];
|
|
355
|
-
}>;
|
|
356
|
-
/** 处理可疑好友申请(set_doubt_friends_add_request;str1/str2 语义未知,传空串)。 */
|
|
357
|
-
approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
|
|
315
|
+
/** @all 剩余次数(getGroupRemainAtTimes 返回)。 */
|
|
316
|
+
interface GroupRemainAtTimes {
|
|
317
|
+
canAtAll: boolean;
|
|
318
|
+
remainAtAllCountForUin: number;
|
|
319
|
+
remainAtAllCountForGroup: number;
|
|
320
|
+
atTimesMsg: string;
|
|
321
|
+
canNotAtAllMsg: string;
|
|
358
322
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
readonly
|
|
373
|
-
readonly
|
|
374
|
-
readonly
|
|
375
|
-
readonly
|
|
376
|
-
readonly
|
|
377
|
-
readonly KLINUX: 5;
|
|
323
|
+
/** 群通知类型(GroupNotifyMsgType,说明书参考)。 */
|
|
324
|
+
declare const GroupNotifyMsgType: {
|
|
325
|
+
readonly UN_SPECIFIED: 0;
|
|
326
|
+
readonly INVITED_BY_MEMBER: 1;
|
|
327
|
+
readonly REFUSE_INVITED: 2;
|
|
328
|
+
readonly REFUSED_BY_ADMINI_STRATOR: 3;
|
|
329
|
+
readonly AGREED_TOJOIN_DIRECT: 4;
|
|
330
|
+
readonly INVITED_NEED_ADMINI_STRATOR_PASS: 5;
|
|
331
|
+
readonly AGREED_TO_JOIN_BY_ADMINI_STRATOR: 6;
|
|
332
|
+
readonly REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS: 7;
|
|
333
|
+
readonly SET_ADMIN: 8;
|
|
334
|
+
readonly KICK_MEMBER_NOTIFY_ADMIN: 9;
|
|
335
|
+
readonly KICK_MEMBER_NOTIFY_KICKED: 10;
|
|
336
|
+
readonly MEMBER_LEAVE_NOTIFY_ADMIN: 11;
|
|
337
|
+
readonly CANCEL_ADMIN_NOTIFY_CANCELED: 12;
|
|
338
|
+
readonly CANCEL_ADMIN_NOTIFY_ADMIN: 13;
|
|
339
|
+
readonly TRANSFER_GROUP_NOTIFY_OLDOWNER: 14;
|
|
340
|
+
readonly TRANSFER_GROUP_NOTIFY_ADMIN: 15;
|
|
378
341
|
};
|
|
379
|
-
type
|
|
380
|
-
/**
|
|
381
|
-
declare const
|
|
382
|
-
readonly
|
|
383
|
-
readonly
|
|
384
|
-
readonly
|
|
385
|
-
readonly
|
|
386
|
-
readonly
|
|
387
|
-
readonly KSUPPORTVIVOPUSH: 5;
|
|
388
|
-
readonly KSUPPORTGOOGLEPUSH: 99;
|
|
342
|
+
type GroupNotifyMsgType = (typeof GroupNotifyMsgType)[keyof typeof GroupNotifyMsgType];
|
|
343
|
+
/** 群通知处理状态(GroupNotifyMsgStatus,说明书参考)。 */
|
|
344
|
+
declare const GroupNotifyMsgStatus: {
|
|
345
|
+
readonly KINIT: 0;
|
|
346
|
+
readonly KUNHANDLE: 1;
|
|
347
|
+
readonly KAGREED: 2;
|
|
348
|
+
readonly KREFUSED: 3;
|
|
349
|
+
readonly KIGNORED: 4;
|
|
389
350
|
};
|
|
390
|
-
type
|
|
391
|
-
/**
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
global_path_config: {
|
|
409
|
-
desktopGlobalPath: string;
|
|
351
|
+
type GroupNotifyMsgStatus = (typeof GroupNotifyMsgStatus)[keyof typeof GroupNotifyMsgStatus];
|
|
352
|
+
/** 群请求操作类型(NTGroupRequestOperateTypes,说明书参考)。 */
|
|
353
|
+
declare const NTGroupRequestOperateTypes: {
|
|
354
|
+
readonly KUNSPECIFIED: 0;
|
|
355
|
+
readonly KAGREE: 1;
|
|
356
|
+
readonly KREFUSE: 2;
|
|
357
|
+
readonly KIGNORE: 3;
|
|
358
|
+
readonly KDELETE: 4;
|
|
359
|
+
};
|
|
360
|
+
type NTGroupRequestOperateTypes = (typeof NTGroupRequestOperateTypes)[keyof typeof NTGroupRequestOperateTypes];
|
|
361
|
+
/** 群通知(getSingleScreenNotifies 返回项,说明书参考,待探测校准)。 */
|
|
362
|
+
interface GroupNotify {
|
|
363
|
+
seq: string;
|
|
364
|
+
type: GroupNotifyMsgType;
|
|
365
|
+
status: GroupNotifyMsgStatus;
|
|
366
|
+
group?: {
|
|
367
|
+
groupCode: string;
|
|
368
|
+
groupName: string;
|
|
410
369
|
};
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
370
|
+
user1?: {
|
|
371
|
+
uid: string;
|
|
372
|
+
nickName: string;
|
|
373
|
+
};
|
|
374
|
+
user2?: {
|
|
375
|
+
uid: string;
|
|
376
|
+
nickName: string;
|
|
416
377
|
};
|
|
378
|
+
actionTime?: string;
|
|
379
|
+
postscript?: string;
|
|
380
|
+
warningTips?: string;
|
|
417
381
|
}
|
|
418
|
-
/**
|
|
419
|
-
interface
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
382
|
+
/** 禁言成员(getGroupShutUpMemberList 返回项,说明书参考,待探测校准)。 */
|
|
383
|
+
interface ShutUpGroupMember {
|
|
384
|
+
uid: string;
|
|
385
|
+
qid: string;
|
|
386
|
+
uin: string;
|
|
387
|
+
nick: string;
|
|
388
|
+
remark: string;
|
|
389
|
+
cardName: string;
|
|
390
|
+
shutUpTime: number;
|
|
391
|
+
memberSpecialTitle?: string;
|
|
425
392
|
}
|
|
426
|
-
/**
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
393
|
+
/** 群列表项(Group 实体,说明书参考)。 */
|
|
394
|
+
interface Group {
|
|
395
|
+
groupCode: string;
|
|
396
|
+
groupName: string;
|
|
397
|
+
memberCount: number;
|
|
398
|
+
maxMember: number;
|
|
399
|
+
remarkName?: string;
|
|
400
|
+
groupOwnerId?: {
|
|
401
|
+
memberUin: string;
|
|
402
|
+
memberUid: string;
|
|
403
|
+
};
|
|
404
|
+
memberRole?: number;
|
|
405
|
+
isTop?: boolean;
|
|
406
|
+
[key: string]: unknown;
|
|
433
407
|
}
|
|
434
|
-
/**
|
|
435
|
-
interface
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
408
|
+
/** 群详情(getGroupDetailInfo 返回,说明书参考)。 */
|
|
409
|
+
interface GroupDetailInfo {
|
|
410
|
+
groupCode: string;
|
|
411
|
+
groupUin: string;
|
|
412
|
+
ownerUin: string;
|
|
413
|
+
ownerUid?: string;
|
|
414
|
+
groupName: string;
|
|
415
|
+
memberNum: number;
|
|
416
|
+
maxMemberNum: number;
|
|
417
|
+
remarkName?: string;
|
|
418
|
+
isTop?: boolean;
|
|
419
|
+
groupCreateTime?: number;
|
|
420
|
+
[key: string]: unknown;
|
|
421
|
+
}
|
|
422
|
+
/** 群成员(getAllMemberList result.infos 的 value,说明书参考)。 */
|
|
423
|
+
interface GroupMember {
|
|
424
|
+
uid: string;
|
|
425
|
+
uin: string;
|
|
426
|
+
nick: string;
|
|
427
|
+
cardName: string;
|
|
428
|
+
remark: string;
|
|
429
|
+
role: NTGroupMemberRole;
|
|
430
|
+
shutUpTime: number;
|
|
431
|
+
joinTime: string;
|
|
432
|
+
lastSpeakTime: string;
|
|
433
|
+
memberSpecialTitle?: string;
|
|
434
|
+
sex?: number;
|
|
435
|
+
age?: number;
|
|
436
|
+
isRobot?: boolean;
|
|
437
|
+
[key: string]: unknown;
|
|
438
|
+
}
|
|
439
|
+
/** 群服务:apis/group 用到的核心方法面。 */
|
|
440
|
+
interface NodeIKernelGroupService {
|
|
441
|
+
addKernelGroupListener(listener: unknown): number;
|
|
442
|
+
removeKernelGroupListener(listenerId: number): void;
|
|
443
|
+
getGroupList(force: boolean): Promise<GeneralCallResult>;
|
|
444
|
+
getGroupDetailInfo(groupCode: string, groupInfoSource: number): Promise<GeneralCallResult>;
|
|
445
|
+
getAllMemberList(groupCode: string, forceFetch: boolean): Promise<{
|
|
446
|
+
errCode: number;
|
|
447
|
+
errMsg: string;
|
|
448
|
+
result: {
|
|
449
|
+
ids: Array<{
|
|
450
|
+
uid: string;
|
|
451
|
+
index: number;
|
|
452
|
+
}>;
|
|
453
|
+
infos: Map<string, GroupMember>;
|
|
454
|
+
finish: boolean;
|
|
455
|
+
};
|
|
456
|
+
}>;
|
|
457
|
+
getMemberInfo(groupCode: string, uids: string[], forceFetch: boolean): Promise<GeneralCallResult>;
|
|
458
|
+
/** uin → uid(私聊发送等需要,说明书参考)。 */
|
|
459
|
+
getUidByUins(uins: string[]): Promise<{
|
|
460
|
+
errCode: number;
|
|
461
|
+
errMsg: string;
|
|
462
|
+
uids: Map<string, string>;
|
|
463
|
+
}>;
|
|
464
|
+
/** uid → uin。 */
|
|
465
|
+
getUinByUids(uids: string[]): Promise<{
|
|
466
|
+
errCode: number;
|
|
467
|
+
errMsg: string;
|
|
468
|
+
uins: Map<string, string>;
|
|
469
|
+
}>;
|
|
470
|
+
/** 踢人(set_group_kick)。 */
|
|
471
|
+
kickMemberV2(param: KickMemberV2Req): Promise<GeneralCallResult>;
|
|
472
|
+
/** 成员禁言(set_group_ban;timeStamp=0 解除禁言)。 */
|
|
473
|
+
setMemberShutUp(groupCode: string, memberTimes: Array<{
|
|
474
|
+
uid: string;
|
|
475
|
+
timeStamp: number;
|
|
476
|
+
}>): Promise<GeneralCallResult>;
|
|
477
|
+
/** 全员禁言(set_group_whole_ban)。 */
|
|
478
|
+
setGroupShutUp(groupCode: string, shutUp: boolean): Promise<GeneralCallResult>;
|
|
479
|
+
/** 设置管理员(set_group_admin;void 语义,乐观处理)。 */
|
|
480
|
+
modifyMemberRole(groupCode: string, uid: string, role: NTGroupMemberRole): void;
|
|
481
|
+
/** 设置群名片(set_group_card;void 语义)。 */
|
|
482
|
+
modifyMemberCardName(groupCode: string, uid: string, cardName: string): void;
|
|
483
|
+
/** 修改群名(set_group_name)。 */
|
|
484
|
+
modifyGroupName(groupCode: string, groupName: string, isNormalMember: boolean): Promise<GeneralCallResult>;
|
|
485
|
+
/** 退群(set_group_leave)。 */
|
|
486
|
+
quitGroupV2(param: {
|
|
487
|
+
groupCode: string;
|
|
488
|
+
needDeleteLocalMsg: boolean;
|
|
489
|
+
}): Promise<GeneralCallResult>;
|
|
490
|
+
/** 设置精华消息(msgSeq/msgRandom 取自消息本体)。 */
|
|
491
|
+
addGroupEssence(param: {
|
|
492
|
+
groupCode: string;
|
|
493
|
+
msgRandom: number;
|
|
494
|
+
msgSeq: number;
|
|
495
|
+
}): Promise<unknown>;
|
|
496
|
+
/** 取消精华消息。 */
|
|
497
|
+
removeGroupEssence(param: {
|
|
498
|
+
groupCode: string;
|
|
499
|
+
msgRandom: number;
|
|
500
|
+
msgSeq: number;
|
|
501
|
+
}): Promise<unknown>;
|
|
502
|
+
/** @all 剩余次数(get_group_at_all_remain)。 */
|
|
503
|
+
getGroupRemainAtTimes(groupCode: string): Promise<Omit<GeneralCallResult, "result"> & {
|
|
504
|
+
errCode: number;
|
|
505
|
+
atInfo: GroupRemainAtTimes;
|
|
506
|
+
}>;
|
|
507
|
+
/** 单屏通知列表(get_group_system_msg / set_group_add_request 共用;列表可能走 listener,宽松解包)。 */
|
|
508
|
+
getSingleScreenNotifies(doubt: boolean, startSeq: string, count: number): Promise<GeneralCallResult & {
|
|
509
|
+
result?: unknown;
|
|
510
|
+
}>;
|
|
511
|
+
/** 禁言成员列表(get_group_shut_list;同 listener 风格,宽松解包)。 */
|
|
512
|
+
getGroupShutUpMemberList(groupCode: string): Promise<GeneralCallResult & {
|
|
513
|
+
result?: unknown;
|
|
514
|
+
}>;
|
|
515
|
+
/** 处理群请求(set_group_add_request 应答;postscript 空值可能导致失败,默认空格)。 */
|
|
516
|
+
operateSysNotify(doubt: boolean, operateMsg: {
|
|
517
|
+
operateType: NTGroupRequestOperateTypes;
|
|
518
|
+
targetMsg: {
|
|
519
|
+
seq: string;
|
|
520
|
+
type: GroupNotifyMsgType;
|
|
521
|
+
groupCode: string;
|
|
522
|
+
postscript: string;
|
|
523
|
+
};
|
|
524
|
+
}): Promise<void>;
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/types/listeners/group.d.ts
|
|
528
|
+
/** 群列表更新类型(说明书参考,值待探测校准)。 */
|
|
529
|
+
declare const GroupListUpdateType: {
|
|
530
|
+
/** 全量更新(groupList 为完整列表)。 */
|
|
531
|
+
readonly ALL: 0;
|
|
532
|
+
/** 增量更新(合并到现有缓存)。 */
|
|
533
|
+
readonly PARTIAL: 1;
|
|
534
|
+
};
|
|
535
|
+
type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
|
|
536
|
+
/** 成员数据来源(onMemberInfoChange 第二参,说明书参考)。 */
|
|
537
|
+
declare const GroupMemberDataSource: {
|
|
538
|
+
/** 本地缓存。 */
|
|
539
|
+
readonly CACHE: 0;
|
|
540
|
+
/** 网络拉取。 */
|
|
541
|
+
readonly NETWORK: 1;
|
|
542
|
+
};
|
|
543
|
+
type GroupMemberDataSource = (typeof GroupMemberDataSource)[keyof typeof GroupMemberDataSource];
|
|
544
|
+
/** onMemberListChange 参数(sceneId 为群号 groupCode)。 */
|
|
545
|
+
interface GroupMemberListChange {
|
|
546
|
+
sceneId: string;
|
|
547
|
+
ids: string[];
|
|
548
|
+
/** uid → GroupMember。 */
|
|
549
|
+
infos: Map<string, GroupMember>;
|
|
550
|
+
hasPrev: boolean;
|
|
551
|
+
hasNext: boolean;
|
|
552
|
+
hasRobot: boolean;
|
|
553
|
+
}
|
|
554
|
+
/** 群服务(GroupService)的原生回调监听接口。 */
|
|
555
|
+
type GroupListener = {
|
|
556
|
+
/** 群列表初始化完成(listEmpty:是否无群)。 */
|
|
557
|
+
onGroupListInited: (listEmpty: boolean) => void;
|
|
558
|
+
/** 群列表更新。 */
|
|
559
|
+
onGroupListUpdate: (updateType: GroupListUpdateType, groupList: Group[]) => void;
|
|
560
|
+
/** 群详情变化。 */
|
|
561
|
+
onGroupDetailInfoChange: (detailInfo: GroupDetailInfo) => void;
|
|
562
|
+
/** 群成员列表变化(sceneId=groupCode)。 */
|
|
563
|
+
onMemberListChange: (arg: GroupMemberListChange) => void;
|
|
564
|
+
/** 群成员信息变化(dataSource 区分本地缓存/网络)。 */
|
|
565
|
+
onMemberInfoChange: (groupCode: string, dataSource: GroupMemberDataSource, members: Map<string, GroupMember>) => void;
|
|
566
|
+
/** 群通知更新(doubt:是否可疑/忽略列表)。 */
|
|
567
|
+
onGroupNotifiesUpdated: (doubt: boolean, notifies: GroupNotify[]) => void;
|
|
568
|
+
/** 群通知单屏(分页 seq)。 */
|
|
569
|
+
onGroupSingleScreenNotifies: (doubt: boolean, seq: string, notifies: GroupNotify[]) => void;
|
|
570
|
+
/** 群禁言成员列表变化。 */
|
|
571
|
+
onShutUpMemberListChanged: (groupCode: string, members: ShutUpGroupMember[]) => void;
|
|
572
|
+
};
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/types/listeners/msg.d.ts
|
|
575
|
+
/** 消息已读上报(peer + 已读 seq)。 */
|
|
576
|
+
interface MsgReadReportItem {
|
|
577
|
+
peer: unknown;
|
|
578
|
+
readSeq: string;
|
|
579
|
+
}
|
|
580
|
+
/** 消息回执(msgId + 已读 seq)。 */
|
|
581
|
+
interface MsgReceipt {
|
|
582
|
+
msgId: string;
|
|
583
|
+
readSeq: string;
|
|
584
|
+
}
|
|
585
|
+
/** 消息服务(MsgService)的原生回调监听接口。
|
|
586
|
+
* 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
|
|
587
|
+
* 约束——interface 无隐式索引签名不兼容;type 对象类型天然满足。
|
|
588
|
+
*
|
|
589
|
+
* ⚠️ 2026-08-07 运行时探测实证(自建宿主,QQ 9.9.33):onRecvMsg 回调参数是
|
|
590
|
+
* **消息数组**(多条批量推送),非单条 RawMessage——此前单条签名错误(收到数组后
|
|
591
|
+
* msg.msgId/elements 全 undefined)。信号链:原生回调 → MsgBridge 透传数组 →
|
|
592
|
+
* 事件通道 → 订阅方遍历处理。 */
|
|
593
|
+
type MsgListener = {
|
|
594
|
+
/** 收到新消息(批量数组,运行时实证)。 */
|
|
595
|
+
onRecvMsg: (msgs: RawMessage[]) => void;
|
|
596
|
+
/** 消息已读上报。 */
|
|
597
|
+
onRecvMsgReadReport: (reports: MsgReadReportItem[]) => void;
|
|
598
|
+
/** 消息回执。 */
|
|
599
|
+
onRecvMsgReceipt: (receipts: MsgReceipt[]) => void;
|
|
600
|
+
};
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/types/message-element.d.ts
|
|
603
|
+
/** NT RawMessage → canonical 元素(与 toSendElements 对称,接收方向)。 */
|
|
604
|
+
declare function toCanonicalElements(msg: RawMessage): CanonicalElement[];
|
|
605
|
+
/** canonical 元素 → NT 发送元素(text/at/face/image/voice/reply 核心五类)。 */
|
|
606
|
+
declare function toSendElements(elements: CanonicalElement[]): SendMessageElement[];
|
|
607
|
+
/** 协议无关的规范消息元素。 */
|
|
608
|
+
type CanonicalElement = {
|
|
609
|
+
type: "text";
|
|
610
|
+
text: string;
|
|
611
|
+
} | {
|
|
612
|
+
type: "at";
|
|
613
|
+
target: string;
|
|
614
|
+
display?: string;
|
|
615
|
+
} | {
|
|
616
|
+
type: "image";
|
|
617
|
+
path: string;
|
|
618
|
+
url?: string;
|
|
619
|
+
size?: {
|
|
620
|
+
width: number;
|
|
621
|
+
height: number;
|
|
622
|
+
};
|
|
623
|
+
} | {
|
|
624
|
+
type: "face";
|
|
625
|
+
id: string;
|
|
626
|
+
} | {
|
|
627
|
+
type: "voice";
|
|
628
|
+
path: string;
|
|
629
|
+
durationMs?: number;
|
|
630
|
+
url?: string;
|
|
631
|
+
} | {
|
|
632
|
+
type: "video";
|
|
633
|
+
path: string;
|
|
634
|
+
url?: string;
|
|
635
|
+
} | {
|
|
636
|
+
type: "file";
|
|
637
|
+
path: string;
|
|
638
|
+
name?: string;
|
|
639
|
+
size?: number;
|
|
640
|
+
} | {
|
|
641
|
+
type: "reply";
|
|
642
|
+
messageId: string;
|
|
643
|
+
} | {
|
|
644
|
+
type: "forward";
|
|
645
|
+
messageIds: string[];
|
|
646
|
+
} | {
|
|
647
|
+
type: "json";
|
|
648
|
+
raw: unknown;
|
|
649
|
+
} | {
|
|
650
|
+
type: "xml";
|
|
651
|
+
raw: unknown;
|
|
652
|
+
} | {
|
|
653
|
+
type: "unknown";
|
|
654
|
+
raw: unknown;
|
|
655
|
+
};
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/types/services/buddy-service.d.ts
|
|
658
|
+
/** 好友列表分类(getBuddyListV2 返回,说明书参考)。 */
|
|
659
|
+
interface BuddyCategory {
|
|
660
|
+
categoryId: number;
|
|
661
|
+
categorySortId: number;
|
|
662
|
+
categroyName: string;
|
|
663
|
+
categroyMbCount: number;
|
|
664
|
+
onlineCount: number;
|
|
665
|
+
buddyUids: string[];
|
|
666
|
+
}
|
|
667
|
+
/** 好友申请(getBuddyReq 返回的 buddyReqs 成员,说明书参考,待探测校准)。 */
|
|
668
|
+
interface BuddyReq {
|
|
669
|
+
reqTime: string;
|
|
670
|
+
friendUid: string;
|
|
671
|
+
friendNick?: string;
|
|
672
|
+
sourceId?: number;
|
|
673
|
+
sourceName?: string;
|
|
674
|
+
[key: string]: unknown;
|
|
675
|
+
}
|
|
676
|
+
/** 可疑好友申请(getDoubtBuddyReq 返回的 doubtList 成员,说明书参考)。 */
|
|
677
|
+
interface DoubtBuddyReq {
|
|
678
|
+
uid: string;
|
|
679
|
+
nick?: string;
|
|
680
|
+
source?: string;
|
|
681
|
+
reason?: string;
|
|
682
|
+
msg?: string;
|
|
683
|
+
groupCode?: string;
|
|
684
|
+
reqTime?: string;
|
|
685
|
+
[key: string]: unknown;
|
|
686
|
+
}
|
|
687
|
+
/** 好友服务:apis/friend 用到的核心方法面。 */
|
|
688
|
+
interface NodeIKernelBuddyService {
|
|
689
|
+
addKernelBuddyListener(listener: unknown): number;
|
|
690
|
+
removeKernelBuddyListener(listenerId: number): void;
|
|
691
|
+
getBuddyListV2(callFrom: string, isPullRefresh: boolean, reqType: number): Promise<GeneralCallResult & {
|
|
692
|
+
data: BuddyCategory[];
|
|
693
|
+
}>;
|
|
694
|
+
getBuddyListFromCache(reqType: number): Promise<BuddyCategory[]>;
|
|
695
|
+
getBuddyNick(uid: string): string;
|
|
696
|
+
getBuddyRemark(uid: string): string;
|
|
697
|
+
isBuddy(uid: string): boolean;
|
|
698
|
+
/** 好友申请列表(set_friend_add_request 应答前查找匹配项)。 */
|
|
699
|
+
getBuddyReq(): Promise<GeneralCallResult & {
|
|
700
|
+
buddyReqs?: BuddyReq[];
|
|
701
|
+
}>;
|
|
702
|
+
/** 同意/拒绝加好友请求(set_friend_add_request)。 */
|
|
703
|
+
approvalFriendRequest(arg: {
|
|
704
|
+
friendUid: string;
|
|
705
|
+
reqTime: string;
|
|
706
|
+
accept: boolean;
|
|
707
|
+
}): Promise<void>;
|
|
708
|
+
/** 设置好友备注(set_friend_remark;void 语义乐观处理)。 */
|
|
709
|
+
setBuddyRemark(param: {
|
|
710
|
+
uid: string;
|
|
711
|
+
remark: string;
|
|
712
|
+
}): void;
|
|
713
|
+
/** 删除好友(delete_friend)。 */
|
|
714
|
+
delBuddy(param: {
|
|
715
|
+
friendUid: string;
|
|
716
|
+
tempBlock: boolean;
|
|
717
|
+
tempBothDel: boolean;
|
|
718
|
+
}): Promise<unknown>;
|
|
719
|
+
/** 可疑好友申请列表(get_doubt_friends_add_request;reqId 作回执匹配)。 */
|
|
720
|
+
getDoubtBuddyReq(reqId: string, num: number, uk: string): Promise<GeneralCallResult & {
|
|
721
|
+
doubtList?: DoubtBuddyReq[];
|
|
722
|
+
}>;
|
|
723
|
+
/** 处理可疑好友申请(set_doubt_friends_add_request;str1/str2 语义未知,传空串)。 */
|
|
724
|
+
approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
|
|
725
|
+
}
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region src/types/services/profile-like-service.d.ts
|
|
728
|
+
/**
|
|
729
|
+
* NodeIKernelProfileLikeService:资料点赞服务接口面(自研描述,非移植)
|
|
730
|
+
*
|
|
731
|
+
* 依据:运行时反射 + wrapper 外部契约(接口签名是 QQ 的外部事实,自研描述其形状,
|
|
732
|
+
* 零复制实现)。
|
|
733
|
+
* (接口签名是外部系统的事实,我们自研描述其形状,零复制实现)。
|
|
734
|
+
* 只收录 apis/profile-like 需要的方法;其余按需探测后补齐。
|
|
735
|
+
*/
|
|
736
|
+
/** 点赞返回(setBuddyProfileLike,说明书参考)。 */
|
|
737
|
+
interface BuddyProfileLikeResult {
|
|
738
|
+
result: number;
|
|
739
|
+
errMsg: string;
|
|
740
|
+
succCounts: number;
|
|
741
|
+
}
|
|
742
|
+
/** 资料点赞服务。 */
|
|
743
|
+
interface NodeIKernelProfileLikeService {
|
|
744
|
+
addKernelProfileLikeListener(listener: unknown): number;
|
|
745
|
+
removeKernelProfileLikeListener(listenerId: number): void;
|
|
746
|
+
/** 点赞(send_like;sourceId=71 赞来源,doLikeCount 次数)。 */
|
|
747
|
+
setBuddyProfileLike(arg: {
|
|
748
|
+
friendUid: string;
|
|
749
|
+
sourceId: number;
|
|
750
|
+
doLikeCount: number;
|
|
751
|
+
doLikeTollCount: number;
|
|
752
|
+
}): Promise<BuddyProfileLikeResult>;
|
|
753
|
+
isNull(): boolean;
|
|
754
|
+
}
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region src/types/services/profile-service.d.ts
|
|
757
|
+
/** 用户详情(getUserDetailInfoByUin / getUserDetailInfo 返回,宽松自研描述,待探测校准)。 */
|
|
758
|
+
interface UserDetailInfoByUin {
|
|
759
|
+
detail?: {
|
|
760
|
+
uid?: string;
|
|
761
|
+
uin?: string;
|
|
762
|
+
simpleInfo?: {
|
|
763
|
+
coreInfo?: {
|
|
764
|
+
nick?: string;
|
|
765
|
+
remark?: string;
|
|
766
|
+
};
|
|
767
|
+
baseInfo?: {
|
|
768
|
+
age?: number;
|
|
769
|
+
qid?: string;
|
|
770
|
+
sex?: number;
|
|
771
|
+
longNick?: string;
|
|
772
|
+
};
|
|
773
|
+
vasInfo?: {
|
|
774
|
+
svipFlag?: boolean;
|
|
775
|
+
yearVipFlag?: boolean;
|
|
776
|
+
vipLevel?: number;
|
|
777
|
+
};
|
|
778
|
+
status?: {
|
|
779
|
+
status?: number;
|
|
780
|
+
};
|
|
781
|
+
relationFlags?: Record<string, unknown>;
|
|
782
|
+
};
|
|
783
|
+
commonExt?: {
|
|
784
|
+
qqLevel?: number;
|
|
785
|
+
regTime?: number;
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
[key: string]: unknown;
|
|
789
|
+
}
|
|
790
|
+
/** 资料服务。 */
|
|
791
|
+
interface NodeIKernelProfileService {
|
|
792
|
+
addKernelProfileListener(listener: unknown): number;
|
|
793
|
+
removeKernelProfileListener(listenerId: number): void;
|
|
794
|
+
/** 设置个性签名(set_self_longnick)。 */
|
|
795
|
+
setLongNick(longNick: string): Promise<unknown>;
|
|
796
|
+
/** 设置昵称(set_qq_profile)。 */
|
|
797
|
+
setNickName(nickName: string): Promise<unknown>;
|
|
798
|
+
/** 设置头像(set_qq_avatar)。 */
|
|
799
|
+
setHeader(filePath: string): Promise<GeneralCallResult>;
|
|
800
|
+
/** 按 uin 获取用户详情(get_stranger_info 第一步)。 */
|
|
801
|
+
getUserDetailInfoByUin(uin: string): Promise<UserDetailInfoByUin>;
|
|
802
|
+
/** 按 uid 获取用户详情(get_stranger_info 第二步,noCache=true 强制刷新)。 */
|
|
803
|
+
getUserDetailInfo(uid: string): Promise<UserDetailInfoByUin>;
|
|
804
|
+
isNull(): boolean;
|
|
805
|
+
}
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region src/types/services/richmedia-service.d.ts
|
|
808
|
+
/** 群文件列表参数(getGroupFileList,说明书参考)。 */
|
|
809
|
+
interface GetFileListParam {
|
|
810
|
+
sortType: number;
|
|
811
|
+
fileCount: number;
|
|
812
|
+
startIndex: number;
|
|
813
|
+
sortOrder: number;
|
|
814
|
+
showOnlinedocFolder: number;
|
|
815
|
+
}
|
|
816
|
+
/** 群文件项(getGroupFileList 返回的 fileInfo,说明书参考,待探测校准)。 */
|
|
817
|
+
interface GroupFileItemInfo {
|
|
818
|
+
fileId: string;
|
|
819
|
+
fileName: string;
|
|
820
|
+
fileSize: string;
|
|
821
|
+
fileUuid?: string;
|
|
822
|
+
parent?: string;
|
|
823
|
+
uploadTime?: number;
|
|
824
|
+
modifyTime?: number;
|
|
825
|
+
uploaderUid?: string;
|
|
826
|
+
uploaderUin?: string;
|
|
827
|
+
[key: string]: unknown;
|
|
828
|
+
}
|
|
829
|
+
/** 群文件夹项(getGroupFileList 返回的 folderInfo,说明书参考,待探测校准)。 */
|
|
830
|
+
interface GroupFolderInfo {
|
|
831
|
+
folderId: string;
|
|
832
|
+
folderName: string;
|
|
833
|
+
folderPath?: string;
|
|
834
|
+
folderUid?: string;
|
|
835
|
+
[key: string]: unknown;
|
|
836
|
+
}
|
|
837
|
+
/** 群文件空间信息(getGroupFileList 的 groupSpaceResult,说明书参考)。 */
|
|
838
|
+
interface GroupSpaceInfo {
|
|
839
|
+
retCode: number;
|
|
840
|
+
retMsg: string;
|
|
841
|
+
clientWording: string;
|
|
842
|
+
totalSpace: number;
|
|
843
|
+
usedSpace: number;
|
|
844
|
+
allUpload: boolean;
|
|
845
|
+
}
|
|
846
|
+
/** 富媒体服务。 */
|
|
847
|
+
interface NodeIKernelRichMediaService {
|
|
848
|
+
addKernelRichMediaListener(listener: unknown): number;
|
|
849
|
+
removeKernelRichMediaListener(listenerId: number): void;
|
|
850
|
+
/** 英文单词翻译(translate_en2zh)。 */
|
|
851
|
+
translateEnWordToZn(words: string[]): Promise<GeneralCallResult & {
|
|
852
|
+
words?: string[];
|
|
853
|
+
}>;
|
|
854
|
+
/** 群文件列表(get_group_root_files / get_group_files_by_folder)。 */
|
|
855
|
+
getGroupFileList(groupCode: string, params: GetFileListParam): Promise<GeneralCallResult & {
|
|
856
|
+
groupSpaceResult?: GroupSpaceInfo;
|
|
857
|
+
result?: unknown;
|
|
858
|
+
}>;
|
|
859
|
+
/** 创建群文件夹(create_group_file_folder)。 */
|
|
860
|
+
createGroupFolder(groupCode: string, folderName: string): Promise<GeneralCallResult>;
|
|
861
|
+
/** 删除群文件(delete_group_file;params 业务类型,Files 为文件 ID 列表)。 */
|
|
862
|
+
deleteGroupFile(groupCode: string, params: number[], files: string[]): Promise<GeneralCallResult>;
|
|
863
|
+
/** 删除群文件夹(delete_group_folder)。 */
|
|
864
|
+
deleteGroupFolder(groupCode: string, folderId: string): Promise<GeneralCallResult>;
|
|
865
|
+
/** 重命名群文件(rename_group_file;参数待探测校准)。 */
|
|
866
|
+
renameGroupFile(arg1: string, arg2: number, arg3: string, arg4: string, arg5: string): Promise<unknown>;
|
|
867
|
+
/** 移动群文件(move_group_file)。 */
|
|
868
|
+
moveGroupFile(groupCode: string, busId: number[], fileList: string[], currentParentDirectory: string, targetParentDirectory: string): Promise<GeneralCallResult>;
|
|
869
|
+
/** 转存群文件(trans_group_file)。 */
|
|
870
|
+
transGroupFile(groupCode: string, fileId: string): Promise<GeneralCallResult>;
|
|
871
|
+
/** 批量群文件数(get_group_file_system_info 补充)。 */
|
|
872
|
+
batchGetGroupFileCount(groupCodes: string[]): Promise<GeneralCallResult & {
|
|
873
|
+
groupCodes?: string[];
|
|
874
|
+
groupFileCounts?: number[];
|
|
875
|
+
}>;
|
|
876
|
+
isNull(): boolean;
|
|
877
|
+
}
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/types/services/ticket-service.d.ts
|
|
880
|
+
/** forceFetchClientKey 返回(get_clientkey 直接返回,get_cookies 用 clientKey 换跳转票据)。 */
|
|
881
|
+
interface ForceFetchClientKeyRetType extends GeneralCallResult {
|
|
882
|
+
url: string;
|
|
883
|
+
keyIndex: string;
|
|
884
|
+
clientKey: string;
|
|
885
|
+
expireTime: string;
|
|
886
|
+
}
|
|
887
|
+
/** 票据服务。 */
|
|
888
|
+
interface NodeIKernelTicketService {
|
|
889
|
+
addKernelTicketListener(listener: unknown): number;
|
|
890
|
+
removeKernelTicketListener(listenerId: number): void;
|
|
891
|
+
forceFetchClientKey(arg: string): Promise<ForceFetchClientKeyRetType>;
|
|
892
|
+
isNull(): boolean;
|
|
893
|
+
}
|
|
894
|
+
//#endregion
|
|
895
|
+
//#region src/types/wrapper.d.ts
|
|
896
|
+
/**
|
|
897
|
+
* wrapper.node 的 NAPI 接口面(自研描述,非移植)
|
|
898
|
+
*
|
|
899
|
+
* 来源:wrapper.node 在 QQ 定制版 Electron 里通过 napi_define_class / napi_set_named_property
|
|
900
|
+
* 注册的 JS 类(2026-08-05 Ghidra 反编译 FUN_180c6274a / FUN_180c80224 确认类名)。
|
|
901
|
+
* 这些接口是 wrapper.node 对外暴露的外部系统契约——我们自研描述其形状,未复制任何第三方代码。
|
|
902
|
+
*
|
|
903
|
+
* 注意:这里所有对象由 QQ 运行时的 NAPI 层自动构建/转换,业务层禁止触碰 C++ ABI。
|
|
904
|
+
*/
|
|
905
|
+
/** 平台类型(与 wrapper.node 的 platform 字段对应)。 */
|
|
906
|
+
declare const PlatformType: {
|
|
907
|
+
readonly KUNKNOWN: 0;
|
|
908
|
+
readonly KANDROID: 1;
|
|
909
|
+
readonly KIOS: 2;
|
|
910
|
+
readonly KWINDOWS: 3;
|
|
911
|
+
readonly KMAC: 4;
|
|
912
|
+
readonly KLINUX: 5;
|
|
913
|
+
};
|
|
914
|
+
type PlatformType = (typeof PlatformType)[keyof typeof PlatformType];
|
|
915
|
+
/** 厂商类型(deviceInfo.vendorType)。 */
|
|
916
|
+
declare const VendorType: {
|
|
917
|
+
readonly KNOSETONIOS: 0;
|
|
918
|
+
readonly KUNSUPPORTANDROIDPUSH: 1;
|
|
919
|
+
readonly KSUPPORTTPNS: 2;
|
|
920
|
+
readonly KSUPPORTHMS: 3;
|
|
921
|
+
readonly KSUPPORTOPPOPUSH: 4;
|
|
922
|
+
readonly KSUPPORTVIVOPUSH: 5;
|
|
923
|
+
readonly KSUPPORTGOOGLEPUSH: 99;
|
|
924
|
+
};
|
|
925
|
+
type VendorType = (typeof VendorType)[keyof typeof VendorType];
|
|
926
|
+
/** NodeQQNTWrapperUtil:通用工具类(静态服务)。 */
|
|
927
|
+
interface NodeQQNTWrapperUtil {
|
|
928
|
+
get(): NodeQQNTWrapperUtil;
|
|
929
|
+
getNTUserDataInfoConfig(): string;
|
|
930
|
+
getFileSize(path: string): Promise<number>;
|
|
931
|
+
fileIsExist(path: string): unknown;
|
|
932
|
+
makeDirByPath(path: string): unknown;
|
|
933
|
+
}
|
|
934
|
+
/** engine 初始化配置(initWithDeskTopConfig 第一参,JS 对象直接传)。 */
|
|
935
|
+
interface EnginInitDesktopConfig {
|
|
936
|
+
base_path_prefix: string;
|
|
937
|
+
platform_type: PlatformType;
|
|
938
|
+
app_type: 4;
|
|
939
|
+
app_version: string;
|
|
940
|
+
os_version: string;
|
|
941
|
+
use_xlog: boolean;
|
|
942
|
+
qua: string;
|
|
943
|
+
global_path_config: {
|
|
944
|
+
desktopGlobalPath: string;
|
|
945
|
+
};
|
|
946
|
+
thumb_config: {
|
|
947
|
+
maxSide: 324;
|
|
948
|
+
minSide: 48;
|
|
949
|
+
longLimit: 6;
|
|
950
|
+
density: 2;
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
/** NodeIQQNTWrapperEngine 实例方法。 */
|
|
954
|
+
interface NodeIQQNTWrapperEngine {
|
|
955
|
+
initWithDeskTopConfig(config: EnginInitDesktopConfig, adapter: NodeIGlobalAdapter): void;
|
|
956
|
+
initWithMobileConfig(config: unknown, adapter: NodeIGlobalAdapter): void;
|
|
957
|
+
initLog(arg: unknown): void;
|
|
958
|
+
setLogLevel(arg: unknown): void;
|
|
959
|
+
onSendSSOReply(a: unknown, b: unknown, c: unknown, d: unknown, e: unknown): void;
|
|
960
|
+
}
|
|
961
|
+
/** NodeIQQNTWrapperEngine 构造器(含静态 get())。 */
|
|
962
|
+
type NodeIQQNTWrapperEngineCtor = new () => NodeIQQNTWrapperEngine & {
|
|
963
|
+
get(): NodeIQQNTWrapperEngine;
|
|
964
|
+
};
|
|
965
|
+
/** desktopPathConfig 结构。 */
|
|
966
|
+
interface DesktopPathConfig {
|
|
967
|
+
account_path: string;
|
|
968
|
+
}
|
|
969
|
+
/** rdeliveryConfig 结构。 */
|
|
970
|
+
interface RDeliveryConfig {
|
|
971
|
+
appKey: string;
|
|
972
|
+
systemId: number;
|
|
973
|
+
appId: string;
|
|
974
|
+
logicEnvironment: string;
|
|
975
|
+
platform: PlatformType;
|
|
976
|
+
language: string;
|
|
977
|
+
sdkVersion: string;
|
|
978
|
+
userId: string;
|
|
979
|
+
appVersion: string;
|
|
980
|
+
osVersion: string;
|
|
981
|
+
bundleId: string;
|
|
982
|
+
serverUrl: string;
|
|
448
983
|
fixedAfterHitKeys: string[];
|
|
449
984
|
}
|
|
450
985
|
/** deviceInfo 结构。 */
|
|
@@ -583,335 +1118,98 @@ interface IKernelLoginListener {
|
|
|
583
1118
|
onUserLoggedIn?(userid: string): void;
|
|
584
1119
|
onQRCodeSessionQuickLoginFailed?(...args: unknown[]): void;
|
|
585
1120
|
onPasswordLoginFailed?(...args: unknown[]): void;
|
|
586
|
-
onQQLoginNumLimited?(...args: unknown[]): void;
|
|
587
|
-
onLoginState?(...args: unknown[]): void;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* NodeIKernelSessionListener:session.init 第四参监听器(普通 JS 对象)。
|
|
591
|
-
* init 完成信号:以 onOpentelemetryInit(is_init===true) 为准(onSessionInitComplete 为辅)。
|
|
592
|
-
*/
|
|
593
|
-
interface NodeIKernelSessionListener {
|
|
594
|
-
onNTSessionCreate?(sessionId: string): void;
|
|
595
|
-
onGProSessionCreate?(sessionId: string): void;
|
|
596
|
-
onSessionInitComplete?(result: unknown): void;
|
|
597
|
-
onOpentelemetryInit?(info: {
|
|
598
|
-
is_init: boolean;
|
|
599
|
-
is_report: boolean;
|
|
600
|
-
}): void;
|
|
601
|
-
onUserOnlineResult?(result: unknown): void;
|
|
602
|
-
onGetSelfTinyId?(result: unknown): void;
|
|
603
|
-
}
|
|
604
|
-
/** wrapper.node 的 NAPI 顶层导出(module.exports)。 */
|
|
605
|
-
interface WrapperNodeApi {
|
|
606
|
-
NodeIO3MiscService: NodeIO3MiscService;
|
|
607
|
-
NodeQQNTWrapperUtil: NodeQQNTWrapperUtil;
|
|
608
|
-
/** 构造器:`new wrapper.NodeIQQNTWrapperSession()`。 */
|
|
609
|
-
NodeIQQNTWrapperSession: NodeIQQNTWrapperSessionCtor;
|
|
610
|
-
NodeIQQNTStartupSessionWrapper: NodeIQQNTStartupSessionWrapperCtor;
|
|
611
|
-
/** 构造器:`new wrapper.NodeIQQNTWrapperEngine()`。 */
|
|
612
|
-
NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngineCtor;
|
|
613
|
-
/** 构造器:`new wrapper.NodeIKernelLoginService()`。 */
|
|
614
|
-
NodeIKernelLoginService: NodeIKernelLoginServiceCtor;
|
|
615
|
-
}
|
|
616
|
-
//#endregion
|
|
617
|
-
//#region src/apis/friend.d.ts
|
|
618
|
-
/** 好友条目(uid + 昵称/备注,昵称由 buddy service 缓存补全)。 */
|
|
619
|
-
interface Friend {
|
|
620
|
-
uid: string;
|
|
621
|
-
uin: string;
|
|
622
|
-
nickname: string;
|
|
623
|
-
remark: string;
|
|
624
|
-
}
|
|
625
|
-
/** 带分类的好友列表项(get_friends_with_category 返回)。 */
|
|
626
|
-
interface FriendCategory {
|
|
627
|
-
categoryId: number;
|
|
628
|
-
categorySortId: number;
|
|
629
|
-
categoryName: string;
|
|
630
|
-
categoryMbCount: number;
|
|
631
|
-
onlineCount: number;
|
|
632
|
-
buddyList: Friend[];
|
|
633
|
-
}
|
|
634
|
-
/** 可疑好友申请(OB11 结构,get_doubt_friends_add_request 返回)。 */
|
|
635
|
-
interface DoubtFriendRequestInfo {
|
|
636
|
-
flag: string;
|
|
637
|
-
uin: number;
|
|
638
|
-
nick?: string;
|
|
639
|
-
source?: string;
|
|
640
|
-
reason?: string;
|
|
641
|
-
msg?: string;
|
|
642
|
-
group_code?: string;
|
|
643
|
-
time?: string;
|
|
644
|
-
type: "doubt";
|
|
645
|
-
}
|
|
646
|
-
/** FriendApi 构造选项。 */
|
|
647
|
-
interface FriendApiOptions {
|
|
648
|
-
/** uid→uin 转换器(通常注入 GroupApi.uidToUin);缺省 uin 退化为 uid。 */
|
|
649
|
-
uidToUin?: (uids: string[]) => Promise<Map<string, string>>;
|
|
650
|
-
}
|
|
651
|
-
/** 好友 API:从 session 拿 buddy service,包装成语义化方法。 */
|
|
652
|
-
declare class FriendApi {
|
|
653
|
-
private readonly service;
|
|
654
|
-
private readonly uidToUin;
|
|
655
|
-
constructor(session: NodeIQQNTWrapperSession, opts?: FriendApiOptions);
|
|
656
|
-
/** 好友列表(分类拍平为 Friend[];昵称/备注从 service 缓存读取)。 */
|
|
657
|
-
getFriendList(): Promise<Friend[]>;
|
|
658
|
-
/** 带分类的好友列表(get_friends_with_category,分类保留)。 */
|
|
659
|
-
getFriendCategories(): Promise<FriendCategory[]>;
|
|
660
|
-
/** 原始分类(getBuddyListV2 / 缓存)。 */
|
|
661
|
-
private getBuddyCategories;
|
|
662
|
-
/** 判断是否好友。 */
|
|
663
|
-
isBuddy(uid: string): boolean;
|
|
664
|
-
/** 好友申请列表(set_friend_add_request 应答前查找匹配项)。 */
|
|
665
|
-
getBuddyReqList(): Promise<BuddyReq[]>;
|
|
666
|
-
/** 应答好友申请(accept=true 同意;remark 由调用方另行 setFriendRemark)。 */
|
|
667
|
-
handleFriendRequest(notify: BuddyReq, accept: boolean): Promise<void>;
|
|
668
|
-
/** 设置好友备注(void 语义乐观处理)。 */
|
|
669
|
-
setFriendRemark(uid: string, remark: string): void;
|
|
670
|
-
/** 删除好友(tempBlock=拉黑,tempBothDel=双向删除)。 */
|
|
671
|
-
deleteFriend(uid: string, tempBlock?: boolean, tempBothDel?: boolean): Promise<void>;
|
|
672
|
-
/** 可疑好友申请列表(get_doubt_friends_add_request;uin 经 uidToUin 转换)。 */
|
|
673
|
-
getDoubtFriendRequest(count: number): Promise<DoubtFriendRequestInfo[]>;
|
|
674
|
-
/** 单项转换:DoubtBuddyReq → OB11 结构(可选字段条件赋值,exactOptionalPropertyTypes)。 */
|
|
675
|
-
private toDoubtFriendRequestInfo;
|
|
676
|
-
/** 处理可疑好友申请(set_doubt_friends_add_request;uid=flag)。 */
|
|
677
|
-
handleDoubtFriendRequest(uid: string): void;
|
|
678
|
-
}
|
|
679
|
-
//#endregion
|
|
680
|
-
//#region src/types/services/group-service.d.ts
|
|
681
|
-
/** 群成员角色(QQ wrapper 契约)。 */
|
|
682
|
-
declare const NTGroupMemberRole: {
|
|
683
|
-
readonly UNSPECIFIED: 0;
|
|
684
|
-
readonly STRANGER: 1;
|
|
685
|
-
readonly MEMBER: 2;
|
|
686
|
-
readonly ADMIN: 3;
|
|
687
|
-
readonly OWNER: 4;
|
|
688
|
-
};
|
|
689
|
-
type NTGroupMemberRole = (typeof NTGroupMemberRole)[keyof typeof NTGroupMemberRole];
|
|
690
|
-
/** 踢人请求项(KickMemberV2Req.kickList 成员,说明书参考,字段值待探测校准)。 */
|
|
691
|
-
interface KickMemberInfo {
|
|
692
|
-
optFlag: number;
|
|
693
|
-
optOperate: number;
|
|
694
|
-
optMemberUid: string;
|
|
695
|
-
optBytesMsg: string;
|
|
696
|
-
}
|
|
697
|
-
/** 踢人请求(set_group_kick 的 kickMemberV2 参数,说明书参考)。 */
|
|
698
|
-
interface KickMemberV2Req {
|
|
699
|
-
groupCode: string;
|
|
700
|
-
kickFlag: number;
|
|
701
|
-
kickList: KickMemberInfo[];
|
|
702
|
-
kickListUids: string[];
|
|
703
|
-
kickMsg: string;
|
|
1121
|
+
onQQLoginNumLimited?(...args: unknown[]): void;
|
|
1122
|
+
onLoginState?(...args: unknown[]): void;
|
|
704
1123
|
}
|
|
705
|
-
/**
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1124
|
+
/**
|
|
1125
|
+
* NodeIKernelSessionListener:session.init 第四参监听器(普通 JS 对象)。
|
|
1126
|
+
* init 完成信号:以 onOpentelemetryInit(is_init===true) 为准(onSessionInitComplete 为辅)。
|
|
1127
|
+
*/
|
|
1128
|
+
interface NodeIKernelSessionListener {
|
|
1129
|
+
onNTSessionCreate?(sessionId: string): void;
|
|
1130
|
+
onGProSessionCreate?(sessionId: string): void;
|
|
1131
|
+
onSessionInitComplete?(result: unknown): void;
|
|
1132
|
+
onOpentelemetryInit?(info: {
|
|
1133
|
+
is_init: boolean;
|
|
1134
|
+
is_report: boolean;
|
|
1135
|
+
}): void;
|
|
1136
|
+
onUserOnlineResult?(result: unknown): void;
|
|
1137
|
+
onGetSelfTinyId?(result: unknown): void;
|
|
712
1138
|
}
|
|
713
|
-
/**
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
readonly KICK_MEMBER_NOTIFY_ADMIN: 9;
|
|
725
|
-
readonly KICK_MEMBER_NOTIFY_KICKED: 10;
|
|
726
|
-
readonly MEMBER_LEAVE_NOTIFY_ADMIN: 11;
|
|
727
|
-
readonly CANCEL_ADMIN_NOTIFY_CANCELED: 12;
|
|
728
|
-
readonly CANCEL_ADMIN_NOTIFY_ADMIN: 13;
|
|
729
|
-
readonly TRANSFER_GROUP_NOTIFY_OLDOWNER: 14;
|
|
730
|
-
readonly TRANSFER_GROUP_NOTIFY_ADMIN: 15;
|
|
731
|
-
};
|
|
732
|
-
type GroupNotifyMsgType = (typeof GroupNotifyMsgType)[keyof typeof GroupNotifyMsgType];
|
|
733
|
-
/** 群通知处理状态(GroupNotifyMsgStatus,说明书参考)。 */
|
|
734
|
-
declare const GroupNotifyMsgStatus: {
|
|
735
|
-
readonly KINIT: 0;
|
|
736
|
-
readonly KUNHANDLE: 1;
|
|
737
|
-
readonly KAGREED: 2;
|
|
738
|
-
readonly KREFUSED: 3;
|
|
739
|
-
readonly KIGNORED: 4;
|
|
740
|
-
};
|
|
741
|
-
type GroupNotifyMsgStatus = (typeof GroupNotifyMsgStatus)[keyof typeof GroupNotifyMsgStatus];
|
|
742
|
-
/** 群请求操作类型(NTGroupRequestOperateTypes,说明书参考)。 */
|
|
743
|
-
declare const NTGroupRequestOperateTypes: {
|
|
744
|
-
readonly KUNSPECIFIED: 0;
|
|
745
|
-
readonly KAGREE: 1;
|
|
746
|
-
readonly KREFUSE: 2;
|
|
747
|
-
readonly KIGNORE: 3;
|
|
748
|
-
readonly KDELETE: 4;
|
|
749
|
-
};
|
|
750
|
-
type NTGroupRequestOperateTypes = (typeof NTGroupRequestOperateTypes)[keyof typeof NTGroupRequestOperateTypes];
|
|
751
|
-
/** 群通知(getSingleScreenNotifies 返回项,说明书参考,待探测校准)。 */
|
|
752
|
-
interface GroupNotify {
|
|
753
|
-
seq: string;
|
|
754
|
-
type: GroupNotifyMsgType;
|
|
755
|
-
status: GroupNotifyMsgStatus;
|
|
756
|
-
group?: {
|
|
757
|
-
groupCode: string;
|
|
758
|
-
groupName: string;
|
|
759
|
-
};
|
|
760
|
-
user1?: {
|
|
761
|
-
uid: string;
|
|
762
|
-
nickName: string;
|
|
763
|
-
};
|
|
764
|
-
user2?: {
|
|
765
|
-
uid: string;
|
|
766
|
-
nickName: string;
|
|
767
|
-
};
|
|
768
|
-
actionTime?: string;
|
|
769
|
-
postscript?: string;
|
|
770
|
-
warningTips?: string;
|
|
1139
|
+
/** wrapper.node 的 NAPI 顶层导出(module.exports)。 */
|
|
1140
|
+
interface WrapperNodeApi {
|
|
1141
|
+
NodeIO3MiscService: NodeIO3MiscService;
|
|
1142
|
+
NodeQQNTWrapperUtil: NodeQQNTWrapperUtil;
|
|
1143
|
+
/** 构造器:`new wrapper.NodeIQQNTWrapperSession()`。 */
|
|
1144
|
+
NodeIQQNTWrapperSession: NodeIQQNTWrapperSessionCtor;
|
|
1145
|
+
NodeIQQNTStartupSessionWrapper: NodeIQQNTStartupSessionWrapperCtor;
|
|
1146
|
+
/** 构造器:`new wrapper.NodeIQQNTWrapperEngine()`。 */
|
|
1147
|
+
NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngineCtor;
|
|
1148
|
+
/** 构造器:`new wrapper.NodeIKernelLoginService()`。 */
|
|
1149
|
+
NodeIKernelLoginService: NodeIKernelLoginServiceCtor;
|
|
771
1150
|
}
|
|
772
|
-
|
|
773
|
-
|
|
1151
|
+
//#endregion
|
|
1152
|
+
//#region src/apis/friend.d.ts
|
|
1153
|
+
/** 好友条目(uid + 昵称/备注,昵称由 buddy service 缓存补全)。 */
|
|
1154
|
+
interface Friend {
|
|
774
1155
|
uid: string;
|
|
775
|
-
qid: string;
|
|
776
1156
|
uin: string;
|
|
777
|
-
|
|
1157
|
+
nickname: string;
|
|
778
1158
|
remark: string;
|
|
779
|
-
cardName: string;
|
|
780
|
-
shutUpTime: number;
|
|
781
|
-
memberSpecialTitle?: string;
|
|
782
|
-
}
|
|
783
|
-
/** 群列表项(Group 实体,说明书参考)。 */
|
|
784
|
-
interface Group {
|
|
785
|
-
groupCode: string;
|
|
786
|
-
groupName: string;
|
|
787
|
-
memberCount: number;
|
|
788
|
-
maxMember: number;
|
|
789
|
-
remarkName?: string;
|
|
790
|
-
groupOwnerId?: {
|
|
791
|
-
memberUin: string;
|
|
792
|
-
memberUid: string;
|
|
793
|
-
};
|
|
794
|
-
memberRole?: number;
|
|
795
|
-
isTop?: boolean;
|
|
796
|
-
[key: string]: unknown;
|
|
797
1159
|
}
|
|
798
|
-
/**
|
|
799
|
-
interface
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
maxMemberNum: number;
|
|
807
|
-
remarkName?: string;
|
|
808
|
-
isTop?: boolean;
|
|
809
|
-
groupCreateTime?: number;
|
|
810
|
-
[key: string]: unknown;
|
|
1160
|
+
/** 带分类的好友列表项(get_friends_with_category 返回)。 */
|
|
1161
|
+
interface FriendCategory {
|
|
1162
|
+
categoryId: number;
|
|
1163
|
+
categorySortId: number;
|
|
1164
|
+
categoryName: string;
|
|
1165
|
+
categoryMbCount: number;
|
|
1166
|
+
onlineCount: number;
|
|
1167
|
+
buddyList: Friend[];
|
|
811
1168
|
}
|
|
812
|
-
/**
|
|
813
|
-
interface
|
|
814
|
-
|
|
815
|
-
uin:
|
|
816
|
-
nick
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
memberSpecialTitle?: string;
|
|
824
|
-
sex?: number;
|
|
825
|
-
age?: number;
|
|
826
|
-
isRobot?: boolean;
|
|
827
|
-
[key: string]: unknown;
|
|
1169
|
+
/** 可疑好友申请(OB11 结构,get_doubt_friends_add_request 返回)。 */
|
|
1170
|
+
interface DoubtFriendRequestInfo {
|
|
1171
|
+
flag: string;
|
|
1172
|
+
uin: number;
|
|
1173
|
+
nick?: string;
|
|
1174
|
+
source?: string;
|
|
1175
|
+
reason?: string;
|
|
1176
|
+
msg?: string;
|
|
1177
|
+
group_code?: string;
|
|
1178
|
+
time?: string;
|
|
1179
|
+
type: "doubt";
|
|
828
1180
|
}
|
|
829
|
-
/**
|
|
830
|
-
interface
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
kickMemberV2(param: KickMemberV2Req): Promise<GeneralCallResult>;
|
|
862
|
-
/** 成员禁言(set_group_ban;timeStamp=0 解除禁言)。 */
|
|
863
|
-
setMemberShutUp(groupCode: string, memberTimes: Array<{
|
|
864
|
-
uid: string;
|
|
865
|
-
timeStamp: number;
|
|
866
|
-
}>): Promise<GeneralCallResult>;
|
|
867
|
-
/** 全员禁言(set_group_whole_ban)。 */
|
|
868
|
-
setGroupShutUp(groupCode: string, shutUp: boolean): Promise<GeneralCallResult>;
|
|
869
|
-
/** 设置管理员(set_group_admin;void 语义,乐观处理)。 */
|
|
870
|
-
modifyMemberRole(groupCode: string, uid: string, role: NTGroupMemberRole): void;
|
|
871
|
-
/** 设置群名片(set_group_card;void 语义)。 */
|
|
872
|
-
modifyMemberCardName(groupCode: string, uid: string, cardName: string): void;
|
|
873
|
-
/** 修改群名(set_group_name)。 */
|
|
874
|
-
modifyGroupName(groupCode: string, groupName: string, isNormalMember: boolean): Promise<GeneralCallResult>;
|
|
875
|
-
/** 退群(set_group_leave)。 */
|
|
876
|
-
quitGroupV2(param: {
|
|
877
|
-
groupCode: string;
|
|
878
|
-
needDeleteLocalMsg: boolean;
|
|
879
|
-
}): Promise<GeneralCallResult>;
|
|
880
|
-
/** 设置精华消息(msgSeq/msgRandom 取自消息本体)。 */
|
|
881
|
-
addGroupEssence(param: {
|
|
882
|
-
groupCode: string;
|
|
883
|
-
msgRandom: number;
|
|
884
|
-
msgSeq: number;
|
|
885
|
-
}): Promise<unknown>;
|
|
886
|
-
/** 取消精华消息。 */
|
|
887
|
-
removeGroupEssence(param: {
|
|
888
|
-
groupCode: string;
|
|
889
|
-
msgRandom: number;
|
|
890
|
-
msgSeq: number;
|
|
891
|
-
}): Promise<unknown>;
|
|
892
|
-
/** @all 剩余次数(get_group_at_all_remain)。 */
|
|
893
|
-
getGroupRemainAtTimes(groupCode: string): Promise<Omit<GeneralCallResult, "result"> & {
|
|
894
|
-
errCode: number;
|
|
895
|
-
atInfo: GroupRemainAtTimes;
|
|
896
|
-
}>;
|
|
897
|
-
/** 单屏通知列表(get_group_system_msg / set_group_add_request 共用;列表可能走 listener,宽松解包)。 */
|
|
898
|
-
getSingleScreenNotifies(doubt: boolean, startSeq: string, count: number): Promise<GeneralCallResult & {
|
|
899
|
-
result?: unknown;
|
|
900
|
-
}>;
|
|
901
|
-
/** 禁言成员列表(get_group_shut_list;同 listener 风格,宽松解包)。 */
|
|
902
|
-
getGroupShutUpMemberList(groupCode: string): Promise<GeneralCallResult & {
|
|
903
|
-
result?: unknown;
|
|
904
|
-
}>;
|
|
905
|
-
/** 处理群请求(set_group_add_request 应答;postscript 空值可能导致失败,默认空格)。 */
|
|
906
|
-
operateSysNotify(doubt: boolean, operateMsg: {
|
|
907
|
-
operateType: NTGroupRequestOperateTypes;
|
|
908
|
-
targetMsg: {
|
|
909
|
-
seq: string;
|
|
910
|
-
type: GroupNotifyMsgType;
|
|
911
|
-
groupCode: string;
|
|
912
|
-
postscript: string;
|
|
913
|
-
};
|
|
914
|
-
}): Promise<void>;
|
|
1181
|
+
/** FriendApi 构造选项。 */
|
|
1182
|
+
interface FriendApiOptions {
|
|
1183
|
+
/** uid→uin 转换器(通常注入 GroupApi.uidToUin);缺省 uin 退化为 uid。 */
|
|
1184
|
+
uidToUin?: (uids: string[]) => Promise<Map<string, string>>;
|
|
1185
|
+
}
|
|
1186
|
+
/** 好友 API:从 session 拿 buddy service,包装成语义化方法。 */
|
|
1187
|
+
declare class FriendApi {
|
|
1188
|
+
private readonly service;
|
|
1189
|
+
private readonly uidToUin;
|
|
1190
|
+
constructor(session: NodeIQQNTWrapperSession, opts?: FriendApiOptions);
|
|
1191
|
+
/** 好友列表(分类拍平为 Friend[];昵称/备注从 service 缓存读取)。 */
|
|
1192
|
+
getFriendList(): Promise<Friend[]>;
|
|
1193
|
+
/** 带分类的好友列表(get_friends_with_category,分类保留)。 */
|
|
1194
|
+
getFriendCategories(): Promise<FriendCategory[]>;
|
|
1195
|
+
/** 原始分类(getBuddyListV2 / 缓存)。 */
|
|
1196
|
+
private getBuddyCategories;
|
|
1197
|
+
/** 判断是否好友。 */
|
|
1198
|
+
isBuddy(uid: string): boolean;
|
|
1199
|
+
/** 好友申请列表(set_friend_add_request 应答前查找匹配项)。 */
|
|
1200
|
+
getBuddyReqList(): Promise<BuddyReq[]>;
|
|
1201
|
+
/** 应答好友申请(accept=true 同意;remark 由调用方另行 setFriendRemark)。 */
|
|
1202
|
+
handleFriendRequest(notify: BuddyReq, accept: boolean): Promise<void>;
|
|
1203
|
+
/** 设置好友备注(void 语义乐观处理)。 */
|
|
1204
|
+
setFriendRemark(uid: string, remark: string): void;
|
|
1205
|
+
/** 删除好友(tempBlock=拉黑,tempBothDel=双向删除)。 */
|
|
1206
|
+
deleteFriend(uid: string, tempBlock?: boolean, tempBothDel?: boolean): Promise<void>;
|
|
1207
|
+
/** 可疑好友申请列表(get_doubt_friends_add_request;uin 经 uidToUin 转换)。 */
|
|
1208
|
+
getDoubtFriendRequest(count: number): Promise<DoubtFriendRequestInfo[]>;
|
|
1209
|
+
/** 单项转换:DoubtBuddyReq → OB11 结构(可选字段条件赋值,exactOptionalPropertyTypes)。 */
|
|
1210
|
+
private toDoubtFriendRequestInfo;
|
|
1211
|
+
/** 处理可疑好友申请(set_doubt_friends_add_request;uid=flag)。 */
|
|
1212
|
+
handleDoubtFriendRequest(uid: string): void;
|
|
915
1213
|
}
|
|
916
1214
|
//#endregion
|
|
917
1215
|
//#region src/apis/group.d.ts
|
|
@@ -921,7 +1219,14 @@ declare class GroupApi {
|
|
|
921
1219
|
/** 精华消息需要 msg service(按 msgId 拉消息取 msgSeq/msgRandom)。 */
|
|
922
1220
|
private readonly msgService;
|
|
923
1221
|
constructor(session: NodeIQQNTWrapperSession);
|
|
924
|
-
/**
|
|
1222
|
+
/**
|
|
1223
|
+
* 群列表(force=true 触发原生刷新)。
|
|
1224
|
+
*
|
|
1225
|
+
* ⚠️ 实测校准(2026-08-08 端到端联调):原生 getGroupList 返回仅
|
|
1226
|
+
* `{ result, errMsg }`——**列表数据经 onGroupListUpdate 事件推送**,
|
|
1227
|
+
* 不走返回值。消费群列表一律从 `GroupCache.listGroups()` 读(缓存由
|
|
1228
|
+
* 事件主动维护);本方法仅作「触发刷新」用,返回值恒为 []。
|
|
1229
|
+
*/
|
|
925
1230
|
getGroupList(force?: boolean): Promise<Group[]>;
|
|
926
1231
|
/** 群详情(groupCode 为群号字符串)。
|
|
927
1232
|
* getGroupDetailInfo 返回形状:失败 result=错误码;成功详情可能直接在 result
|
|
@@ -986,61 +1291,6 @@ declare class GroupNotifyApi {
|
|
|
986
1291
|
handleGroupRequest(doubt: boolean, notify: GroupNotify, operateType: NTGroupRequestOperateTypes, reason: string): Promise<void>;
|
|
987
1292
|
}
|
|
988
1293
|
//#endregion
|
|
989
|
-
//#region src/types/message-element.d.ts
|
|
990
|
-
/** NT RawMessage → canonical 元素(与 toSendElements 对称,接收方向)。 */
|
|
991
|
-
declare function toCanonicalElements(msg: RawMessage): CanonicalElement[];
|
|
992
|
-
/** canonical 元素 → NT 发送元素(text/at/face/image/voice/reply 核心五类)。 */
|
|
993
|
-
declare function toSendElements(elements: CanonicalElement[]): SendMessageElement[];
|
|
994
|
-
/** 协议无关的规范消息元素。 */
|
|
995
|
-
type CanonicalElement = {
|
|
996
|
-
type: "text";
|
|
997
|
-
text: string;
|
|
998
|
-
} | {
|
|
999
|
-
type: "at";
|
|
1000
|
-
target: string;
|
|
1001
|
-
display?: string;
|
|
1002
|
-
} | {
|
|
1003
|
-
type: "image";
|
|
1004
|
-
path: string;
|
|
1005
|
-
url?: string;
|
|
1006
|
-
size?: {
|
|
1007
|
-
width: number;
|
|
1008
|
-
height: number;
|
|
1009
|
-
};
|
|
1010
|
-
} | {
|
|
1011
|
-
type: "face";
|
|
1012
|
-
id: string;
|
|
1013
|
-
} | {
|
|
1014
|
-
type: "voice";
|
|
1015
|
-
path: string;
|
|
1016
|
-
durationMs?: number;
|
|
1017
|
-
url?: string;
|
|
1018
|
-
} | {
|
|
1019
|
-
type: "video";
|
|
1020
|
-
path: string;
|
|
1021
|
-
url?: string;
|
|
1022
|
-
} | {
|
|
1023
|
-
type: "file";
|
|
1024
|
-
path: string;
|
|
1025
|
-
name?: string;
|
|
1026
|
-
size?: number;
|
|
1027
|
-
} | {
|
|
1028
|
-
type: "reply";
|
|
1029
|
-
messageId: string;
|
|
1030
|
-
} | {
|
|
1031
|
-
type: "forward";
|
|
1032
|
-
messageIds: string[];
|
|
1033
|
-
} | {
|
|
1034
|
-
type: "json";
|
|
1035
|
-
raw: unknown;
|
|
1036
|
-
} | {
|
|
1037
|
-
type: "xml";
|
|
1038
|
-
raw: unknown;
|
|
1039
|
-
} | {
|
|
1040
|
-
type: "unknown";
|
|
1041
|
-
raw: unknown;
|
|
1042
|
-
};
|
|
1043
|
-
//#endregion
|
|
1044
1294
|
//#region src/apis/msg.d.ts
|
|
1045
1295
|
/** 消息 API:从 session 拿 msg service,包装成语义化方法。 */
|
|
1046
1296
|
declare class MsgApi {
|
|
@@ -1112,36 +1362,7 @@ declare class MsgApi {
|
|
|
1112
1362
|
}): Promise<void>;
|
|
1113
1363
|
}
|
|
1114
1364
|
//#endregion
|
|
1115
|
-
//#region src/
|
|
1116
|
-
/** forceFetchClientKey 返回(get_clientkey 直接返回,get_cookies 用 clientKey 换跳转票据)。 */
|
|
1117
|
-
interface ForceFetchClientKeyRetType extends GeneralCallResult {
|
|
1118
|
-
url: string;
|
|
1119
|
-
keyIndex: string;
|
|
1120
|
-
clientKey: string;
|
|
1121
|
-
expireTime: string;
|
|
1122
|
-
}
|
|
1123
|
-
/** 票据服务。 */
|
|
1124
|
-
interface NodeIKernelTicketService {
|
|
1125
|
-
addKernelTicketListener(listener: unknown): number;
|
|
1126
|
-
removeKernelTicketListener(listenerId: number): void;
|
|
1127
|
-
forceFetchClientKey(arg: string): Promise<ForceFetchClientKeyRetType>;
|
|
1128
|
-
isNull(): boolean;
|
|
1129
|
-
}
|
|
1130
|
-
//#endregion
|
|
1131
|
-
//#region src/apis/ticket.d.ts
|
|
1132
|
-
/** 票据 API:从 session 拿 ticket service,包装成语义化方法。 */
|
|
1133
|
-
declare class TicketApi {
|
|
1134
|
-
private readonly service;
|
|
1135
|
-
constructor(session: NodeIQQNTWrapperSession);
|
|
1136
|
-
/** 获取 clientKey(get_clientkey)。 */
|
|
1137
|
-
getClientKey(): Promise<ForceFetchClientKeyRetType>;
|
|
1138
|
-
/** 获取指定域名的 cookies(get_cookies;uin 为机器人 QQ 号)。 */
|
|
1139
|
-
getCookies(domain: string, uin: string): Promise<Record<string, string>>;
|
|
1140
|
-
/** 计算 bkn(get_csrf_token 与 web 接口共用;skey → bkn 哈希)。 */
|
|
1141
|
-
static getBkn(skey: string): string;
|
|
1142
|
-
}
|
|
1143
|
-
//#endregion
|
|
1144
|
-
//#region src/apis/profile.d.ts
|
|
1365
|
+
//#region src/apis/stranger-info.d.ts
|
|
1145
1366
|
/** 陌生人信息(get_stranger_info 返回)。 */
|
|
1146
1367
|
interface StrangerInfo {
|
|
1147
1368
|
user_id: number;
|
|
@@ -1160,6 +1381,8 @@ interface StrangerInfo {
|
|
|
1160
1381
|
status: number;
|
|
1161
1382
|
login_days: number;
|
|
1162
1383
|
}
|
|
1384
|
+
//#endregion
|
|
1385
|
+
//#region src/apis/profile.d.ts
|
|
1163
1386
|
/** 资料 API:从 session 拿 profile service,包装成语义化方法。 */
|
|
1164
1387
|
declare class ProfileApi {
|
|
1165
1388
|
private readonly service;
|
|
@@ -1183,78 +1406,6 @@ declare class ProfileLikeApi {
|
|
|
1183
1406
|
sendLike(uid: string, count?: number): Promise<void>;
|
|
1184
1407
|
}
|
|
1185
1408
|
//#endregion
|
|
1186
|
-
//#region src/types/services/richmedia-service.d.ts
|
|
1187
|
-
/** 群文件列表参数(getGroupFileList,说明书参考)。 */
|
|
1188
|
-
interface GetFileListParam {
|
|
1189
|
-
sortType: number;
|
|
1190
|
-
fileCount: number;
|
|
1191
|
-
startIndex: number;
|
|
1192
|
-
sortOrder: number;
|
|
1193
|
-
showOnlinedocFolder: number;
|
|
1194
|
-
}
|
|
1195
|
-
/** 群文件项(getGroupFileList 返回的 fileInfo,说明书参考,待探测校准)。 */
|
|
1196
|
-
interface GroupFileItemInfo {
|
|
1197
|
-
fileId: string;
|
|
1198
|
-
fileName: string;
|
|
1199
|
-
fileSize: string;
|
|
1200
|
-
fileUuid?: string;
|
|
1201
|
-
parent?: string;
|
|
1202
|
-
uploadTime?: number;
|
|
1203
|
-
modifyTime?: number;
|
|
1204
|
-
uploaderUid?: string;
|
|
1205
|
-
uploaderUin?: string;
|
|
1206
|
-
[key: string]: unknown;
|
|
1207
|
-
}
|
|
1208
|
-
/** 群文件夹项(getGroupFileList 返回的 folderInfo,说明书参考,待探测校准)。 */
|
|
1209
|
-
interface GroupFolderInfo {
|
|
1210
|
-
folderId: string;
|
|
1211
|
-
folderName: string;
|
|
1212
|
-
folderPath?: string;
|
|
1213
|
-
folderUid?: string;
|
|
1214
|
-
[key: string]: unknown;
|
|
1215
|
-
}
|
|
1216
|
-
/** 群文件空间信息(getGroupFileList 的 groupSpaceResult,说明书参考)。 */
|
|
1217
|
-
interface GroupSpaceInfo {
|
|
1218
|
-
retCode: number;
|
|
1219
|
-
retMsg: string;
|
|
1220
|
-
clientWording: string;
|
|
1221
|
-
totalSpace: number;
|
|
1222
|
-
usedSpace: number;
|
|
1223
|
-
allUpload: boolean;
|
|
1224
|
-
}
|
|
1225
|
-
/** 富媒体服务。 */
|
|
1226
|
-
interface NodeIKernelRichMediaService {
|
|
1227
|
-
addKernelRichMediaListener(listener: unknown): number;
|
|
1228
|
-
removeKernelRichMediaListener(listenerId: number): void;
|
|
1229
|
-
/** 英文单词翻译(translate_en2zh)。 */
|
|
1230
|
-
translateEnWordToZn(words: string[]): Promise<GeneralCallResult & {
|
|
1231
|
-
words?: string[];
|
|
1232
|
-
}>;
|
|
1233
|
-
/** 群文件列表(get_group_root_files / get_group_files_by_folder)。 */
|
|
1234
|
-
getGroupFileList(groupCode: string, params: GetFileListParam): Promise<GeneralCallResult & {
|
|
1235
|
-
groupSpaceResult?: GroupSpaceInfo;
|
|
1236
|
-
result?: unknown;
|
|
1237
|
-
}>;
|
|
1238
|
-
/** 创建群文件夹(create_group_file_folder)。 */
|
|
1239
|
-
createGroupFolder(groupCode: string, folderName: string): Promise<GeneralCallResult>;
|
|
1240
|
-
/** 删除群文件(delete_group_file;params 业务类型,Files 为文件 ID 列表)。 */
|
|
1241
|
-
deleteGroupFile(groupCode: string, params: number[], files: string[]): Promise<GeneralCallResult>;
|
|
1242
|
-
/** 删除群文件夹(delete_group_folder)。 */
|
|
1243
|
-
deleteGroupFolder(groupCode: string, folderId: string): Promise<GeneralCallResult>;
|
|
1244
|
-
/** 重命名群文件(rename_group_file;参数待探测校准)。 */
|
|
1245
|
-
renameGroupFile(arg1: string, arg2: number, arg3: string, arg4: string, arg5: string): Promise<unknown>;
|
|
1246
|
-
/** 移动群文件(move_group_file)。 */
|
|
1247
|
-
moveGroupFile(groupCode: string, busId: number[], fileList: string[], currentParentDirectory: string, targetParentDirectory: string): Promise<GeneralCallResult>;
|
|
1248
|
-
/** 转存群文件(trans_group_file)。 */
|
|
1249
|
-
transGroupFile(groupCode: string, fileId: string): Promise<GeneralCallResult>;
|
|
1250
|
-
/** 批量群文件数(get_group_file_system_info 补充)。 */
|
|
1251
|
-
batchGetGroupFileCount(groupCodes: string[]): Promise<GeneralCallResult & {
|
|
1252
|
-
groupCodes?: string[];
|
|
1253
|
-
groupFileCounts?: number[];
|
|
1254
|
-
}>;
|
|
1255
|
-
isNull(): boolean;
|
|
1256
|
-
}
|
|
1257
|
-
//#endregion
|
|
1258
1409
|
//#region src/apis/richmedia.d.ts
|
|
1259
1410
|
/** 群文件列表条目(fileInfo/folderInfo 取其一)。 */
|
|
1260
1411
|
interface GroupFileListItem {
|
|
@@ -1292,6 +1443,19 @@ declare class RichMediaApi {
|
|
|
1292
1443
|
transGroupFile(groupCode: string, fileId: string): Promise<void>;
|
|
1293
1444
|
}
|
|
1294
1445
|
//#endregion
|
|
1446
|
+
//#region src/apis/ticket.d.ts
|
|
1447
|
+
/** 票据 API:从 session 拿 ticket service,包装成语义化方法。 */
|
|
1448
|
+
declare class TicketApi {
|
|
1449
|
+
private readonly service;
|
|
1450
|
+
constructor(session: NodeIQQNTWrapperSession);
|
|
1451
|
+
/** 获取 clientKey(get_clientkey)。 */
|
|
1452
|
+
getClientKey(): Promise<ForceFetchClientKeyRetType>;
|
|
1453
|
+
/** 获取指定域名的 cookies(get_cookies;uin 为机器人 QQ 号)。 */
|
|
1454
|
+
getCookies(domain: string, uin: string): Promise<Record<string, string>>;
|
|
1455
|
+
/** 计算 bkn(get_csrf_token 与 web 接口共用;skey → bkn 哈希)。 */
|
|
1456
|
+
static getBkn(skey: string): string;
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1295
1459
|
//#region src/apis/webapi.d.ts
|
|
1296
1460
|
/** 精华消息项(digest_list 返回 data.msg_list 成员,说明书参考)。 */
|
|
1297
1461
|
interface EssenceMsgItem {
|
|
@@ -1378,78 +1542,37 @@ type ListenerEvents<L extends ListenerShape, Name extends string> = { [K in keyo
|
|
|
1378
1542
|
declare class NTEventChannel<L extends ListenerShape, Name extends string> {
|
|
1379
1543
|
readonly serviceName: Name;
|
|
1380
1544
|
private readonly emitter;
|
|
1381
|
-
private readonly errorHandlers;
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
*
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
*
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
/**
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
readonly ALL: 0;
|
|
1412
|
-
/** 增量更新(合并到现有缓存)。 */
|
|
1413
|
-
readonly PARTIAL: 1;
|
|
1414
|
-
};
|
|
1415
|
-
type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
|
|
1416
|
-
/** 成员数据来源(onMemberInfoChange 第二参,说明书参考)。 */
|
|
1417
|
-
declare const GroupMemberDataSource: {
|
|
1418
|
-
/** 本地缓存。 */
|
|
1419
|
-
readonly CACHE: 0;
|
|
1420
|
-
/** 网络拉取。 */
|
|
1421
|
-
readonly NETWORK: 1;
|
|
1422
|
-
};
|
|
1423
|
-
type GroupMemberDataSource = (typeof GroupMemberDataSource)[keyof typeof GroupMemberDataSource];
|
|
1424
|
-
/** onMemberListChange 参数(sceneId 为群号 groupCode)。 */
|
|
1425
|
-
interface GroupMemberListChange {
|
|
1426
|
-
sceneId: string;
|
|
1427
|
-
ids: string[];
|
|
1428
|
-
/** uid → GroupMember。 */
|
|
1429
|
-
infos: Map<string, GroupMember>;
|
|
1430
|
-
hasPrev: boolean;
|
|
1431
|
-
hasNext: boolean;
|
|
1432
|
-
hasRobot: boolean;
|
|
1545
|
+
private readonly errorHandlers;
|
|
1546
|
+
private readonly anyHandlers;
|
|
1547
|
+
constructor(serviceName: Name);
|
|
1548
|
+
/**
|
|
1549
|
+
* 订阅事件:返回 unsubscribe(只注销该 handler,不影响其他订阅者)。
|
|
1550
|
+
* 每个 Service 只注册一次原生监听,缓存维护与协议翻译都订阅这里。
|
|
1551
|
+
*/
|
|
1552
|
+
on<E extends EventName<L, Name>>(event: E, handler: EventHandler<L, Name, E>): () => void;
|
|
1553
|
+
/**
|
|
1554
|
+
* 请求-响应桥:注册临时监听 → filter 命中 → resolve;超时自动清理并 reject。
|
|
1555
|
+
* 替代魔法字符串事件名方案。
|
|
1556
|
+
*/
|
|
1557
|
+
waitFor<E extends EventName<L, Name>>(event: E, opts?: {
|
|
1558
|
+
filter?: (...args: EventArgs<L, Name, E>) => boolean;
|
|
1559
|
+
timeout?: number;
|
|
1560
|
+
}): Promise<EventArgs<L, Name, E>>;
|
|
1561
|
+
/**
|
|
1562
|
+
* 类型化派发:wrapper-loader 的原生回调经此推入通道。
|
|
1563
|
+
* 2026-08-07 修复:原生 EventEmitter.emit 中一个 listener 抛异常会中断后续
|
|
1564
|
+
* listener 派发(Node 语义)——改为快照数组逐个 try/catch,保证「单个订阅者
|
|
1565
|
+
* 异常不打断派发」(协议翻译层异常不饿死缓存维护等其他订阅者)。
|
|
1566
|
+
*/
|
|
1567
|
+
/**
|
|
1568
|
+
* 订阅所有事件(IPC 子进程模式整通道转发用:事件名 `"${service}/${method}"`
|
|
1569
|
+
* 经 handler 首参透出,args 原样透传)。返回退订函数。
|
|
1570
|
+
*/
|
|
1571
|
+
onAny(handler: (event: string, ...args: unknown[]) => void): () => void;
|
|
1572
|
+
emit<E extends EventName<L, Name>>(event: E, ...args: EventArgs<L, Name, E>): void;
|
|
1573
|
+
/** 订阅错误通知(监听器抛出的异常 / 其他内部错误)。 */
|
|
1574
|
+
onError(handler: (err: unknown) => void): () => void;
|
|
1433
1575
|
}
|
|
1434
|
-
/** 群服务(GroupService)的原生回调监听接口。 */
|
|
1435
|
-
type GroupListener = {
|
|
1436
|
-
/** 群列表初始化完成(listEmpty:是否无群)。 */
|
|
1437
|
-
onGroupListInited: (listEmpty: boolean) => void;
|
|
1438
|
-
/** 群列表更新。 */
|
|
1439
|
-
onGroupListUpdate: (updateType: GroupListUpdateType, groupList: Group[]) => void;
|
|
1440
|
-
/** 群详情变化。 */
|
|
1441
|
-
onGroupDetailInfoChange: (detailInfo: GroupDetailInfo) => void;
|
|
1442
|
-
/** 群成员列表变化(sceneId=groupCode)。 */
|
|
1443
|
-
onMemberListChange: (arg: GroupMemberListChange) => void;
|
|
1444
|
-
/** 群成员信息变化(dataSource 区分本地缓存/网络)。 */
|
|
1445
|
-
onMemberInfoChange: (groupCode: string, dataSource: GroupMemberDataSource, members: Map<string, GroupMember>) => void;
|
|
1446
|
-
/** 群通知更新(doubt:是否可疑/忽略列表)。 */
|
|
1447
|
-
onGroupNotifiesUpdated: (doubt: boolean, notifies: GroupNotify[]) => void;
|
|
1448
|
-
/** 群通知单屏(分页 seq)。 */
|
|
1449
|
-
onGroupSingleScreenNotifies: (doubt: boolean, seq: string, notifies: GroupNotify[]) => void;
|
|
1450
|
-
/** 群禁言成员列表变化。 */
|
|
1451
|
-
onShutUpMemberListChanged: (groupCode: string, members: ShutUpGroupMember[]) => void;
|
|
1452
|
-
};
|
|
1453
1576
|
//#endregion
|
|
1454
1577
|
//#region src/bridge/group-bridge.d.ts
|
|
1455
1578
|
/** 群事件通道的固定类型(事件名前缀 "Group")。 */
|
|
@@ -1469,34 +1592,6 @@ declare class GroupBridge {
|
|
|
1469
1592
|
unregister(): void;
|
|
1470
1593
|
}
|
|
1471
1594
|
//#endregion
|
|
1472
|
-
//#region src/types/listeners/msg.d.ts
|
|
1473
|
-
/** 消息已读上报(peer + 已读 seq)。 */
|
|
1474
|
-
interface MsgReadReportItem {
|
|
1475
|
-
peer: unknown;
|
|
1476
|
-
readSeq: string;
|
|
1477
|
-
}
|
|
1478
|
-
/** 消息回执(msgId + 已读 seq)。 */
|
|
1479
|
-
interface MsgReceipt {
|
|
1480
|
-
msgId: string;
|
|
1481
|
-
readSeq: string;
|
|
1482
|
-
}
|
|
1483
|
-
/** 消息服务(MsgService)的原生回调监听接口。
|
|
1484
|
-
* 用 type 别名(非 interface):需满足 ListenerShape(Record<string, unknown>)
|
|
1485
|
-
* 约束——interface 无隐式索引签名不兼容;type 对象类型天然满足。
|
|
1486
|
-
*
|
|
1487
|
-
* ⚠️ 2026-08-07 运行时探测实证(自建宿主,QQ 9.9.33):onRecvMsg 回调参数是
|
|
1488
|
-
* **消息数组**(多条批量推送),非单条 RawMessage——此前单条签名错误(收到数组后
|
|
1489
|
-
* msg.msgId/elements 全 undefined)。信号链:原生回调 → MsgBridge 透传数组 →
|
|
1490
|
-
* 事件通道 → 订阅方遍历处理。 */
|
|
1491
|
-
type MsgListener = {
|
|
1492
|
-
/** 收到新消息(批量数组,运行时实证)。 */
|
|
1493
|
-
onRecvMsg: (msgs: RawMessage[]) => void;
|
|
1494
|
-
/** 消息已读上报。 */
|
|
1495
|
-
onRecvMsgReadReport: (reports: MsgReadReportItem[]) => void;
|
|
1496
|
-
/** 消息回执。 */
|
|
1497
|
-
onRecvMsgReceipt: (receipts: MsgReceipt[]) => void;
|
|
1498
|
-
};
|
|
1499
|
-
//#endregion
|
|
1500
1595
|
//#region src/bridge/msg-bridge.d.ts
|
|
1501
1596
|
/** 消息事件通道的固定类型(事件名前缀 "Msg")。 */
|
|
1502
1597
|
type MsgEventChannel = NTEventChannel<MsgListener, "Msg">;
|
|
@@ -1548,6 +1643,21 @@ declare class GroupCache {
|
|
|
1548
1643
|
private upsertMembers;
|
|
1549
1644
|
/** 群列表是否已有缓存(同步判断)。 */
|
|
1550
1645
|
hasGroup(groupCode: string): boolean;
|
|
1646
|
+
/**
|
|
1647
|
+
* 群列表快照(只读,缓存由 onGroupListUpdate 事件主动维护)。
|
|
1648
|
+
* 群列表数据不走原生 getGroupList 返回值(实测仅 { result, errMsg },
|
|
1649
|
+
* 列表经事件推送)——协议/IPC 层消费列表一律经此方法。
|
|
1650
|
+
*/
|
|
1651
|
+
listGroups(): Group[];
|
|
1652
|
+
/**
|
|
1653
|
+
* 群列表快照(缓存为空时主动触发原生刷新,等待事件回填后返回)。
|
|
1654
|
+
*
|
|
1655
|
+
* 实测(2026-08-08 端到端联调):onGroupListUpdate 仅在登录后首轮同步
|
|
1656
|
+
* 推送(MMKV 已有缓存后不再重复推送)——进程内缓存为空时列表读不到。
|
|
1657
|
+
* 触发 getGroupList(true) 会重新拉取并推送事件回填缓存。
|
|
1658
|
+
* 返回空数组 = 刷新后仍无数据(超时 5s)。
|
|
1659
|
+
*/
|
|
1660
|
+
listGroupsRefreshed(): Promise<Group[]>;
|
|
1551
1661
|
/**
|
|
1552
1662
|
* 群列表项(只读;缺失惰性回填 getGroupList)。
|
|
1553
1663
|
* 返回 undefined 表示群不存在。
|
|
@@ -1574,8 +1684,120 @@ declare class GroupCache {
|
|
|
1574
1684
|
private dedupe;
|
|
1575
1685
|
}
|
|
1576
1686
|
//#endregion
|
|
1687
|
+
//#region src/infra/config.d.ts
|
|
1688
|
+
/** 配置文本格式。 */
|
|
1689
|
+
type ConfigFormat = "json" | "toml";
|
|
1690
|
+
/**
|
|
1691
|
+
* 校验器最小接口。zod 的 `ZodType<T>`(`parse(data: unknown): T`)天然满足;
|
|
1692
|
+
* 手写校验器包装成该形状即可。
|
|
1693
|
+
*/
|
|
1694
|
+
interface ConfigSchema<T> {
|
|
1695
|
+
parse: (input: unknown) => T;
|
|
1696
|
+
}
|
|
1697
|
+
interface ConfigOptions<T> {
|
|
1698
|
+
/** 配置文件绝对路径。 */
|
|
1699
|
+
path: string;
|
|
1700
|
+
/** 校验器(协议 schema 用 zod;kernel 主配置用手写校验器包装)。 */
|
|
1701
|
+
schema: ConfigSchema<T>;
|
|
1702
|
+
/** 默认值:文件缺失时生成并落盘;校验以它为兜底。 */
|
|
1703
|
+
defaults: T;
|
|
1704
|
+
/** 内存初值(已校验对象):load() 时直接使用,跳过文件读写(全局 TOML 分段的装配方式)。 */
|
|
1705
|
+
seed?: T | undefined;
|
|
1706
|
+
/** 文本格式(缺省按扩展名推断)。 */
|
|
1707
|
+
format?: ConfigFormat | undefined;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* 配置基类。每次 `load()` / `save()` 都经过 schema 校验,
|
|
1711
|
+
* 校验失败抛 `KernelError('INVALID_PARAM')`,不静默吞掉。
|
|
1712
|
+
* - `load()`:seed 存在 → 直接用 seed;否则读文件(缺失落默认值)。
|
|
1713
|
+
* - `save()`:按格式序列化(TOML/JSON)原子写。
|
|
1714
|
+
*/
|
|
1715
|
+
declare class ConfigBase<T> {
|
|
1716
|
+
readonly path: string;
|
|
1717
|
+
readonly defaults: T;
|
|
1718
|
+
private readonly schema;
|
|
1719
|
+
private readonly format;
|
|
1720
|
+
private readonly seed;
|
|
1721
|
+
private value;
|
|
1722
|
+
constructor(opts: ConfigOptions<T>);
|
|
1723
|
+
/** 当前内存值(只读消费;外部不得直接修改返回对象)。 */
|
|
1724
|
+
get(): T;
|
|
1725
|
+
/**
|
|
1726
|
+
* 加载配置:
|
|
1727
|
+
* - seed 存在 → 直接用 seed(已校验,不读文件;全局 TOML 分段装配方式);
|
|
1728
|
+
* - 文件缺失 → 写入默认值并落盘(首次运行自动生成),返回默认值;
|
|
1729
|
+
* - 文件存在 → 读取 + 校验,更新内存,返回。
|
|
1730
|
+
*/
|
|
1731
|
+
load(): Promise<T>;
|
|
1732
|
+
/** 重新从磁盘加载(外部变更后的热更新入口,P2 配置热更新使用)。 */
|
|
1733
|
+
reload(): Promise<T>;
|
|
1734
|
+
/** 校验并落盘(原子写:临时文件 + rename),随后更新内存。 */
|
|
1735
|
+
save(next: T): Promise<void>;
|
|
1736
|
+
/** 对象 → 文本(TOML/JSON)。 */
|
|
1737
|
+
private serialize;
|
|
1738
|
+
/** 文本 → 对象(TOML/JSON)。 */
|
|
1739
|
+
private deserialize;
|
|
1740
|
+
/** 反序列化 + schema 校验,错误统一包装为 KernelError。 */
|
|
1741
|
+
private parse;
|
|
1742
|
+
}
|
|
1743
|
+
/** 解析 TOML 文本 → 对象(boot.cjs / 探测脚本等无 ConfigBase 场景复用)。 */
|
|
1744
|
+
declare function parseToml(text: string): Record<string, unknown>;
|
|
1745
|
+
/** 对象 → TOML 文本(config init 生成全局配置文件等场景)。 */
|
|
1746
|
+
declare function stringifyToml(value: Record<string, unknown>): string;
|
|
1747
|
+
//#endregion
|
|
1748
|
+
//#region src/infra/errors.d.ts
|
|
1749
|
+
/**
|
|
1750
|
+
* kernel 类型化错误(ADR-009 / ADR-017)
|
|
1751
|
+
*
|
|
1752
|
+
* apis 层内部解包原生 `{ result, errMsg }`:成功返回纯业务值,失败抛 KernelError。
|
|
1753
|
+
* 协议层只需维护 `KernelErrorCode → 协议错误码` 映射表,不解析错误逻辑。
|
|
1754
|
+
*/
|
|
1755
|
+
/**
|
|
1756
|
+
* 错误码分类。P1 探测真实错误返回后再增删。
|
|
1757
|
+
* 当前 INVALID_PARAM 也承担基础设施层(配置校验失败等)的错误语义。
|
|
1758
|
+
*/
|
|
1759
|
+
type KernelErrorCode = "SEND_FAILED" | "PERMISSION_DENIED" | "NOT_FOUND" | "TIMEOUT" | "NOT_LOGIN" | "INVALID_PARAM" | "INVALID_STATE" | "UNKNOWN";
|
|
1760
|
+
/**
|
|
1761
|
+
* 全部错误码集合。协议层映射表可据此推导:
|
|
1762
|
+
* `Record<(typeof KERNEL_ERROR_CODES)[number], number>`。
|
|
1763
|
+
*/
|
|
1764
|
+
declare const KERNEL_ERROR_CODES: readonly ["SEND_FAILED", "PERMISSION_DENIED", "NOT_FOUND", "TIMEOUT", "NOT_LOGIN", "INVALID_PARAM", "INVALID_STATE", "UNKNOWN"];
|
|
1765
|
+
/** kernel 类型化错误:apis / 基础设施层抛出的统一错误形态。 */
|
|
1766
|
+
declare class KernelError extends Error {
|
|
1767
|
+
readonly code: KernelErrorCode;
|
|
1768
|
+
constructor(message: string, code?: KernelErrorCode, options?: ErrorOptions);
|
|
1769
|
+
}
|
|
1770
|
+
/** 便捷构造:`kernelError('消息不存在', 'NOT_FOUND', { cause })`。 */
|
|
1771
|
+
declare function kernelError(message: string, code?: KernelErrorCode, options?: ErrorOptions): KernelError;
|
|
1772
|
+
/** 类型守卫:协议层 catch 统一映射时区分 KernelError 与意外错误。 */
|
|
1773
|
+
declare function isKernelError(err: unknown): err is KernelError;
|
|
1774
|
+
//#endregion
|
|
1775
|
+
//#region src/infra/logger.d.ts
|
|
1776
|
+
/** 日志级别(pino 标准级别 + silent)。 */
|
|
1777
|
+
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
1778
|
+
interface LoggerOptions {
|
|
1779
|
+
/** 日志级别,默认 `info`。 */
|
|
1780
|
+
level?: LogLevel;
|
|
1781
|
+
/** 是否输出到 console(pretty 模式),默认 true。 */
|
|
1782
|
+
console?: boolean;
|
|
1783
|
+
/** 文件日志路径;不传则不写文件(父目录自动创建)。 */
|
|
1784
|
+
file?: string;
|
|
1785
|
+
/** 附加基础字段(如 `{ name: 'kernel' }`),自动保留 pid;name 用 pino 保留字段
|
|
1786
|
+
* (logger name),pino-pretty 渲染为 `(name/pid)` 元数据头。 */
|
|
1787
|
+
base?: Record<string, unknown>;
|
|
1788
|
+
/** 追加的敏感字段路径(默认内置 token/票据等,见 DEFAULT_REDACT_PATHS)。 */
|
|
1789
|
+
redact?: string[];
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* 创建 pino logger:console(pretty)+ 可选文件,统一 level / redact。
|
|
1793
|
+
*
|
|
1794
|
+
* 文件目的地用同步写入(`sync: true`):日志量级下性能可接受,且进程退出不丢日志,
|
|
1795
|
+
* 无需额外的 flush 步骤(对比异步 SonicBoom 的 flushSync 时序陷阱)。
|
|
1796
|
+
*/
|
|
1797
|
+
declare function createLogger(opts?: LoggerOptions): pino.Logger;
|
|
1798
|
+
//#endregion
|
|
1577
1799
|
//#region src/infra/paths.d.ts
|
|
1578
|
-
/**
|
|
1800
|
+
/** 默认数据根目录名(项目根下,2026-08-08 用户拍板:不放用户目录)。 */
|
|
1579
1801
|
declare const DEFAULT_DATA_ROOT_NAME = ".napuketto";
|
|
1580
1802
|
/** 全局配置文件名。 */
|
|
1581
1803
|
declare const MAIN_CONFIG_FILE = "napuketto.toml";
|
|
@@ -1586,7 +1808,8 @@ interface PathOptions {
|
|
|
1586
1808
|
account?: string;
|
|
1587
1809
|
}
|
|
1588
1810
|
/**
|
|
1589
|
-
* 解析数据根:显式参数 > 环境变量 >
|
|
1811
|
+
* 解析数据根:显式参数 > 环境变量 > `<项目根>/.napuketto`(默认)> 用户目录兜底(裸脚本)。
|
|
1812
|
+
* 支持 `~` 前缀(展开为用户主目录)与相对路径(相对 cwd 解析)。
|
|
1590
1813
|
* 返回绝对路径。独立导出便于 cli / 探测脚本复用。
|
|
1591
1814
|
*/
|
|
1592
1815
|
declare function resolveDataRoot(dataRoot?: string): string;
|
|
@@ -1600,9 +1823,8 @@ interface ConfigPathOptions {
|
|
|
1600
1823
|
*
|
|
1601
1824
|
* 优先级:
|
|
1602
1825
|
* 1. `NAPKETTO_CONFIG` 环境变量(显式指定完整路径,任意场景可用)
|
|
1603
|
-
* 2.
|
|
1604
|
-
* 3.
|
|
1605
|
-
* 4. 数据根兜底 `<dataRoot>/napuketto.toml`(旧行为兼容)
|
|
1826
|
+
* 2. 项目根探测(入口模块向上找 pnpm-workspace.yaml → cwd 向上找,见 resolveProjectRoot)
|
|
1827
|
+
* 3. 数据根兜底 `<dataRoot>/napuketto.toml`(旧行为兼容)
|
|
1606
1828
|
*
|
|
1607
1829
|
* 返回绝对路径。独立导出便于 cli / loader 装配链复用。
|
|
1608
1830
|
*/
|
|
@@ -1741,18 +1963,7 @@ interface StartNapukettoOptions {
|
|
|
1741
1963
|
qqLoginService?: unknown;
|
|
1742
1964
|
}
|
|
1743
1965
|
//#endregion
|
|
1744
|
-
//#region src/login/
|
|
1745
|
-
/**
|
|
1746
|
-
* 等待 QQ 自己完成 session 初始化(framework 复用模式,2026-08-05 修正)。
|
|
1747
|
-
*
|
|
1748
|
-
* 背景:QQ 9.9.31 实测——session 由 QQ 主进程自己创建并 init(登录后)。
|
|
1749
|
-
* 我们不自己 init(重复 init 断言 "implementation of IQQNTWrapperSession is not valid"),
|
|
1750
|
-
* 也不自己 create(登录前 create() 干扰 QQ,实测 QQ 退出 code=0)。
|
|
1751
|
-
* 正确做法:等 QQ 的 session 就绪(getMsgService 非 null = 核心 service 已挂载)。
|
|
1752
|
-
*/
|
|
1753
|
-
declare function waitSessionReady(ctx: WrapperContext, opts: {
|
|
1754
|
-
timeoutMs?: number;
|
|
1755
|
-
}): Promise<void>;
|
|
1966
|
+
//#region src/login/login-connect.d.ts
|
|
1756
1967
|
/** 登录结果(QR 或快速登录)。 */
|
|
1757
1968
|
interface LoginResult {
|
|
1758
1969
|
uin: string;
|
|
@@ -1785,11 +1996,77 @@ declare function quickLogin(ctx: WrapperContext, opts: {
|
|
|
1785
1996
|
uin?: string;
|
|
1786
1997
|
timeoutMs?: number;
|
|
1787
1998
|
}): Promise<LoginResult>;
|
|
1999
|
+
//#endregion
|
|
2000
|
+
//#region src/login/lifecycle.d.ts
|
|
2001
|
+
/**
|
|
2002
|
+
* 等待 QQ 自己完成 session 初始化(framework 复用模式,2026-08-05 修正)。
|
|
2003
|
+
*
|
|
2004
|
+
* 背景:QQ 9.9.31 实测——session 由 QQ 主进程自己创建并 init(登录后)。
|
|
2005
|
+
* 我们不自己 init(重复 init 断言 "implementation of IQQNTWrapperSession is not valid"),
|
|
2006
|
+
* 也不自己 create(登录前 create() 干扰 QQ,实测 QQ 退出 code=0)。
|
|
2007
|
+
* 正确做法:等 QQ 的 session 就绪(getMsgService 非 null = 核心 service 已挂载)。
|
|
2008
|
+
*/
|
|
2009
|
+
declare function waitSessionReady(ctx: WrapperContext, opts: {
|
|
2010
|
+
timeoutMs?: number;
|
|
2011
|
+
}): Promise<void>;
|
|
2012
|
+
/** 登录连接 + 快速登录(quickLogin 等)已拆到 login-connect.ts(见文件头 re-export)。 */
|
|
1788
2013
|
/** session 初始化(4 参全为普通 JS 对象,等 init 完成信号)。 */
|
|
1789
2014
|
declare function initAndStartSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener: NodeIKernelSessionListener, opts: {
|
|
1790
2015
|
timeoutMs?: number;
|
|
1791
2016
|
}): Promise<void>;
|
|
1792
2017
|
//#endregion
|
|
2018
|
+
//#region src/login/login.d.ts
|
|
2019
|
+
/** 登录状态。 */
|
|
2020
|
+
type LoginState = "idle" | "waiting_scan" | "scanned" | "logged_in" | "failed";
|
|
2021
|
+
/** 二维码数据(png base64 + 解码 url)。 */
|
|
2022
|
+
interface QrCodeData {
|
|
2023
|
+
pngBase64: string;
|
|
2024
|
+
qrcodeUrl: string;
|
|
2025
|
+
}
|
|
2026
|
+
/** selfInfo(登录成功后填写)。 */
|
|
2027
|
+
interface SelfInfo {
|
|
2028
|
+
uin: string;
|
|
2029
|
+
uid: string;
|
|
2030
|
+
nick: string;
|
|
2031
|
+
}
|
|
2032
|
+
/** 快速登录项。 */
|
|
2033
|
+
interface LoginListItem {
|
|
2034
|
+
uin: string;
|
|
2035
|
+
uid?: string;
|
|
2036
|
+
nickName?: string;
|
|
2037
|
+
isQuickLogin?: boolean;
|
|
2038
|
+
}
|
|
2039
|
+
/** QR 登录会话(状态机 + 回调订阅)。 */
|
|
2040
|
+
declare class QrLoginSession {
|
|
2041
|
+
private readonly loginService;
|
|
2042
|
+
private state;
|
|
2043
|
+
private listenerId;
|
|
2044
|
+
private self;
|
|
2045
|
+
private readonly qrCodeHandlers;
|
|
2046
|
+
private readonly stateHandlers;
|
|
2047
|
+
constructor(loginService: unknown);
|
|
2048
|
+
/** 当前状态。 */
|
|
2049
|
+
get currentState(): LoginState;
|
|
2050
|
+
/** selfInfo(登录成功后有值)。 */
|
|
2051
|
+
get selfInfo(): SelfInfo | null;
|
|
2052
|
+
/** 订阅二维码(png base64 + url)。返回退订函数。 */
|
|
2053
|
+
onQrCode(cb: (qr: QrCodeData) => void): () => void;
|
|
2054
|
+
/** 订阅状态变化。返回退订函数。 */
|
|
2055
|
+
onStateChange(cb: (state: LoginState) => void): () => void;
|
|
2056
|
+
/** 开始登录:注册监听 → connect → 快速登录(指定账号)或触发二维码。 */
|
|
2057
|
+
start(opts?: {
|
|
2058
|
+
quickUin?: string;
|
|
2059
|
+
}): void;
|
|
2060
|
+
/** 刷新二维码(手动 / 过期自动)。 */
|
|
2061
|
+
refresh(): void;
|
|
2062
|
+
/** 构建登录监听(普通 JS 对象,NAPI 反射)。 */
|
|
2063
|
+
private buildListener;
|
|
2064
|
+
/** 停止:注销监听(登录成功后调用,防重复回调)。 */
|
|
2065
|
+
stop(): void;
|
|
2066
|
+
private setState;
|
|
2067
|
+
private emitQrCode;
|
|
2068
|
+
}
|
|
2069
|
+
//#endregion
|
|
1793
2070
|
//#region src/context.d.ts
|
|
1794
2071
|
interface CoreContextOptions {
|
|
1795
2072
|
/** pino logger(console + 可选文件,由装配层创建)。 */
|
|
@@ -1812,30 +2089,6 @@ interface CoreContext {
|
|
|
1812
2089
|
/** 创建装配根(初始 wrapper/login 为 null)。 */
|
|
1813
2090
|
declare function createCoreContext(opts: CoreContextOptions): CoreContext;
|
|
1814
2091
|
//#endregion
|
|
1815
|
-
//#region src/infra/logger.d.ts
|
|
1816
|
-
/** 日志级别(pino 标准级别 + silent)。 */
|
|
1817
|
-
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
1818
|
-
interface LoggerOptions {
|
|
1819
|
-
/** 日志级别,默认 `info`。 */
|
|
1820
|
-
level?: LogLevel;
|
|
1821
|
-
/** 是否输出到 console(pretty 模式),默认 true。 */
|
|
1822
|
-
console?: boolean;
|
|
1823
|
-
/** 文件日志路径;不传则不写文件(父目录自动创建)。 */
|
|
1824
|
-
file?: string;
|
|
1825
|
-
/** 附加基础字段(如 `{ name: 'kernel' }`),自动保留 pid;name 用 pino 保留字段
|
|
1826
|
-
* (logger name),pino-pretty 渲染为 `(name/pid)` 元数据头。 */
|
|
1827
|
-
base?: Record<string, unknown>;
|
|
1828
|
-
/** 追加的敏感字段路径(默认内置 token/票据等,见 DEFAULT_REDACT_PATHS)。 */
|
|
1829
|
-
redact?: string[];
|
|
1830
|
-
}
|
|
1831
|
-
/**
|
|
1832
|
-
* 创建 pino logger:console(pretty)+ 可选文件,统一 level / redact。
|
|
1833
|
-
*
|
|
1834
|
-
* 文件目的地用同步写入(`sync: true`):日志量级下性能可接受,且进程退出不丢日志,
|
|
1835
|
-
* 无需额外的 flush 步骤(对比异步 SonicBoom 的 flushSync 时序陷阱)。
|
|
1836
|
-
*/
|
|
1837
|
-
declare function createLogger(opts?: LoggerOptions): pino.Logger;
|
|
1838
|
-
//#endregion
|
|
1839
2092
|
//#region src/core.d.ts
|
|
1840
2093
|
interface NapukettoCoreOptions {
|
|
1841
2094
|
/** 数据根 / 账号(透传给 PathWrapper,见 ADR-016)。 */
|
|
@@ -1847,6 +2100,15 @@ interface NapukettoCoreOptions {
|
|
|
1847
2100
|
/** 是否输出 console,默认 true。 */
|
|
1848
2101
|
consoleLog?: boolean;
|
|
1849
2102
|
}
|
|
2103
|
+
/** 登录进度(IPC 子进程模式经 onLoginProgress 转发;koishi 插件展示二维码/状态用)。 */
|
|
2104
|
+
interface LoginProgress {
|
|
2105
|
+
/** 登录状态(QR 状态机)。 */
|
|
2106
|
+
state: LoginState;
|
|
2107
|
+
/** 二维码数据(state=waiting_scan 时有)。 */
|
|
2108
|
+
qr?: QrCodeData;
|
|
2109
|
+
/** 登录成功 selfInfo(state=logged_in 时有)。 */
|
|
2110
|
+
selfInfo?: SelfInfo;
|
|
2111
|
+
}
|
|
1850
2112
|
/** login 参数。 */
|
|
1851
2113
|
interface CoreLoginOptions {
|
|
1852
2114
|
/** appid(登录握手,兜底 537237765)。 */
|
|
@@ -1859,6 +2121,8 @@ interface CoreLoginOptions {
|
|
|
1859
2121
|
qrFallback?: boolean;
|
|
1860
2122
|
/** QR 二维码图片保存路径(默认缓存目录 qrcode.png)。 */
|
|
1861
2123
|
qrCodePath?: string;
|
|
2124
|
+
/** 登录进度回调(QR 阶段:二维码数据 + 状态变化)。子进程 IPC 模式转发用。 */
|
|
2125
|
+
onLoginProgress?: (progress: LoginProgress) => void;
|
|
1862
2126
|
}
|
|
1863
2127
|
/**
|
|
1864
2128
|
* 核心装配器:持有 CoreContext,负责启动/停止编排。
|
|
@@ -1904,227 +2168,7 @@ declare class NapukettoCore {
|
|
|
1904
2168
|
stop(): void;
|
|
1905
2169
|
}
|
|
1906
2170
|
//#endregion
|
|
1907
|
-
//#region src/
|
|
1908
|
-
/** 配置文本格式。 */
|
|
1909
|
-
type ConfigFormat = "json" | "toml";
|
|
1910
|
-
/**
|
|
1911
|
-
* 校验器最小接口。zod 的 `ZodType<T>`(`parse(data: unknown): T`)天然满足;
|
|
1912
|
-
* 手写校验器包装成该形状即可。
|
|
1913
|
-
*/
|
|
1914
|
-
interface ConfigSchema<T> {
|
|
1915
|
-
parse: (input: unknown) => T;
|
|
1916
|
-
}
|
|
1917
|
-
interface ConfigOptions<T> {
|
|
1918
|
-
/** 配置文件绝对路径。 */
|
|
1919
|
-
path: string;
|
|
1920
|
-
/** 校验器(协议 schema 用 zod;kernel 主配置用手写校验器包装)。 */
|
|
1921
|
-
schema: ConfigSchema<T>;
|
|
1922
|
-
/** 默认值:文件缺失时生成并落盘;校验以它为兜底。 */
|
|
1923
|
-
defaults: T;
|
|
1924
|
-
/** 内存初值(已校验对象):load() 时直接使用,跳过文件读写(全局 TOML 分段的装配方式)。 */
|
|
1925
|
-
seed?: T | undefined;
|
|
1926
|
-
/** 文本格式(缺省按扩展名推断)。 */
|
|
1927
|
-
format?: ConfigFormat | undefined;
|
|
1928
|
-
}
|
|
1929
|
-
/**
|
|
1930
|
-
* 配置基类。每次 `load()` / `save()` 都经过 schema 校验,
|
|
1931
|
-
* 校验失败抛 `KernelError('INVALID_PARAM')`,不静默吞掉。
|
|
1932
|
-
* - `load()`:seed 存在 → 直接用 seed;否则读文件(缺失落默认值)。
|
|
1933
|
-
* - `save()`:按格式序列化(TOML/JSON)原子写。
|
|
1934
|
-
*/
|
|
1935
|
-
declare class ConfigBase<T> {
|
|
1936
|
-
readonly path: string;
|
|
1937
|
-
readonly defaults: T;
|
|
1938
|
-
private readonly schema;
|
|
1939
|
-
private readonly format;
|
|
1940
|
-
private readonly seed;
|
|
1941
|
-
private value;
|
|
1942
|
-
constructor(opts: ConfigOptions<T>);
|
|
1943
|
-
/** 当前内存值(只读消费;外部不得直接修改返回对象)。 */
|
|
1944
|
-
get(): T;
|
|
1945
|
-
/**
|
|
1946
|
-
* 加载配置:
|
|
1947
|
-
* - seed 存在 → 直接用 seed(已校验,不读文件;全局 TOML 分段装配方式);
|
|
1948
|
-
* - 文件缺失 → 写入默认值并落盘(首次运行自动生成),返回默认值;
|
|
1949
|
-
* - 文件存在 → 读取 + 校验,更新内存,返回。
|
|
1950
|
-
*/
|
|
1951
|
-
load(): Promise<T>;
|
|
1952
|
-
/** 重新从磁盘加载(外部变更后的热更新入口,P2 配置热更新使用)。 */
|
|
1953
|
-
reload(): Promise<T>;
|
|
1954
|
-
/** 校验并落盘(原子写:临时文件 + rename),随后更新内存。 */
|
|
1955
|
-
save(next: T): Promise<void>;
|
|
1956
|
-
/** 对象 → 文本(TOML/JSON)。 */
|
|
1957
|
-
private serialize;
|
|
1958
|
-
/** 文本 → 对象(TOML/JSON)。 */
|
|
1959
|
-
private deserialize;
|
|
1960
|
-
/** 反序列化 + schema 校验,错误统一包装为 KernelError。 */
|
|
1961
|
-
private parse;
|
|
1962
|
-
}
|
|
1963
|
-
/** 解析 TOML 文本 → 对象(boot.cjs / 探测脚本等无 ConfigBase 场景复用)。 */
|
|
1964
|
-
declare function parseToml(text: string): Record<string, unknown>;
|
|
1965
|
-
/** 对象 → TOML 文本(config init 生成全局配置文件等场景)。 */
|
|
1966
|
-
declare function stringifyToml(value: Record<string, unknown>): string;
|
|
1967
|
-
//#endregion
|
|
1968
|
-
//#region src/infra/errors.d.ts
|
|
1969
|
-
/**
|
|
1970
|
-
* kernel 类型化错误(ADR-009 / ADR-017)
|
|
1971
|
-
*
|
|
1972
|
-
* apis 层内部解包原生 `{ result, errMsg }`:成功返回纯业务值,失败抛 KernelError。
|
|
1973
|
-
* 协议层只需维护 `KernelErrorCode → 协议错误码` 映射表,不解析错误逻辑。
|
|
1974
|
-
*/
|
|
1975
|
-
/**
|
|
1976
|
-
* 错误码分类。P1 探测真实错误返回后再增删。
|
|
1977
|
-
* 当前 INVALID_PARAM 也承担基础设施层(配置校验失败等)的错误语义。
|
|
1978
|
-
*/
|
|
1979
|
-
type KernelErrorCode = "SEND_FAILED" | "PERMISSION_DENIED" | "NOT_FOUND" | "TIMEOUT" | "NOT_LOGIN" | "INVALID_PARAM" | "INVALID_STATE" | "UNKNOWN";
|
|
1980
|
-
/**
|
|
1981
|
-
* 全部错误码集合。协议层映射表可据此推导:
|
|
1982
|
-
* `Record<(typeof KERNEL_ERROR_CODES)[number], number>`。
|
|
1983
|
-
*/
|
|
1984
|
-
declare const KERNEL_ERROR_CODES: readonly ["SEND_FAILED", "PERMISSION_DENIED", "NOT_FOUND", "TIMEOUT", "NOT_LOGIN", "INVALID_PARAM", "INVALID_STATE", "UNKNOWN"];
|
|
1985
|
-
/** kernel 类型化错误:apis / 基础设施层抛出的统一错误形态。 */
|
|
1986
|
-
declare class KernelError extends Error {
|
|
1987
|
-
readonly code: KernelErrorCode;
|
|
1988
|
-
constructor(message: string, code?: KernelErrorCode, options?: ErrorOptions);
|
|
1989
|
-
}
|
|
1990
|
-
/** 便捷构造:`kernelError('消息不存在', 'NOT_FOUND', { cause })`。 */
|
|
1991
|
-
declare function kernelError(message: string, code?: KernelErrorCode, options?: ErrorOptions): KernelError;
|
|
1992
|
-
/** 类型守卫:协议层 catch 统一映射时区分 KernelError 与意外错误。 */
|
|
1993
|
-
declare function isKernelError(err: unknown): err is KernelError;
|
|
1994
|
-
//#endregion
|
|
1995
|
-
//#region src/login/login.d.ts
|
|
1996
|
-
/** 登录状态。 */
|
|
1997
|
-
type LoginState = "idle" | "waiting_scan" | "scanned" | "logged_in" | "failed";
|
|
1998
|
-
/** 二维码数据(png base64 + 解码 url)。 */
|
|
1999
|
-
interface QrCodeData {
|
|
2000
|
-
pngBase64: string;
|
|
2001
|
-
qrcodeUrl: string;
|
|
2002
|
-
}
|
|
2003
|
-
/** selfInfo(登录成功后填写)。 */
|
|
2004
|
-
interface SelfInfo {
|
|
2005
|
-
uin: string;
|
|
2006
|
-
uid: string;
|
|
2007
|
-
nick: string;
|
|
2008
|
-
}
|
|
2009
|
-
/** 快速登录项。 */
|
|
2010
|
-
interface LoginListItem {
|
|
2011
|
-
uin: string;
|
|
2012
|
-
uid?: string;
|
|
2013
|
-
nickName?: string;
|
|
2014
|
-
isQuickLogin?: boolean;
|
|
2015
|
-
}
|
|
2016
|
-
/** QR 登录会话(状态机 + 回调订阅)。 */
|
|
2017
|
-
declare class QrLoginSession {
|
|
2018
|
-
private readonly loginService;
|
|
2019
|
-
private state;
|
|
2020
|
-
private listenerId;
|
|
2021
|
-
private self;
|
|
2022
|
-
private readonly qrCodeHandlers;
|
|
2023
|
-
private readonly stateHandlers;
|
|
2024
|
-
constructor(loginService: unknown);
|
|
2025
|
-
/** 当前状态。 */
|
|
2026
|
-
get currentState(): LoginState;
|
|
2027
|
-
/** selfInfo(登录成功后有值)。 */
|
|
2028
|
-
get selfInfo(): SelfInfo | null;
|
|
2029
|
-
/** 订阅二维码(png base64 + url)。返回退订函数。 */
|
|
2030
|
-
onQrCode(cb: (qr: QrCodeData) => void): () => void;
|
|
2031
|
-
/** 订阅状态变化。返回退订函数。 */
|
|
2032
|
-
onStateChange(cb: (state: LoginState) => void): () => void;
|
|
2033
|
-
/** 开始登录:注册监听 → connect → 快速登录(指定账号)或触发二维码。 */
|
|
2034
|
-
start(opts?: {
|
|
2035
|
-
quickUin?: string;
|
|
2036
|
-
}): void;
|
|
2037
|
-
/** 刷新二维码(手动 / 过期自动)。 */
|
|
2038
|
-
refresh(): void;
|
|
2039
|
-
/** 构建登录监听(普通 JS 对象,NAPI 反射)。 */
|
|
2040
|
-
private buildListener;
|
|
2041
|
-
/** 停止:注销监听(登录成功后调用,防重复回调)。 */
|
|
2042
|
-
stop(): void;
|
|
2043
|
-
private setState;
|
|
2044
|
-
private emitQrCode;
|
|
2045
|
-
}
|
|
2046
|
-
//#endregion
|
|
2047
|
-
//#region src/types/services/profile-like-service.d.ts
|
|
2048
|
-
/**
|
|
2049
|
-
* NodeIKernelProfileLikeService:资料点赞服务接口面(自研描述,非移植)
|
|
2050
|
-
*
|
|
2051
|
-
* 依据:运行时反射 + wrapper 外部契约(接口签名是 QQ 的外部事实,自研描述其形状,
|
|
2052
|
-
* 零复制实现)。
|
|
2053
|
-
* (接口签名是外部系统的事实,我们自研描述其形状,零复制实现)。
|
|
2054
|
-
* 只收录 apis/profile-like 需要的方法;其余按需探测后补齐。
|
|
2055
|
-
*/
|
|
2056
|
-
/** 点赞返回(setBuddyProfileLike,说明书参考)。 */
|
|
2057
|
-
interface BuddyProfileLikeResult {
|
|
2058
|
-
result: number;
|
|
2059
|
-
errMsg: string;
|
|
2060
|
-
succCounts: number;
|
|
2061
|
-
}
|
|
2062
|
-
/** 资料点赞服务。 */
|
|
2063
|
-
interface NodeIKernelProfileLikeService {
|
|
2064
|
-
addKernelProfileLikeListener(listener: unknown): number;
|
|
2065
|
-
removeKernelProfileLikeListener(listenerId: number): void;
|
|
2066
|
-
/** 点赞(send_like;sourceId=71 赞来源,doLikeCount 次数)。 */
|
|
2067
|
-
setBuddyProfileLike(arg: {
|
|
2068
|
-
friendUid: string;
|
|
2069
|
-
sourceId: number;
|
|
2070
|
-
doLikeCount: number;
|
|
2071
|
-
doLikeTollCount: number;
|
|
2072
|
-
}): Promise<BuddyProfileLikeResult>;
|
|
2073
|
-
isNull(): boolean;
|
|
2074
|
-
}
|
|
2075
|
-
//#endregion
|
|
2076
|
-
//#region src/types/services/profile-service.d.ts
|
|
2077
|
-
/** 用户详情(getUserDetailInfoByUin / getUserDetailInfo 返回,宽松自研描述,待探测校准)。 */
|
|
2078
|
-
interface UserDetailInfoByUin {
|
|
2079
|
-
detail?: {
|
|
2080
|
-
uid?: string;
|
|
2081
|
-
uin?: string;
|
|
2082
|
-
simpleInfo?: {
|
|
2083
|
-
coreInfo?: {
|
|
2084
|
-
nick?: string;
|
|
2085
|
-
remark?: string;
|
|
2086
|
-
};
|
|
2087
|
-
baseInfo?: {
|
|
2088
|
-
age?: number;
|
|
2089
|
-
qid?: string;
|
|
2090
|
-
sex?: number;
|
|
2091
|
-
longNick?: string;
|
|
2092
|
-
};
|
|
2093
|
-
vasInfo?: {
|
|
2094
|
-
svipFlag?: boolean;
|
|
2095
|
-
yearVipFlag?: boolean;
|
|
2096
|
-
vipLevel?: number;
|
|
2097
|
-
};
|
|
2098
|
-
status?: {
|
|
2099
|
-
status?: number;
|
|
2100
|
-
};
|
|
2101
|
-
relationFlags?: Record<string, unknown>;
|
|
2102
|
-
};
|
|
2103
|
-
commonExt?: {
|
|
2104
|
-
qqLevel?: number;
|
|
2105
|
-
regTime?: number;
|
|
2106
|
-
};
|
|
2107
|
-
};
|
|
2108
|
-
[key: string]: unknown;
|
|
2109
|
-
}
|
|
2110
|
-
/** 资料服务。 */
|
|
2111
|
-
interface NodeIKernelProfileService {
|
|
2112
|
-
addKernelProfileListener(listener: unknown): number;
|
|
2113
|
-
removeKernelProfileListener(listenerId: number): void;
|
|
2114
|
-
/** 设置个性签名(set_self_longnick)。 */
|
|
2115
|
-
setLongNick(longNick: string): Promise<unknown>;
|
|
2116
|
-
/** 设置昵称(set_qq_profile)。 */
|
|
2117
|
-
setNickName(nickName: string): Promise<unknown>;
|
|
2118
|
-
/** 设置头像(set_qq_avatar)。 */
|
|
2119
|
-
setHeader(filePath: string): Promise<GeneralCallResult>;
|
|
2120
|
-
/** 按 uin 获取用户详情(get_stranger_info 第一步)。 */
|
|
2121
|
-
getUserDetailInfoByUin(uin: string): Promise<UserDetailInfoByUin>;
|
|
2122
|
-
/** 按 uid 获取用户详情(get_stranger_info 第二步,noCache=true 强制刷新)。 */
|
|
2123
|
-
getUserDetailInfo(uid: string): Promise<UserDetailInfoByUin>;
|
|
2124
|
-
isNull(): boolean;
|
|
2125
|
-
}
|
|
2126
|
-
//#endregion
|
|
2127
|
-
//#region src/wrapper/probe.d.ts
|
|
2171
|
+
//#region src/wrapper/probe/probe.d.ts
|
|
2128
2172
|
/**
|
|
2129
2173
|
* 探测 wrapper 运行时:dump session 方法与各 service 方法到 JSON。
|
|
2130
2174
|
* 返回探测结果对象;同时写文件(NAPUTO_CFG_DIR/<file>,默认 napuketto-probe.json)。
|
|
@@ -2248,5 +2292,5 @@ interface QQVersionInfo {
|
|
|
2248
2292
|
qua: string;
|
|
2249
2293
|
}
|
|
2250
2294
|
//#endregion
|
|
2251
|
-
export { type BootEnv, type BuddyCategory, type BuddyReq, type CanonicalElement, ChatType, ConfigBase, type ConfigFormat, type ConfigOptions, type ConfigSchema, type CoreContext, type CoreContextOptions, type CoreLoginOptions, DEFAULT_DATA_ROOT_NAME, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, ElementType, type EnginInitDesktopConfig, type EssenceMsgItem, type ForceFetchClientKeyRetType, type Friend, FriendApi, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, GrayTipSubType, type Group, GroupApi, GroupBridge, 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 LogLevel, type LoggerOptions, type LoginAccountInfo, type LoginListItem, 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 NodeIKernelRichMediaService, type NodeIKernelSessionListener, type NodeIKernelTicketService, type NodeIQQNTStartupSessionWrapper, type NodeIQQNTWrapperEngine, type NodeIQQNTWrapperSession, type NodeQQNTWrapperUtil, type PathOptions, PathWrapper, type Peer, type PlatformType, ProfileApi, ProfileLikeApi, type QQVersionContext, type QQVersionInfo, type QrCodeData, QrLoginSession, type RDeliveryConfig, type RawElement, type RawMessage, RichMediaApi, type SelfInfo, type SendMessageElement, type SessionConfigOptions, type ShutUpGroupMember, type StartNapukettoOptions, type StrangerInfo, TicketApi, type TipAioOpGrayTipElement, type TipGroupElement, TipGroupElementType, type UserDetailInfoByUin, type VendorType, WebApi, WebHonorType, type WrapperContext, type WrapperNodeApi, type WrapperSessionInitConfig, buildEngineConfig, buildLoginConfig, buildSessionConfig, createCoreContext, createSessionListener as createLifecycleSessionListener, createSessionListener, createLogger, createLoginListener, createSession, createWrapper, electronProcessType, getExistingSession, getMainSession, initAndStartSession, initEngine, initSession, isKernelError, kernelError, listLoginAccounts, listQQVersions, parseAppidFromMajor, parseToml, probeRuntime, quickLogin, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveWrapperPath, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitForNetworkConnection, waitSessionReady };
|
|
2295
|
+
export { type BootEnv, type BuddyCategory, type BuddyReq, type CanonicalElement, ChatType, ConfigBase, type ConfigFormat, type ConfigOptions, type ConfigSchema, type CoreContext, type CoreContextOptions, type CoreLoginOptions, DEFAULT_DATA_ROOT_NAME, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, ElementType, type EnginInitDesktopConfig, type EssenceMsgItem, type ForceFetchClientKeyRetType, type Friend, FriendApi, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, GrayTipSubType, type Group, GroupApi, GroupBridge, 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 LogLevel, 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 NodeIKernelRichMediaService, type NodeIKernelSessionListener, type NodeIKernelTicketService, type NodeIQQNTStartupSessionWrapper, type NodeIQQNTWrapperEngine, type NodeIQQNTWrapperSession, type NodeQQNTWrapperUtil, type PathOptions, PathWrapper, type Peer, type PlatformType, ProfileApi, ProfileLikeApi, type QQVersionContext, type QQVersionInfo, type QrCodeData, QrLoginSession, type RDeliveryConfig, type RawElement, type RawMessage, RichMediaApi, type SelfInfo, type SendMessageElement, type SessionConfigOptions, type ShutUpGroupMember, type StartNapukettoOptions, type StrangerInfo, TicketApi, type TipAioOpGrayTipElement, type TipGroupElement, TipGroupElementType, type UserDetailInfoByUin, type VendorType, WebApi, WebHonorType, type WrapperContext, type WrapperNodeApi, type WrapperSessionInitConfig, buildEngineConfig, buildLoginConfig, buildSessionConfig, createCoreContext, createSessionListener as createLifecycleSessionListener, createSessionListener, createLogger, createLoginListener, createSession, createWrapper, electronProcessType, getExistingSession, getMainSession, initAndStartSession, initEngine, initSession, isKernelError, kernelError, listLoginAccounts, listQQVersions, parseAppidFromMajor, parseToml, probeRuntime, quickLogin, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveWrapperPath, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitForNetworkConnection, waitSessionReady };
|
|
2252
2296
|
//# sourceMappingURL=index.d.mts.map
|