@napuketto/kernel 0.12.3 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +451 -99
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +804 -239
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -104,6 +104,8 @@ interface ReplyElement {
|
|
|
104
104
|
senderUid?: string;
|
|
105
105
|
senderUin?: string;
|
|
106
106
|
}
|
|
107
|
+
/** 视频缩略图在 thumbPath Map 中的 key(收向实测 Map<0, path>)。 */
|
|
108
|
+
export declare const VIDEO_THUMB_KEY = 0;
|
|
107
109
|
/** 视频元素(接收 + 发送)。 */
|
|
108
110
|
interface VideoElement {
|
|
109
111
|
filePath?: string;
|
|
@@ -546,6 +548,93 @@ interface NodeIKernelBuddyService {
|
|
|
546
548
|
/** 处理可疑好友申请(set_doubt_friends_add_request;str1/str2 语义未知,传空串)。 */
|
|
547
549
|
approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
|
|
548
550
|
}
|
|
551
|
+
/** 闪传分享权限(permission.code,语义待校准;实测 0 = 链接可直接打开)。 */
|
|
552
|
+
interface FlashTransferPermission {
|
|
553
|
+
code: number;
|
|
554
|
+
}
|
|
555
|
+
/** 卡片发送目标:destType 取 ChatType(2 = 群、1 = 私聊),destUid 取群号 / 用户 uid。 */
|
|
556
|
+
interface FlashTransferTarget {
|
|
557
|
+
destType: number;
|
|
558
|
+
destUid: string;
|
|
559
|
+
}
|
|
560
|
+
/** 上传任务参数(createFlashTransferUploadTask 第 2 参,原生逐字段读取的 20 项)。 */
|
|
561
|
+
interface FlashTransferTaskInfo {
|
|
562
|
+
scene: number;
|
|
563
|
+
name: string;
|
|
564
|
+
uploaders: string[];
|
|
565
|
+
permission: FlashTransferPermission;
|
|
566
|
+
coverPath: string;
|
|
567
|
+
coverOriginalInfos: unknown[];
|
|
568
|
+
paths: string[];
|
|
569
|
+
albumFilePathList: string[];
|
|
570
|
+
excludePaths: string[];
|
|
571
|
+
expireLeftTime: number;
|
|
572
|
+
validitySeconds: number;
|
|
573
|
+
uploadSceneType: number;
|
|
574
|
+
isNeedDelDeviceInfo: boolean;
|
|
575
|
+
isNeedDelLocation: boolean;
|
|
576
|
+
pathsWithPrivacyInfo: unknown[];
|
|
577
|
+
detectPrivacyInfoResult: {
|
|
578
|
+
exists: boolean;
|
|
579
|
+
allDetectResults: Map<unknown, unknown>;
|
|
580
|
+
};
|
|
581
|
+
hybridFileInfos: unknown[];
|
|
582
|
+
announcement: {
|
|
583
|
+
announcementSegments: unknown[];
|
|
584
|
+
modifyTime: number;
|
|
585
|
+
avatarUrl: string;
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
/** 文件集快照(事件回调第 1 参;只收录本 API 用到的字段)。 */
|
|
589
|
+
interface FlashTransferFileSet {
|
|
590
|
+
fileSetId: string;
|
|
591
|
+
name?: string;
|
|
592
|
+
totalFileCount?: string;
|
|
593
|
+
totalFileSize?: string;
|
|
594
|
+
permission?: FlashTransferPermission;
|
|
595
|
+
shareInfo?: {
|
|
596
|
+
shareLink?: string;
|
|
597
|
+
extractionCode?: string;
|
|
598
|
+
};
|
|
599
|
+
[key: string]: unknown;
|
|
600
|
+
}
|
|
601
|
+
/** 单个文件的状态快照(fileSet 内条目)。 */
|
|
602
|
+
interface FlashTransferFileStatus {
|
|
603
|
+
fileSetId: string;
|
|
604
|
+
cliFileId: string;
|
|
605
|
+
name: string;
|
|
606
|
+
fileType?: number;
|
|
607
|
+
[key: string]: unknown;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* 上传监听器(delegate):原生按名取回调,未定义的事件直接跳过。
|
|
611
|
+
* 实测事件序列:onFileDidStartUpload → onFileUploadStatusChanged → onFileSetUploadStatusChanged
|
|
612
|
+
* → onFileSetUploadProgressChanged / onFileUploadProgressChanged → onFileDidFinishUpload。
|
|
613
|
+
*/
|
|
614
|
+
interface FlashTransferUploadListener {
|
|
615
|
+
onFileDidStartUpload?(file: FlashTransferFileStatus): void;
|
|
616
|
+
onFileUploadStatusChanged?(file: FlashTransferFileStatus): void;
|
|
617
|
+
onFileSetUploadStatusChanged?(fileSet: FlashTransferFileSet): void;
|
|
618
|
+
onFileSetUploadProgressChanged?(payload: {
|
|
619
|
+
fileSet: FlashTransferFileSet;
|
|
620
|
+
uploaded: string;
|
|
621
|
+
total: string;
|
|
622
|
+
}): void;
|
|
623
|
+
onFileUploadProgressChanged?(file: FlashTransferFileStatus, ...args: string[]): void;
|
|
624
|
+
onFileDidFinishUpload?(file: FlashTransferFileStatus): void;
|
|
625
|
+
}
|
|
626
|
+
/** 闪传服务。 */
|
|
627
|
+
interface NodeIKernelFlashTransferService {
|
|
628
|
+
addFileSetUploadListener(listener: FlashTransferUploadListener): void;
|
|
629
|
+
removeFileSetUploadListener(listener: FlashTransferUploadListener): void;
|
|
630
|
+
/** 创建上传任务;**调用即开始上传**,返回值是空对象(fileSetId 只能从事件取)。 */
|
|
631
|
+
createFlashTransferUploadTask(listener: FlashTransferUploadListener, taskInfo: FlashTransferTaskInfo): unknown;
|
|
632
|
+
/** 发送闪传卡片消息(targets 元素只读 destType / destUid 两个字段)。 */
|
|
633
|
+
sendFlashTransferMsg(params: {
|
|
634
|
+
targets: FlashTransferTarget[];
|
|
635
|
+
fileSetId: string;
|
|
636
|
+
}): Promise<GeneralCallResult> | GeneralCallResult;
|
|
637
|
+
}
|
|
549
638
|
/** 群成员角色(QQ wrapper 契约)。 */
|
|
550
639
|
export declare const NTGroupMemberRole: {
|
|
551
640
|
readonly UNSPECIFIED: 0;
|
|
@@ -1023,13 +1112,13 @@ export declare const GroupListUpdateType: {
|
|
|
1023
1112
|
};
|
|
1024
1113
|
export type GroupListUpdateType = (typeof GroupListUpdateType)[keyof typeof GroupListUpdateType];
|
|
1025
1114
|
/** 成员数据来源(onMemberInfoChange 第二参,说明书参考)。 */
|
|
1026
|
-
declare const GroupMemberDataSource: {
|
|
1115
|
+
export declare const GroupMemberDataSource: {
|
|
1027
1116
|
/** 本地缓存。 */
|
|
1028
1117
|
readonly CACHE: 0;
|
|
1029
1118
|
/** 网络拉取。 */
|
|
1030
1119
|
readonly NETWORK: 1;
|
|
1031
1120
|
};
|
|
1032
|
-
type GroupMemberDataSource = (typeof GroupMemberDataSource)[keyof typeof GroupMemberDataSource];
|
|
1121
|
+
export type GroupMemberDataSource = (typeof GroupMemberDataSource)[keyof typeof GroupMemberDataSource];
|
|
1033
1122
|
/** onMemberListChange 参数(sceneId 为群号 groupCode)。 */
|
|
1034
1123
|
interface GroupMemberListChange {
|
|
1035
1124
|
sceneId: string;
|
|
@@ -1221,15 +1310,6 @@ type CanonicalElement = {
|
|
|
1221
1310
|
type: "unknown";
|
|
1222
1311
|
raw: unknown;
|
|
1223
1312
|
};
|
|
1224
|
-
/**
|
|
1225
|
-
* wrapper.node 的 NAPI 接口面(自研描述,非移植)
|
|
1226
|
-
*
|
|
1227
|
-
* 来源:wrapper.node 在 QQ 定制版 Electron 里通过 napi_define_class / napi_set_named_property
|
|
1228
|
-
* 注册的 JS 类(2026-08-05 Ghidra 反编译 FUN_180c6274a / FUN_180c80224 确认类名)。
|
|
1229
|
-
* 这些接口是 wrapper.node 对外暴露的外部系统契约——我们自研描述其形状,未复制任何第三方代码。
|
|
1230
|
-
*
|
|
1231
|
-
* 注意:这里所有对象由 QQ 运行时的 NAPI 层自动构建/转换,业务层禁止触碰 C++ ABI。
|
|
1232
|
-
*/
|
|
1233
1313
|
/** 平台类型(与 wrapper.node 的 platform 字段对应)。 */
|
|
1234
1314
|
declare const PlatformType: {
|
|
1235
1315
|
readonly KUNKNOWN: 0;
|
|
@@ -1363,18 +1443,28 @@ interface NodeIQQNTWrapperSession {
|
|
|
1363
1443
|
disableIpDirect(arg: unknown): void;
|
|
1364
1444
|
getAccountPath(arg: unknown): string;
|
|
1365
1445
|
updateTicket(arg: unknown): void;
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1446
|
+
/**
|
|
1447
|
+
* get*Service 系列:运行时返回 **可能为 null 的原生服务句柄**(session 未 init /
|
|
1448
|
+
* 句柄失效时)。这里按各自 Service 接口精确声明,调用方经
|
|
1449
|
+
* `requireKernelService` 校验非空 + 方法面后再使用——不再需要在调用点做
|
|
1450
|
+
* 两级强转(`NodeIKernel*Service | null`)。
|
|
1451
|
+
*/
|
|
1452
|
+
getMsgService(): NodeIKernelMsgService | null;
|
|
1453
|
+
getGroupService(): NodeIKernelGroupService | null;
|
|
1454
|
+
getBuddyService(): NodeIKernelBuddyService | null;
|
|
1455
|
+
getTicketService(): NodeIKernelTicketService | null;
|
|
1456
|
+
getRichMediaService(): NodeIKernelRichMediaService | null;
|
|
1371
1457
|
/** 闪传服务(诊断用:调查 rich media transfer failed 时验证初始化触发点)。 */
|
|
1372
|
-
getFlashTransferService():
|
|
1373
|
-
getProfileService():
|
|
1458
|
+
getFlashTransferService(): NodeIKernelFlashTransferService | null;
|
|
1459
|
+
getProfileService(): NodeIKernelProfileService | null;
|
|
1374
1460
|
/** 会话列表(P2 批次二 get_peer_pins 数据源;2026-10-31 探测方法面)。 */
|
|
1375
|
-
getRecentContactService():
|
|
1376
|
-
getProfileLikeService():
|
|
1461
|
+
getRecentContactService(): NodeIKernelRecentContactService | null;
|
|
1462
|
+
getProfileLikeService(): NodeIKernelProfileLikeService | null;
|
|
1463
|
+
/** 以下服务尚未产出运行时探测类型,保持 unknown(禁止盲猜形状)。 */
|
|
1377
1464
|
getTipOffService(): unknown;
|
|
1465
|
+
getNodeMiscService(): unknown;
|
|
1466
|
+
getSearchService(): unknown;
|
|
1467
|
+
getUnitedConfigService(): unknown;
|
|
1378
1468
|
}
|
|
1379
1469
|
/** NodeIQQNTStartupSessionWrapper:启动会话实例方法。 */
|
|
1380
1470
|
interface NodeIQQNTStartupSessionWrapper {
|
|
@@ -1391,7 +1481,8 @@ type NodeIQQNTStartupSessionWrapperCtor = new () => NodeIQQNTStartupSessionWrapp
|
|
|
1391
1481
|
interface NodeIKernelLoginService {
|
|
1392
1482
|
addKernelLoginListener(listener: unknown): number;
|
|
1393
1483
|
removeKernelLoginListener(listener: number): void;
|
|
1394
|
-
|
|
1484
|
+
/** 初始化登录配置(老版本 wrapper 可能缺此方法,调用方需按可选处理)。 */
|
|
1485
|
+
initConfig?(config: unknown): void;
|
|
1395
1486
|
connect(): void;
|
|
1396
1487
|
getLoginList(): Promise<{
|
|
1397
1488
|
result: number;
|
|
@@ -1400,8 +1491,8 @@ interface NodeIKernelLoginService {
|
|
|
1400
1491
|
quickLoginWithUin(uin: string): Promise<unknown>;
|
|
1401
1492
|
getQRCodePicture(): boolean;
|
|
1402
1493
|
getMsfStatus(): number;
|
|
1403
|
-
/** 设备指纹 guid(wrapper.node 字符串分析实证,2026-08-12;无 getMachineId
|
|
1404
|
-
getMachineGuid(): string;
|
|
1494
|
+
/** 设备指纹 guid(wrapper.node 字符串分析实证,2026-08-12;无 getMachineId;可选)。 */
|
|
1495
|
+
getMachineGuid?(): string;
|
|
1405
1496
|
}
|
|
1406
1497
|
/** NodeIKernelLoginService 构造器(含静态 get)。 */
|
|
1407
1498
|
type NodeIKernelLoginServiceCtor = new () => NodeIKernelLoginService & {
|
|
@@ -1460,6 +1551,8 @@ interface KernelLoginListener {
|
|
|
1460
1551
|
onQQLoginNumLimited?(...args: unknown[]): void;
|
|
1461
1552
|
onLoginState?(...args: unknown[]): void;
|
|
1462
1553
|
}
|
|
1554
|
+
/** @deprecated 使用 `KernelLoginListener`(匈牙利 `I` 前缀已废弃)。 */
|
|
1555
|
+
type IKernelLoginListener = KernelLoginListener;
|
|
1463
1556
|
/**
|
|
1464
1557
|
* NodeIKernelSessionListener:session.init 第四参监听器(普通 JS 对象)。
|
|
1465
1558
|
* init 完成信号:以 onOpentelemetryInit(is_init===true) 为准(onSessionInitComplete 为辅)。
|
|
@@ -1499,11 +1592,11 @@ interface FlashTransferUploadResult {
|
|
|
1499
1592
|
/** 上传选项。 */
|
|
1500
1593
|
interface FlashTransferUploadOptions {
|
|
1501
1594
|
/** 文件集名称(对端卡片标题);缺省取首个文件名。 */
|
|
1502
|
-
name?: string;
|
|
1595
|
+
name?: string | undefined;
|
|
1503
1596
|
/** 分享权限码(permission.code,实测 0 = 链接可直接打开)。 */
|
|
1504
|
-
permissionCode?: number;
|
|
1597
|
+
permissionCode?: number | undefined;
|
|
1505
1598
|
/** 超时毫秒(缺省 10 分钟)。 */
|
|
1506
|
-
timeoutMs?: number;
|
|
1599
|
+
timeoutMs?: number | undefined;
|
|
1507
1600
|
}
|
|
1508
1601
|
/** 闪传 API:从 session 拿 flash transfer service,包装成语义化方法。 */
|
|
1509
1602
|
export declare class FlashTransferApi {
|
|
@@ -1552,7 +1645,7 @@ interface DoubtFriendRequestInfo {
|
|
|
1552
1645
|
/** FriendApi 构造选项。 */
|
|
1553
1646
|
interface FriendApiOptions {
|
|
1554
1647
|
/** uid→uin 转换器(通常注入 GroupApi.uidToUin);缺省 uin 退化为 uid。 */
|
|
1555
|
-
uidToUin?: (uids: string[]) => Promise<Map<string, string
|
|
1648
|
+
uidToUin?: ((uids: string[]) => Promise<Map<string, string>>) | undefined;
|
|
1556
1649
|
}
|
|
1557
1650
|
/** 好友 API:从 session 拿 buddy service,包装成语义化方法。 */
|
|
1558
1651
|
export declare class FriendApi {
|
|
@@ -1591,10 +1684,12 @@ export declare class GroupApi {
|
|
|
1591
1684
|
/**
|
|
1592
1685
|
* 群列表(force=true 触发原生刷新)。
|
|
1593
1686
|
*
|
|
1594
|
-
*
|
|
1595
|
-
*
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1687
|
+
* @remarks
|
|
1688
|
+
* ⚠️ 本方法**只触发底层事件推送,返回值恒为 `[]`**——原生 getGroupList
|
|
1689
|
+
* 返回仅 `{ result, errMsg }`,列表数据经 onGroupListUpdate 事件推送。
|
|
1690
|
+
* 需要群列表数组请改用 `GroupCache.listGroups()`(缓存快照)或
|
|
1691
|
+
* `GroupCache.listGroupsRefreshed()`(触发刷新并等待事件落地)。
|
|
1692
|
+
* @see GroupCache.listGroupsRefreshed
|
|
1598
1693
|
*/
|
|
1599
1694
|
getGroupList(force?: boolean): Promise<Group[]>;
|
|
1600
1695
|
/** 群详情(groupCode 为群号字符串)。
|
|
@@ -1618,7 +1713,12 @@ export declare class GroupApi {
|
|
|
1618
1713
|
* kickMemberV2 的 kickFlag/kickList 字段值待探测校准(TODO P3 联调)。
|
|
1619
1714
|
*/
|
|
1620
1715
|
kickMember(groupCode: string, memberUids: string[], refuseForever: boolean, reason?: string): Promise<void>;
|
|
1621
|
-
/**
|
|
1716
|
+
/**
|
|
1717
|
+
* 成员禁言。
|
|
1718
|
+
*
|
|
1719
|
+
* @param members 每项 `duration` 单位为**秒(s)**,`0` 表示解除禁言。
|
|
1720
|
+
* @throws {KernelError} 成员列表为空(INVALID_PARAM)或原生调用失败。
|
|
1721
|
+
*/
|
|
1622
1722
|
setMemberShutUp(groupCode: string, members: Array<{
|
|
1623
1723
|
uid: string;
|
|
1624
1724
|
duration: number;
|
|
@@ -1732,10 +1832,19 @@ export declare class NTEventChannel<L extends ListenerShape, Name extends string
|
|
|
1732
1832
|
*/
|
|
1733
1833
|
onAny(handler: (event: string, ...args: unknown[]) => void): () => void;
|
|
1734
1834
|
emit<E extends EventName<L, Name>>(event: E, ...args: EventArgs<L, Name, E>): void;
|
|
1735
|
-
/**
|
|
1835
|
+
/**
|
|
1836
|
+
* 下游 async 监听器的 Promise 拒绝不会被 try/catch 捕获(会变成进程级
|
|
1837
|
+
* UnhandledRejection)——这里统一挂 catch 转发到 onError 兜底。
|
|
1838
|
+
*/
|
|
1839
|
+
private catchAsyncListenerError;
|
|
1840
|
+
/** 通知所有错误处理器(单个处理器异常不打断其他处理器)。 */
|
|
1736
1841
|
private notifyError;
|
|
1737
1842
|
/** 订阅错误通知(监听器抛出的异常 / 其他内部错误)。 */
|
|
1738
1843
|
onError(handler: (err: unknown) => void): () => void;
|
|
1844
|
+
/** 清空全部监听器与错误处理器(幂等;Runtime 销毁时调用)。 */
|
|
1845
|
+
dispose(): void;
|
|
1846
|
+
/** `using channel = ...` 自动清理。 */
|
|
1847
|
+
[Symbol.dispose](): void;
|
|
1739
1848
|
}
|
|
1740
1849
|
/** 好友事件通道的固定类型(事件名前缀 "Buddy")。 */
|
|
1741
1850
|
type BuddyEventChannel = NTEventChannel<BuddyListener, "Buddy">;
|
|
@@ -1752,6 +1861,10 @@ export declare class FriendBridge {
|
|
|
1752
1861
|
register(): void;
|
|
1753
1862
|
/** 注销原生监听(幂等)。 */
|
|
1754
1863
|
unregister(): void;
|
|
1864
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
1865
|
+
dispose(): void;
|
|
1866
|
+
/** `using bridge = ...` 自动释放。 */
|
|
1867
|
+
[Symbol.dispose](): void;
|
|
1755
1868
|
}
|
|
1756
1869
|
/** 群事件通道的固定类型(事件名前缀 "Group")。 */
|
|
1757
1870
|
type GroupEventChannel = NTEventChannel<GroupListener, "Group">;
|
|
@@ -1768,6 +1881,10 @@ export declare class GroupBridge {
|
|
|
1768
1881
|
register(): void;
|
|
1769
1882
|
/** 注销原生监听(幂等)。 */
|
|
1770
1883
|
unregister(): void;
|
|
1884
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
1885
|
+
dispose(): void;
|
|
1886
|
+
/** `using bridge = ...` 自动释放。 */
|
|
1887
|
+
[Symbol.dispose](): void;
|
|
1771
1888
|
}
|
|
1772
1889
|
/** 登录事件通道的固定类型(事件名前缀 "Login")。 */
|
|
1773
1890
|
type LoginEventChannel = NTEventChannel<LoginListener, "Login">;
|
|
@@ -1784,6 +1901,10 @@ export declare class LoginBridge {
|
|
|
1784
1901
|
register(): void;
|
|
1785
1902
|
/** 注销原生监听(幂等)。 */
|
|
1786
1903
|
unregister(): void;
|
|
1904
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
1905
|
+
dispose(): void;
|
|
1906
|
+
/** `using bridge = ...` 自动释放。 */
|
|
1907
|
+
[Symbol.dispose](): void;
|
|
1787
1908
|
}
|
|
1788
1909
|
/** 消息事件通道的固定类型(事件名前缀 "Msg")。 */
|
|
1789
1910
|
type MsgEventChannel = NTEventChannel<MsgListener, "Msg">;
|
|
@@ -1806,6 +1927,10 @@ export declare class MsgBridge {
|
|
|
1806
1927
|
register(): void;
|
|
1807
1928
|
/** 注销原生监听(幂等)。 */
|
|
1808
1929
|
unregister(): void;
|
|
1930
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
1931
|
+
dispose(): void;
|
|
1932
|
+
/** `using bridge = ...` 自动释放。 */
|
|
1933
|
+
[Symbol.dispose](): void;
|
|
1809
1934
|
}
|
|
1810
1935
|
/** 会话列表事件通道的固定类型(事件名前缀 "RecentContact")。 */
|
|
1811
1936
|
type RecentContactEventChannel = NTEventChannel<RecentContactListener, "RecentContact">;
|
|
@@ -1822,6 +1947,10 @@ export declare class RecentContactBridge {
|
|
|
1822
1947
|
register(): void;
|
|
1823
1948
|
/** 注销原生监听(幂等)。 */
|
|
1824
1949
|
unregister(): void;
|
|
1950
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
1951
|
+
dispose(): void;
|
|
1952
|
+
/** `using bridge = ...` 自动释放。 */
|
|
1953
|
+
[Symbol.dispose](): void;
|
|
1825
1954
|
}
|
|
1826
1955
|
/** 消息 API:从 session 拿 msg service,包装成语义化方法。 */
|
|
1827
1956
|
export declare class MsgApi {
|
|
@@ -2196,6 +2325,10 @@ export declare class BuddyCache {
|
|
|
2196
2325
|
register(): void;
|
|
2197
2326
|
/** 退订事件通道(幂等)。 */
|
|
2198
2327
|
unregister(): void;
|
|
2328
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
2329
|
+
dispose(): void;
|
|
2330
|
+
/** `using cache = ...` 自动释放。 */
|
|
2331
|
+
[Symbol.dispose](): void;
|
|
2199
2332
|
/** 应用全量快照:首帧建 baseline,之后 diff 发布归一化事件。 */
|
|
2200
2333
|
private applySnapshot;
|
|
2201
2334
|
/** 好友快照(只读拷贝)。 */
|
|
@@ -2225,14 +2358,26 @@ export declare class GroupCache {
|
|
|
2225
2358
|
private readonly groupDetails;
|
|
2226
2359
|
/** 群成员:groupCode → (uid → GroupMember)。 */
|
|
2227
2360
|
private readonly members;
|
|
2228
|
-
/**
|
|
2229
|
-
|
|
2361
|
+
/**
|
|
2362
|
+
* 惰性回填 in-flight 去重。
|
|
2363
|
+
*
|
|
2364
|
+
* 按返回类型拆成三个精确容器:同 key 并发只拉一次,且取回的值类型由容器
|
|
2365
|
+
* 声明(Promise<Group[]> / Promise<GroupDetailInfo> / Promise<GroupMember[]>)
|
|
2366
|
+
* 自然推导——不再用 `Promise<unknown>` + `as Promise<T>` 假装泛型。
|
|
2367
|
+
*/
|
|
2368
|
+
private inFlightGroupList;
|
|
2369
|
+
private readonly inFlightDetail;
|
|
2370
|
+
private readonly inFlightMembers;
|
|
2230
2371
|
private unsubscribes;
|
|
2231
2372
|
constructor(opts: GroupCacheOptions);
|
|
2232
2373
|
/** 订阅群事件通道(幂等)。 */
|
|
2233
2374
|
register(): void;
|
|
2234
2375
|
/** 退订事件通道(幂等)。 */
|
|
2235
2376
|
unregister(): void;
|
|
2377
|
+
/** 释放(等价 unregister,幂等)。 */
|
|
2378
|
+
dispose(): void;
|
|
2379
|
+
/** `using cache = ...` 自动释放。 */
|
|
2380
|
+
[Symbol.dispose](): void;
|
|
2236
2381
|
/** 合并成员到该群缓存(uid → GroupMember)。 */
|
|
2237
2382
|
private upsertMembers;
|
|
2238
2383
|
/** 群列表是否已有缓存(同步判断)。 */
|
|
@@ -2274,10 +2419,14 @@ export declare class GroupCache {
|
|
|
2274
2419
|
getMember(groupCode: string, uid: string): Promise<GroupMember | undefined>;
|
|
2275
2420
|
/** 读缓存成员(缺失先整群回填一次)。 */
|
|
2276
2421
|
private getCachedMember;
|
|
2277
|
-
/** 惰性回填全量群列表(getGroup
|
|
2422
|
+
/** 惰性回填全量群列表(getGroup 缺失时;并发调用共享同一次拉取)。 */
|
|
2278
2423
|
private loadGroupList;
|
|
2279
|
-
/**
|
|
2280
|
-
|
|
2424
|
+
/**
|
|
2425
|
+
* 惰性回填并发去重(按返回类型分容器):同 map + key 并发只拉一次。
|
|
2426
|
+
* loader 的返回值类型即容器元素类型——取回时由 Promise<T> 自然给出 T,
|
|
2427
|
+
* 不需要 `as Promise<T>` 断言。
|
|
2428
|
+
*/
|
|
2429
|
+
private dedupeMap;
|
|
2281
2430
|
}
|
|
2282
2431
|
/** 配置文本格式。 */
|
|
2283
2432
|
type ConfigFormat = "json" | "toml";
|
|
@@ -2433,6 +2582,19 @@ type LogEnvSource = Record<string, string | undefined>;
|
|
|
2433
2582
|
* @param env 环境变量快照(默认空对象 = 无 env 覆盖)
|
|
2434
2583
|
*/
|
|
2435
2584
|
export declare function parseLogConfig(section: unknown, env?: LogEnvSource): LogConfig;
|
|
2585
|
+
/** 结构化流选项。 */
|
|
2586
|
+
interface ConsoleFormatStreamOptions {
|
|
2587
|
+
/** 输出格式(三种格式全部由本模块渲染)。 */
|
|
2588
|
+
format: LogFormat;
|
|
2589
|
+
/** 时间戳渲染模式。 */
|
|
2590
|
+
timestamp: TimestampMode;
|
|
2591
|
+
/** pretty / single-line 是否着色(json 恒不着色)。 */
|
|
2592
|
+
colorize: boolean;
|
|
2593
|
+
/** 输出目的地(缺省 process.stdout;测试注入用)。 */
|
|
2594
|
+
destination?: NodeJS.WriteStream;
|
|
2595
|
+
}
|
|
2596
|
+
/** 创建控制台渲染流(pretty / single-line / json)。 */
|
|
2597
|
+
export declare function createConsoleFormatStream(opts: ConsoleFormatStreamOptions): pino.DestinationStream;
|
|
2436
2598
|
/**
|
|
2437
2599
|
* 可选属性统一带 `| undefined`(2026-10-25):exactOptionalPropertyTypes 下
|
|
2438
2600
|
* 纯直传调用点(装配层透传 LogConfig 字段)可写 `format: cfg.format` 一类
|
|
@@ -2479,9 +2641,9 @@ export declare const DEFAULT_DATA_ROOT_NAME = ".napuketto";
|
|
|
2479
2641
|
export declare const MAIN_CONFIG_FILE = "napuketto.toml";
|
|
2480
2642
|
interface PathOptions {
|
|
2481
2643
|
/** 显式数据根(cli `--data-dir` 传入,优先级最高)。 */
|
|
2482
|
-
dataRoot?: string;
|
|
2644
|
+
dataRoot?: string | undefined;
|
|
2483
2645
|
/** QQ 号,用于多账号隔离;缺省时直接使用数据根本身。 */
|
|
2484
|
-
account?: string;
|
|
2646
|
+
account?: string | undefined;
|
|
2485
2647
|
}
|
|
2486
2648
|
/**
|
|
2487
2649
|
* 解析数据根:显式参数 > 环境变量 > `<项目根>/.napuketto`(默认)> 用户目录兜底(裸脚本)。
|
|
@@ -2491,7 +2653,7 @@ interface PathOptions {
|
|
|
2491
2653
|
export declare function resolveDataRoot(dataRoot?: string): string;
|
|
2492
2654
|
interface ConfigPathOptions {
|
|
2493
2655
|
/** 兜底数据根(探测全部失败时用 `<dataRoot>/napuketto.toml`,保持旧行为)。 */
|
|
2494
|
-
dataRoot?: string;
|
|
2656
|
+
dataRoot?: string | undefined;
|
|
2495
2657
|
}
|
|
2496
2658
|
/**
|
|
2497
2659
|
* 全局配置文件路径解析(2026-08-07 用户拍板:**配置文件放项目根目录,
|
|
@@ -2531,6 +2693,16 @@ export declare class PathWrapper {
|
|
|
2531
2693
|
*/
|
|
2532
2694
|
clearCache(): void;
|
|
2533
2695
|
}
|
|
2696
|
+
/**
|
|
2697
|
+
* 等待/延迟工具(通用底层原语,2026-08-08 克隆合并;2026-11 下沉至 infra)
|
|
2698
|
+
*
|
|
2699
|
+
* 纯 promise 工具,无任何业务依赖——login / cache 等上层模块经
|
|
2700
|
+
* `infra/index.js` 复用,杜绝 cache -> login 的跨领域依赖。
|
|
2701
|
+
*/
|
|
2702
|
+
/** 等待条件满足(轮询,带超时)。 */
|
|
2703
|
+
export declare function waitFor(predicate: () => boolean, timeoutMs: number, intervalMs?: number): Promise<boolean>;
|
|
2704
|
+
/** 短延迟。 */
|
|
2705
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
2534
2706
|
/**
|
|
2535
2707
|
* Electron 进程类型(Node 的 process 类型无此字段)。
|
|
2536
2708
|
* - "browser":QQ 主进程(V1 模式)
|
|
@@ -2540,9 +2712,9 @@ export declare function electronProcessType(): string | undefined;
|
|
|
2540
2712
|
/** `resolveQqUserDataRoot` 选项(平台覆盖供测试/联调,缺省按 `process.platform` 探测)。 */
|
|
2541
2713
|
interface QqDataRootOptions {
|
|
2542
2714
|
/** 数据根(`NAPKETTO_DATA` / `--data-dir` 解析结果)。Linux 下 QQ 数据落 `<dataRoot>/nt_qq`。 */
|
|
2543
|
-
dataRoot?: string;
|
|
2715
|
+
dataRoot?: string | undefined;
|
|
2544
2716
|
/** 平台覆盖(缺省 `detectPlatformType()`)。 */
|
|
2545
|
-
platform?: PlatformType;
|
|
2717
|
+
platform?: PlatformType | undefined;
|
|
2546
2718
|
}
|
|
2547
2719
|
/**
|
|
2548
2720
|
* 解析 QQ 用户数据根(登录数据目录,如 `C:\Users\<user>\Documents\Tencent Files`)。
|
|
@@ -2578,8 +2750,13 @@ interface WrapperContext {
|
|
|
2578
2750
|
session: NodeIQQNTWrapperSession | null;
|
|
2579
2751
|
/** 启动会话包装(NapCat 同款:StartupSessionWrapper.create(),start() 替代 startNT)。 */
|
|
2580
2752
|
startupSession: NodeIQQNTStartupSessionWrapper | null;
|
|
2581
|
-
/**
|
|
2582
|
-
|
|
2753
|
+
/**
|
|
2754
|
+
* QQ 的 loginService 实例(拦截 new 捕获,可为 null)。
|
|
2755
|
+
* 保留 `unknown` 联合以兼容测试桩与老版本 wrapper(仅按方法名反射调用)。
|
|
2756
|
+
*/
|
|
2757
|
+
loginService: NodeIKernelLoginService | unknown;
|
|
2758
|
+
/** wrapper.node 绝对路径(BootEnv.wrapperPath 注入;appid 自动解析用)。 */
|
|
2759
|
+
wrapperPath?: string | undefined;
|
|
2583
2760
|
}
|
|
2584
2761
|
/**
|
|
2585
2762
|
* 从 loader 截获的 NAPI exports 创建 wrapper 上下文。
|
|
@@ -2626,28 +2803,33 @@ export declare function startNapuketto(options: StartNapukettoOptions): WrapperC
|
|
|
2626
2803
|
/** startNapuketto 的引导环境(由 loader launcher 注入环境变量,boot.cjs 透传)。 */
|
|
2627
2804
|
interface BootEnv {
|
|
2628
2805
|
/** QQ 版本(如 "9.9.31-49919")。 */
|
|
2629
|
-
qqVersion?: string;
|
|
2806
|
+
qqVersion?: string | undefined;
|
|
2630
2807
|
/** 用户数据目录(cfgDir 的父级,用于 desktopPathConfig)。 */
|
|
2631
|
-
dataDir?: string;
|
|
2808
|
+
dataDir?: string | undefined;
|
|
2632
2809
|
/** 数据根(Linux 下 QQ 数据根 = `<dataRoot>/nt_qq`;Windows 忽略)。 */
|
|
2633
|
-
dataRoot?: string;
|
|
2810
|
+
dataRoot?: string | undefined;
|
|
2634
2811
|
/** 账号 uin(可选,提供则一步 init+start)。 */
|
|
2635
|
-
selfUin?: string;
|
|
2812
|
+
selfUin?: string | undefined;
|
|
2636
2813
|
/** 账号 uid(可选)。 */
|
|
2637
|
-
selfUid?: string;
|
|
2814
|
+
selfUid?: string | undefined;
|
|
2815
|
+
/**
|
|
2816
|
+
* wrapper.node 绝对路径(appid 自动解析用:同目录 major.node)。
|
|
2817
|
+
* 缺省回退 `NAPUKETTO_WRAPPER_PATH` / `NAPUTO_WRAPPER_PATH` 环境变量。
|
|
2818
|
+
*/
|
|
2819
|
+
wrapperPath?: string | undefined;
|
|
2638
2820
|
}
|
|
2639
2821
|
/** startNapuketto 选项。 */
|
|
2640
2822
|
interface StartNapukettoOptions {
|
|
2641
2823
|
/** 截获的 wrapper.node NAPI exports(boot.cjs 传入)。 */
|
|
2642
2824
|
wrapperExports: WrapperNodeApi;
|
|
2643
2825
|
/** 引导环境(版本/数据目录/账号)。 */
|
|
2644
|
-
env?: BootEnv;
|
|
2826
|
+
env?: BootEnv | undefined;
|
|
2645
2827
|
/** 覆盖 engine 配置(联调用)。 */
|
|
2646
|
-
engineConfig?: EnginInitDesktopConfig;
|
|
2828
|
+
engineConfig?: EnginInitDesktopConfig | undefined;
|
|
2647
2829
|
/** 覆盖 session 配置(联调用,提供则自动 init+start)。 */
|
|
2648
|
-
sessionConfig?: WrapperSessionInitConfig;
|
|
2830
|
+
sessionConfig?: WrapperSessionInitConfig | undefined;
|
|
2649
2831
|
/** QQ 已 init 的 session(boot.cjs 拦截 new 捕获)。 */
|
|
2650
|
-
qqSession?: NodeIQQNTWrapperSession | null;
|
|
2832
|
+
qqSession?: NodeIQQNTWrapperSession | null | undefined;
|
|
2651
2833
|
/** QQ 的 loginService 实例(boot.cjs 拦截 new 捕获)。 */
|
|
2652
2834
|
qqLoginService?: unknown;
|
|
2653
2835
|
}
|
|
@@ -2660,16 +2842,18 @@ interface StartNapukettoOptions {
|
|
|
2660
2842
|
* @returns NAPI exports(含 NodeIKernelLoginService 等构造器)
|
|
2661
2843
|
* @throws KernelError exports 缺 NodeIKernelLoginService(stub 环境异常)或 dlopen 失败
|
|
2662
2844
|
*/
|
|
2663
|
-
export declare function dlopenWrapper(wrapperPath: string):
|
|
2845
|
+
export declare function dlopenWrapper(wrapperPath: string): WrapperNodeApi;
|
|
2664
2846
|
/**
|
|
2665
2847
|
* 激活自建宿主 O3MiscService 事件分发(三要素之二,V6 实测决定性):
|
|
2666
2848
|
* 不激活则 getLoginList 永不 resolve(挂起)。listener 用普通对象
|
|
2667
2849
|
* (getOnAmgomDataPiece 空实现,wrapper 契约回调)。
|
|
2668
2850
|
*
|
|
2851
|
+
* 幂等:同一 exports 重复调用只激活一次(已激活返回 true)。
|
|
2852
|
+
*
|
|
2669
2853
|
* @param wrapperExports dlopen 产出的 exports(缺失/版本变化时返回 false)
|
|
2670
2854
|
* @returns 是否成功激活
|
|
2671
2855
|
*/
|
|
2672
|
-
export declare function activateO3MiscService(wrapperExports: Record<string, unknown> | undefined): boolean;
|
|
2856
|
+
export declare function activateO3MiscService(wrapperExports: WrapperNodeApi | Record<string, unknown> | undefined): boolean;
|
|
2673
2857
|
/** 登录结果(QR 或快速登录)。 */
|
|
2674
2858
|
interface LoginResult {
|
|
2675
2859
|
uin: string;
|
|
@@ -2679,9 +2863,9 @@ interface LoginResult {
|
|
|
2679
2863
|
/** 登录列表项(getLoginList 返回,说明书参考)。 */
|
|
2680
2864
|
interface LoginAccountInfo {
|
|
2681
2865
|
uin: string;
|
|
2682
|
-
uid?: string;
|
|
2683
|
-
nickName?: string;
|
|
2684
|
-
isQuickLogin?: boolean;
|
|
2866
|
+
uid?: string | undefined;
|
|
2867
|
+
nickName?: string | undefined;
|
|
2868
|
+
isQuickLogin?: boolean | undefined;
|
|
2685
2869
|
}
|
|
2686
2870
|
/**
|
|
2687
2871
|
* 等待网络连接就绪(loginService.getMsfStatus() === 3)。
|
|
@@ -2697,11 +2881,11 @@ export declare function listLoginAccounts(ctx: WrapperContext): Promise<LoginAcc
|
|
|
2697
2881
|
/** quickLogin 参数(uin 指定账号;timeoutMs 网络就绪等待;quickLoginTimeoutMs 单步超时)。 */
|
|
2698
2882
|
interface QuickLoginOptions {
|
|
2699
2883
|
/** 指定快速登录账号(缺省遍历历史列表,优先 isQuickLogin)。 */
|
|
2700
|
-
uin?: string;
|
|
2884
|
+
uin?: string | undefined;
|
|
2701
2885
|
/** 网络就绪等待超时(毫秒,P2-1 既有语义),默认 15s。 */
|
|
2702
|
-
timeoutMs?: number;
|
|
2886
|
+
timeoutMs?: number | undefined;
|
|
2703
2887
|
/** 单步快速登录超时(毫秒,T3 挂起兜底),默认 {@link QUICK_LOGIN_TIMEOUT_MS}。 */
|
|
2704
|
-
quickLoginTimeoutMs?: number;
|
|
2888
|
+
quickLoginTimeoutMs?: number | undefined;
|
|
2705
2889
|
}
|
|
2706
2890
|
/**
|
|
2707
2891
|
* 快速登录:遍历历史登录列表尝试。
|
|
@@ -2719,13 +2903,13 @@ export declare function quickLogin(ctx: WrapperContext, opts?: QuickLoginOptions
|
|
|
2719
2903
|
* 也不自己 create(登录前 create() 干扰 QQ,实测 QQ 退出 code=0)。
|
|
2720
2904
|
* 正确做法:等 QQ 的 session 就绪(getMsgService 非 null = 核心 service 已挂载)。
|
|
2721
2905
|
*/
|
|
2722
|
-
export declare function waitSessionReady(ctx: WrapperContext, opts
|
|
2723
|
-
timeoutMs?: number;
|
|
2906
|
+
export declare function waitSessionReady(ctx: WrapperContext, opts?: {
|
|
2907
|
+
timeoutMs?: number | undefined;
|
|
2724
2908
|
}): Promise<void>;
|
|
2725
2909
|
/** 登录连接 + 快速登录(quickLogin 等)已拆到 login-connect.ts(见文件头 re-export)。 */
|
|
2726
2910
|
/** session 初始化(4 参全为普通 JS 对象,等 init 完成信号)。 */
|
|
2727
|
-
export declare function initAndStartSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener
|
|
2728
|
-
timeoutMs?: number;
|
|
2911
|
+
export declare function initAndStartSession(ctx: WrapperContext, config: WrapperSessionInitConfig, listener?: NodeIKernelSessionListener, opts?: {
|
|
2912
|
+
timeoutMs?: number | undefined;
|
|
2729
2913
|
}): Promise<void>;
|
|
2730
2914
|
/** 登录状态。 */
|
|
2731
2915
|
type LoginState = "idle" | "waiting_scan" | "scanned" | "logged_in" | "failed";
|
|
@@ -2816,9 +3000,67 @@ interface CoreContext {
|
|
|
2816
3000
|
}
|
|
2817
3001
|
/** 创建装配根(初始 wrapper/login 为 null)。 */
|
|
2818
3002
|
export declare function createCoreContext(opts: CoreContextOptions): CoreContext;
|
|
3003
|
+
/** 运行时装配参数。 */
|
|
3004
|
+
interface KernelRuntimeOptions {
|
|
3005
|
+
/** 已 init 的 wrapper session(getMsgService 等非空)。 */
|
|
3006
|
+
session: NodeIQQNTWrapperSession;
|
|
3007
|
+
/** 登录结果(WebApi getCookies 的 uin 来源;未传时用空串)。 */
|
|
3008
|
+
login?: LoginResult | null | undefined;
|
|
3009
|
+
/** wrapper.node exports(MsgApi 富媒体 copyFile 用 NodeQQNTWrapperUtil)。 */
|
|
3010
|
+
wrapperExports?: WrapperNodeApi | Record<string, unknown> | undefined;
|
|
3011
|
+
/** QQ loginService(传入时装配 LoginBridge,提供 Login 事件通道数据)。 */
|
|
3012
|
+
loginService?: unknown;
|
|
3013
|
+
/** 校准日志出口(在线状态上报失败等;缺省静默)。 */
|
|
3014
|
+
logger?: {
|
|
3015
|
+
warn(obj: unknown, msg?: string): void;
|
|
3016
|
+
} | undefined;
|
|
3017
|
+
/** 是否自动注册全部原生事件桥与缓存(默认 true)。 */
|
|
3018
|
+
autoRegister?: boolean | undefined;
|
|
3019
|
+
/** 是否自动上报在线状态 status=10 以开启服务端实时消息推送(默认 false;自建宿主传 true)。 */
|
|
3020
|
+
reportOnlineStatus?: boolean | undefined;
|
|
3021
|
+
}
|
|
3022
|
+
/** 内核服务聚合(createKernelRuntime 产物)。 */
|
|
3023
|
+
interface KernelRuntime {
|
|
3024
|
+
readonly msgChannel: MsgEventChannel;
|
|
3025
|
+
readonly groupChannel: GroupEventChannel;
|
|
3026
|
+
readonly friendChannel: BuddyEventChannel;
|
|
3027
|
+
readonly recentContactChannel: RecentContactEventChannel;
|
|
3028
|
+
readonly loginChannel: LoginEventChannel;
|
|
3029
|
+
readonly msgBridge: MsgBridge;
|
|
3030
|
+
readonly groupBridge: GroupBridge;
|
|
3031
|
+
readonly friendBridge: FriendBridge;
|
|
3032
|
+
/** getRecentContactService 不存在/不可用时为 null(跳过注册)。 */
|
|
3033
|
+
readonly recentContactBridge: RecentContactBridge | null;
|
|
3034
|
+
/** 未传 loginService 时为 null(跳过注册)。 */
|
|
3035
|
+
readonly loginBridge: LoginBridge | null;
|
|
3036
|
+
readonly msgApi: MsgApi;
|
|
3037
|
+
readonly groupApi: GroupApi;
|
|
3038
|
+
readonly friendApi: FriendApi;
|
|
3039
|
+
readonly groupNotifyApi: GroupNotifyApi;
|
|
3040
|
+
readonly ticketApi: TicketApi;
|
|
3041
|
+
readonly richMediaApi: RichMediaApi;
|
|
3042
|
+
readonly flashTransferApi: FlashTransferApi;
|
|
3043
|
+
readonly recentContactApi: RecentContactApi;
|
|
3044
|
+
readonly profileApi: ProfileApi;
|
|
3045
|
+
readonly profileLikeApi: ProfileLikeApi;
|
|
3046
|
+
readonly webApi: WebApi;
|
|
3047
|
+
readonly groupCache: GroupCache;
|
|
3048
|
+
readonly buddyCache: BuddyCache;
|
|
3049
|
+
/** 一键清理(幂等):桥/缓存 unregister + 通道 dispose。 */
|
|
3050
|
+
dispose(): void;
|
|
3051
|
+
/** `using runtime = ...` 自动清理。 */
|
|
3052
|
+
[Symbol.dispose](): void;
|
|
3053
|
+
}
|
|
3054
|
+
/**
|
|
3055
|
+
* 装配内核运行时(同步;API 构造失败即抛 KernelError)。
|
|
3056
|
+
*
|
|
3057
|
+
* @param opts 装配参数(session 必填)
|
|
3058
|
+
* @returns 聚合了全部通道/桥/API/缓存的服务对象
|
|
3059
|
+
*/
|
|
3060
|
+
export declare function createKernelRuntime(opts: KernelRuntimeOptions): KernelRuntime;
|
|
2819
3061
|
interface NapukettoCoreOptions {
|
|
2820
3062
|
/** 数据根 / 账号(透传给 PathWrapper,见 ADR-016)。 */
|
|
2821
|
-
paths?: PathOptions;
|
|
3063
|
+
paths?: PathOptions | undefined;
|
|
2822
3064
|
/** 日志级别,默认 info。 */
|
|
2823
3065
|
logLevel?: LogLevel | undefined;
|
|
2824
3066
|
/** 文件日志路径;不传则默认 `logs/napuketto.log`(父目录自动创建)。 */
|
|
@@ -2836,39 +3078,71 @@ interface NapukettoCoreOptions {
|
|
|
2836
3078
|
/** 账号标注(记录结构化 account 字段;快速登录目标账号,登录前已知时传入)。 */
|
|
2837
3079
|
account?: string | undefined;
|
|
2838
3080
|
}
|
|
2839
|
-
/**
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
3081
|
+
/**
|
|
3082
|
+
* 登录进度(IPC 子进程模式经 onLoginProgress 转发;koishi 插件展示二维码/状态用)。
|
|
3083
|
+
*
|
|
3084
|
+
* 可辨识联合:`state` 是判别字段,`switch (progress.state)` 后 `qr` / `selfInfo` /
|
|
3085
|
+
* `message` 由编译器自然收窄(waiting_scan 必有 qr、logged_in 必有 selfInfo、
|
|
3086
|
+
* failed 必有 message)。属性名与旧版完全一致,下游 `progress.qr` 等访问路径不变。
|
|
3087
|
+
*/
|
|
3088
|
+
type LoginProgress = {
|
|
3089
|
+
state: "idle";
|
|
3090
|
+
qr?: undefined;
|
|
3091
|
+
selfInfo?: undefined;
|
|
3092
|
+
message?: string | undefined;
|
|
3093
|
+
} | {
|
|
3094
|
+
state: "waiting_scan";
|
|
3095
|
+
qr: QrCodeData;
|
|
3096
|
+
selfInfo?: undefined;
|
|
3097
|
+
message?: string | undefined;
|
|
3098
|
+
} | {
|
|
3099
|
+
state: "scanned";
|
|
3100
|
+
qr?: QrCodeData | undefined;
|
|
3101
|
+
selfInfo?: undefined;
|
|
3102
|
+
message?: string | undefined;
|
|
3103
|
+
} | {
|
|
3104
|
+
state: "logged_in";
|
|
3105
|
+
qr?: undefined;
|
|
3106
|
+
selfInfo: SelfInfo;
|
|
3107
|
+
message?: string | undefined;
|
|
3108
|
+
} | {
|
|
3109
|
+
state: "failed";
|
|
3110
|
+
qr?: undefined;
|
|
3111
|
+
selfInfo?: undefined;
|
|
3112
|
+
message: string;
|
|
3113
|
+
};
|
|
2850
3114
|
/** login 参数。 */
|
|
2851
3115
|
interface CoreLoginOptions {
|
|
2852
|
-
/**
|
|
2853
|
-
|
|
3116
|
+
/**
|
|
3117
|
+
* appid(登录握手)。**可选**:未传时自动从 wrapperPath 同目录 major.node
|
|
3118
|
+
* 解析(`resolveAppidQua`);wrapperPath 缺省回退 `NAPUKETTO_WRAPPER_PATH` /
|
|
3119
|
+
* `NAPUTO_WRAPPER_PATH` 环境变量。仍无法解析则抛 INVALID_PARAM。
|
|
3120
|
+
*/
|
|
3121
|
+
appid?: string | undefined;
|
|
2854
3122
|
/** session.init 超时(毫秒),默认 15s。 */
|
|
2855
|
-
initTimeoutMs?: number;
|
|
3123
|
+
initTimeoutMs?: number | undefined;
|
|
2856
3124
|
/** 指定快速登录账号(缺省遍历历史列表)。 */
|
|
2857
|
-
quickUin?: string;
|
|
3125
|
+
quickUin?: string | undefined;
|
|
2858
3126
|
/**
|
|
2859
3127
|
* 单步快速登录超时(毫秒,T3 软重登挂起兜底),默认 20s。服务端已有同账号
|
|
2860
3128
|
* 会话时底层 quickLoginWithUin/getLoginList 永久挂起,超时按登录失败抛出
|
|
2861
3129
|
* (qrFallback 可接)。底层 promise 无法取消:超时后悬挂丢弃。
|
|
2862
3130
|
*/
|
|
2863
|
-
quickLoginTimeoutMs?: number;
|
|
3131
|
+
quickLoginTimeoutMs?: number | undefined;
|
|
2864
3132
|
/** 快速登录失败时回退 QR 登录(二维码写缓存目录),默认 false。 */
|
|
2865
|
-
qrFallback?: boolean;
|
|
3133
|
+
qrFallback?: boolean | undefined;
|
|
2866
3134
|
/** 强制扫码:跳过快速登录,直接走 QR 登录(koishi 强制扫码 / 切账号)。默认 false。 */
|
|
2867
|
-
qrOnly?: boolean;
|
|
3135
|
+
qrOnly?: boolean | undefined;
|
|
2868
3136
|
/** QR 二维码图片保存路径(默认缓存目录 qrcode.png)。 */
|
|
2869
|
-
qrCodePath?: string;
|
|
3137
|
+
qrCodePath?: string | undefined;
|
|
2870
3138
|
/** 登录进度回调(QR 阶段:二维码数据 + 状态变化)。子进程 IPC 模式转发用。 */
|
|
2871
|
-
onLoginProgress?: (progress: LoginProgress) => void;
|
|
3139
|
+
onLoginProgress?: ((progress: LoginProgress) => void) | undefined;
|
|
3140
|
+
/**
|
|
3141
|
+
* 登录成功后自动完成 Session 激活闭环(accountPath → machineGuid →
|
|
3142
|
+
* buildSessionConfig → initAndStartSession → waitSessionReady)。
|
|
3143
|
+
* 默认 false:保持 loader 现有「手动 activateSession」流程 100% 兼容。
|
|
3144
|
+
*/
|
|
3145
|
+
activateSession?: boolean | undefined;
|
|
2872
3146
|
}
|
|
2873
3147
|
/**
|
|
2874
3148
|
* 核心装配器:持有 CoreContext,负责启动/停止编排。
|
|
@@ -2879,6 +3153,10 @@ export declare class NapukettoCore {
|
|
|
2879
3153
|
readonly ctx: CoreContext;
|
|
2880
3154
|
/** QR 登录会话句柄(登录期间非空;登录终态后清空)。refreshQr() 据此可达。 */
|
|
2881
3155
|
private qrSession;
|
|
3156
|
+
/** 由 createRuntime() 装配的运行时服务集合(stop/dispose 时统一清理)。 */
|
|
3157
|
+
private runtime;
|
|
3158
|
+
/** stop 幂等标记。 */
|
|
3159
|
+
private stopped;
|
|
2882
3160
|
/** 由 create() 装配,不直接 new。 */
|
|
2883
3161
|
private constructor();
|
|
2884
3162
|
/**
|
|
@@ -2896,15 +3174,34 @@ export declare class NapukettoCore {
|
|
|
2896
3174
|
qqLoginService?: unknown;
|
|
2897
3175
|
}): WrapperContext;
|
|
2898
3176
|
/**
|
|
2899
|
-
*
|
|
2900
|
-
* loginService.initConfig → 登录(快速/QR)→
|
|
2901
|
-
* → 等 onOpentelemetryInit(is_init) 完成信号。成功后填 ctx.login。
|
|
3177
|
+
* 登录握手(wrapper 契约,2026-08-05 实测确认):
|
|
3178
|
+
* loginService.initConfig → 登录(快速/QR)→ 填 ctx.login 后返回。
|
|
2902
3179
|
*
|
|
2903
|
-
*
|
|
2904
|
-
*
|
|
2905
|
-
*
|
|
3180
|
+
* 默认**仅完成登录握手**,不做 session 初始化——QQ 登录后重建 session
|
|
3181
|
+
* (boot.cjs Proxy 捕获新实例并 setSession 替换),替换发生在 login 返回之后。
|
|
3182
|
+
* 需要一步完成会话初始化时:传 `activateSession: true`(登录成功后自动跑
|
|
3183
|
+
* accountPath → machineGuid → buildSessionConfig → initAndStartSession →
|
|
3184
|
+
* waitSessionReady),或随后手动调用 `core.activateSession()`。
|
|
2906
3185
|
*/
|
|
2907
3186
|
login(opts: CoreLoginOptions): Promise<LoginResult>;
|
|
3187
|
+
/**
|
|
3188
|
+
* 激活当前登录账号的 Session(先 init 后 startupSession.start,再等就绪)。
|
|
3189
|
+
*
|
|
3190
|
+
* 前置:必须已 `attachWrapper` 且 `login` 成功(否则 fail-fast INVALID_STATE)。
|
|
3191
|
+
* appid 未传时按 wrapperPath / 环境变量同目录 major.node 自动解析。
|
|
3192
|
+
* 幂等性由底层 init 语义决定:重复调用会再次 init(调用方自行保证只激活一次)。
|
|
3193
|
+
*/
|
|
3194
|
+
activateSession(opts?: {
|
|
3195
|
+
appid?: string | undefined;
|
|
3196
|
+
timeoutMs?: number | undefined;
|
|
3197
|
+
readyTimeoutMs?: number | undefined;
|
|
3198
|
+
}): Promise<void>;
|
|
3199
|
+
/**
|
|
3200
|
+
* 装配开箱即用的内核运行时服务(事件通道 + 桥 + 业务 API + 缓存聚合)。
|
|
3201
|
+
* 前置:wrapper 已 attach 且 session 非空(否则 fail-fast INVALID_STATE)。
|
|
3202
|
+
* dispose 由 `stop()` / `dispose()` 统一回收。
|
|
3203
|
+
*/
|
|
3204
|
+
createRuntime(opts?: Omit<KernelRuntimeOptions, "session" | "login" | "wrapperExports">): KernelRuntime;
|
|
2908
3205
|
/** 快速登录优先,失败按 qrFallback 决定是否回退 QR(QR 应直接出码,见 loginByQr 注)。 */
|
|
2909
3206
|
private loginQuickFirst;
|
|
2910
3207
|
/**
|
|
@@ -2932,9 +3229,35 @@ export declare class NapukettoCore {
|
|
|
2932
3229
|
private subscribeQrProgress;
|
|
2933
3230
|
/** QR 状态转发:日志 + onLoginProgress(failed 附 failureReason)。 */
|
|
2934
3231
|
private forwardQrState;
|
|
2935
|
-
/**
|
|
3232
|
+
/**
|
|
3233
|
+
* 停止:幂等清理 QR 会话 + 已装配的运行时服务(桥/缓存/通道)后日志收尾。
|
|
3234
|
+
* 重复调用直接返回(宿主关停钩子可能同时触发多次)。
|
|
3235
|
+
*/
|
|
2936
3236
|
stop(): void;
|
|
2937
|
-
|
|
3237
|
+
/** 显式释放(`using` / 手动调用的统一入口;等价 stop)。 */
|
|
3238
|
+
dispose(): void;
|
|
3239
|
+
/** `using core = ...` 自动释放。 */
|
|
3240
|
+
[Symbol.dispose](): void;
|
|
3241
|
+
}
|
|
3242
|
+
/** 判断未知值是否为非 null 且非数组的普通对象 Record。 */
|
|
3243
|
+
export declare function isRecord(val: unknown): val is Record<string, unknown>;
|
|
3244
|
+
/** 判断对象是否包含指定字段且类型为 string。 */
|
|
3245
|
+
export declare function hasStringProp<K extends string>(obj: Record<string, unknown>, key: K): obj is Record<string, unknown> & Record<K, string>;
|
|
3246
|
+
/** 判断对象是否包含指定字段且类型为有限 number。 */
|
|
3247
|
+
export declare function hasNumberProp<K extends string>(obj: Record<string, unknown>, key: K): obj is Record<string, unknown> & Record<K, number>;
|
|
3248
|
+
/** 判断对象是否包含指定字段且类型为 boolean。 */
|
|
3249
|
+
export declare function hasBooleanProp<K extends string>(obj: Record<string, unknown>, key: K): obj is Record<string, unknown> & Record<K, boolean>;
|
|
3250
|
+
/** 判断对象是否包含指定字段且类型为 function。 */
|
|
3251
|
+
export declare function hasFunctionProp<K extends string>(obj: Record<string, unknown>, key: K): obj is Record<string, unknown> & Record<K, (...args: never[]) => unknown>;
|
|
3252
|
+
/**
|
|
3253
|
+
* 校验并收窄 Kernel Session 返回的原生 Service 实例。
|
|
3254
|
+
*
|
|
3255
|
+
* 原生 `get*Service()` 在 session 未 init / 句柄失效时可能返回 null、undefined、
|
|
3256
|
+
* 已 `isNull()` 的空句柄或残缺对象——直接 `as unknown as NodeIKernel*Service`
|
|
3257
|
+
* 会让调用方在第一次方法调用时炸出裸 TypeError。这里统一在边界拦截:
|
|
3258
|
+
* 空 / 非对象 / isNull() === true / 缺失关键方法一律抛 INVALID_STATE。
|
|
3259
|
+
*/
|
|
3260
|
+
export declare function requireKernelService<T extends object>(raw: T | null | undefined, serviceName: string, requiredMethods?: readonly (keyof T & string)[]): T;
|
|
2938
3261
|
/**
|
|
2939
3262
|
* 探测 wrapper 运行时:dump session 方法与各 service 方法名到 JSON。
|
|
2940
3263
|
* 返回探测结果对象;同时写文件(NAPUTO_CFG_DIR/<file>,默认 napuketto-probe.json)。
|
|
@@ -2999,6 +3322,8 @@ export declare function resolveQqGlobalPath(root: string): string;
|
|
|
2999
3322
|
/**
|
|
3000
3323
|
* 复用 QQ 已有 session(P1-4:QQ 已登录,直接拿单例避免重复 init)。
|
|
3001
3324
|
* 优先 `NodeIQQNTWrapperSession.get()`;返回 null 时回退 createSession。
|
|
3325
|
+
*
|
|
3326
|
+
* @internal 仅供 probe 诊断参考,请勿在业务装配中直接调用(会写回 ctx.session)。
|
|
3002
3327
|
*/
|
|
3003
3328
|
export declare function getExistingSession(ctx: WrapperContext): NodeIQQNTWrapperSession | null;
|
|
3004
3329
|
/**
|
|
@@ -3006,12 +3331,39 @@ export declare function getExistingSession(ctx: WrapperContext): NodeIQQNTWrappe
|
|
|
3006
3331
|
* `NodeIQQNTStartupSessionWrapper.create()` → `start()` → `getSessionIdList()`(Map
|
|
3007
3332
|
* {nt:"nt_3", gpro:"gpro_3"})→ `NodeIQQNTWrapperSession.getNTWrapperSession("nt_3")`。
|
|
3008
3333
|
* 注:实测这些 session 是空壳(核心 service null),真正可用的是 new + init(lifecycle.ts)。
|
|
3334
|
+
*
|
|
3335
|
+
* @internal 仅供 probe 诊断参考,请勿在业务装配中直接调用(纯查询语义,不改写 ctx.session)。
|
|
3009
3336
|
*/
|
|
3010
3337
|
export declare function getMainSession(ctx: WrapperContext): NodeIQQNTWrapperSession | null;
|
|
3338
|
+
/** NAPI 回调占位(方法存在即可被反射调用,无副作用)。 */
|
|
3339
|
+
declare const noop: () => void;
|
|
3340
|
+
/** NodeIGlobalAdapter 实现(engine.initWithDeskTopConfig 第二参)。 */
|
|
3341
|
+
export declare class GlobalAdapter implements NodeIGlobalAdapter {
|
|
3342
|
+
onLog: typeof noop;
|
|
3343
|
+
onGetSrvCalTime: typeof noop;
|
|
3344
|
+
onShowErrUITips: typeof noop;
|
|
3345
|
+
fixPicImgType: typeof noop;
|
|
3346
|
+
getAppSetting: typeof noop;
|
|
3347
|
+
onInstallFinished: typeof noop;
|
|
3348
|
+
onUpdateGeneralFlag: typeof noop;
|
|
3349
|
+
onGetOfflineMsg: typeof noop;
|
|
3350
|
+
}
|
|
3351
|
+
/** NodeIDependsAdapter 实现(session.init 第二参)。 */
|
|
3352
|
+
export declare class DependsAdapter implements NodeIDependsAdapter {
|
|
3353
|
+
onMSFStatusChange: typeof noop;
|
|
3354
|
+
onMSFSsoError: typeof noop;
|
|
3355
|
+
getGroupCode: typeof noop;
|
|
3356
|
+
}
|
|
3357
|
+
/** NodeIDispatcherAdapter 实现(session.init 第三参)。 */
|
|
3358
|
+
export declare class DispatcherAdapter implements NodeIDispatcherAdapter {
|
|
3359
|
+
dispatchRequest: typeof noop;
|
|
3360
|
+
dispatchCall: typeof noop;
|
|
3361
|
+
dispatchCallWithJson: typeof noop;
|
|
3362
|
+
}
|
|
3011
3363
|
/** 会话监听器选项。 */
|
|
3012
3364
|
interface SessionListenerOptions {
|
|
3013
3365
|
/** 事件日志回调(默认静默——boot 阶段事件对用户是噪音;调试时可传回调观察)。 */
|
|
3014
|
-
onEvent?: (name: string, ...args: unknown[]) => void;
|
|
3366
|
+
onEvent?: ((name: string, ...args: unknown[]) => void) | undefined;
|
|
3015
3367
|
}
|
|
3016
3368
|
/**
|
|
3017
3369
|
* 创建会话监听器(默认静默,boot 阶段默认;login 模块接入后可覆盖)。
|
|
@@ -3050,9 +3402,9 @@ interface SessionConfigOptions {
|
|
|
3050
3402
|
accountPath: string;
|
|
3051
3403
|
downloadPath: string;
|
|
3052
3404
|
/** 设备指纹 guid(来自 loginService.getMachineGuid();缺省空串)。 */
|
|
3053
|
-
machineGuid?: string;
|
|
3405
|
+
machineGuid?: string | undefined;
|
|
3054
3406
|
/** 平台(缺省按 process.platform 探测;测试/联调可显式覆盖)。 */
|
|
3055
|
-
platform?: PlatformType;
|
|
3407
|
+
platform?: PlatformType | undefined;
|
|
3056
3408
|
}
|
|
3057
3409
|
/** 生成 session 初始化配置(登录成功后调用)。 */
|
|
3058
3410
|
export declare function buildSessionConfig(options: SessionConfigOptions): WrapperSessionInitConfig;
|
|
@@ -3098,5 +3450,5 @@ interface QqVersionInfo {
|
|
|
3098
3450
|
}
|
|
3099
3451
|
/** @deprecated 使用 `QqVersionInfo`(缩写大小写统一为 `Qq`)。 */
|
|
3100
3452
|
type QQVersionInfo = QqVersionInfo;
|
|
3101
|
-
export { type BootEnv, type BuddyCacheEventChannel, type BuddyCacheListener, type BuddyCacheOptions, type BuddyCategory, type BuddyCoreInfo, type BuddyEventChannel, type BuddyListEntry, type BuddyListener, type BuddyReq, type CanonicalElement, type ConfigFormat, type ConfigOptions, type ConfigSchema, type CoreContext, type CoreContextOptions, type CoreLoginOptions, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, type EnginInitDesktopConfig, type EssenceMsgItem, type FlashTransferUploadOptions, type FlashTransferUploadResult, type ForceFetchClientKeyRetType, type Friend, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, type Group, type GroupBulletin, type GroupCacheOptions, type GroupDetailInfo, type GroupEventChannel, type GroupFileItemInfo, type GroupFolderInfo, type GroupHonorWebInfo, type GroupListener, type GroupMember, type
|
|
3453
|
+
export { type BootEnv, type BuddyCacheEventChannel, type BuddyCacheListener, type BuddyCacheOptions, type BuddyCategory, type BuddyCoreInfo, type BuddyEventChannel, type BuddyListEntry, type BuddyListener, type BuddyProfileLikeResult, type BuddyReq, type CanonicalElement, type ConfigFormat, type ConfigOptions, type ConfigPathOptions, type ConfigSchema, type ConsoleFormatStreamOptions, type CoreContext, type CoreContextOptions, type CoreLoginOptions, type DesktopPathConfig, type DeviceInfo, type DoubtBuddyReq, type DoubtFriendRequestInfo, type EnginInitDesktopConfig, type EssenceMsgItem, type FaceElement, type FileElement, type FlashTransferFileSet, type FlashTransferFileStatus, type FlashTransferPermission, type FlashTransferTarget, type FlashTransferTaskInfo, type FlashTransferUploadListener, type FlashTransferUploadOptions, type FlashTransferUploadResult, type ForceFetchClientKeyRetType, type Friend, type FriendApiOptions, type FriendCategory, type GeneralCallResult, type GetFileListParam, type GrayTipElement, type GrayTipRevokeElement, type Group, type GroupBulletin, type GroupCacheOptions, type GroupDetailInfo, type GroupEventChannel, type GroupFileItemInfo, type GroupFileListItem, type GroupFileSystemInfo, type GroupFolderInfo, type GroupHonorWebInfo, type GroupListener, type GroupMember, type GroupMemberListChange, type GroupNotify, type GroupRemainAtTimes, type GroupSpaceInfo, type HonorListItem, type IKernelLoginListener, type KernelErrorCode, type KernelLoginListener, type KernelRuntime, type KernelRuntimeOptions, type KickMemberInfo, type KickMemberV2Req, type ListenerEvents, type ListenerRecordEvent, type ListenerRecordingResult, type LogConfig, type LogEnvSource, type LogFileConfig, type LogFormat, type LogLevel, type LogModuleName, type LoggerOptions, type LoginAccountInfo, type LoginEventChannel, type LoginListItem, type LoginListener, type LoginProgress, type LoginResult, type LoginState, type MsgEventChannel, type MsgListener, type MsgReadReportItem, type MsgReceipt, type NapukettoCoreOptions, type NodeIDependsAdapter, type NodeIDispatcherAdapter, type NodeIGlobalAdapter, type NodeIKernelBuddyService, type NodeIKernelGroupService, type NodeIKernelLoginService, type NodeIKernelMsgService, type NodeIKernelProfileLikeService, type NodeIKernelProfileService, type NodeIKernelRecentContactService, type NodeIKernelRichMediaService, type NodeIKernelSessionListener, type NodeIKernelTicketService, type NodeIQQNTStartupSessionWrapper, type NodeIQQNTWrapperEngine, type NodeIQQNTWrapperSession, type NodeQQNTWrapperUtil, type NudgeParam, type PathOptions, type Peer, type PicElement, type PinnedContact, type PlatformType, type PttElement, type QQVersionContext, type QQVersionInfo, type QqDataRootOptions, type QqVersionContext, type QqVersionInfo, type QrCodeData, type QuickLoginOptions, type RDeliveryConfig, type RawElement, type RawMessage, type RecentContact, type RecentContactEventChannel, type RecentContactFetchParam, type RecentContactListChanged, type RecentContactListener, type ReplyElement, type SelfInfo, type SendMessageElement, type SessionConfigOptions, type SessionListenerOptions, type ShutUpGroupMember, type StartNapukettoOptions, type StrangerInfo, type TextElement, type TimestampMode, type TipAioOpGrayTipElement, type TipGroupElement, type UserDetailInfoByUin, type VendorType, type VideoElement, type WrapperContext, type WrapperNodeApi, type WrapperSessionInitConfig, createSessionListener as createLifecycleSessionListener };
|
|
3102
3454
|
//# sourceMappingURL=index.d.mts.map
|