@napuketto/kernel 0.17.0 → 0.18.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 +42 -5
- package/dist/index.mjs +171 -66
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1310,6 +1310,8 @@ type CanonicalElement = {
|
|
|
1310
1310
|
} | {
|
|
1311
1311
|
type: "reply";
|
|
1312
1312
|
messageId: string;
|
|
1313
|
+
senderUid?: string;
|
|
1314
|
+
senderUin?: string;
|
|
1313
1315
|
} | {
|
|
1314
1316
|
type: "forward";
|
|
1315
1317
|
messageIds: string[];
|
|
@@ -1640,7 +1642,8 @@ export declare class FlashTransferApi {
|
|
|
1640
1642
|
/** 好友条目(uid + 昵称/备注,昵称由 buddy service 缓存补全)。 */
|
|
1641
1643
|
interface Friend {
|
|
1642
1644
|
uid: string;
|
|
1643
|
-
|
|
1645
|
+
/** QQ 号。无法解析时为空,uid 始终单独保留。 */
|
|
1646
|
+
uin: string | null;
|
|
1644
1647
|
nickname: string;
|
|
1645
1648
|
remark: string;
|
|
1646
1649
|
}
|
|
@@ -1672,7 +1675,7 @@ interface DoubtFriendRequestInfo {
|
|
|
1672
1675
|
}
|
|
1673
1676
|
/** FriendApi 构造选项。 */
|
|
1674
1677
|
interface FriendApiOptions {
|
|
1675
|
-
/** uid→uin 转换器(通常注入 GroupApi.uidToUin
|
|
1678
|
+
/** uid→uin 转换器(通常注入 GroupApi.uidToUin);只补缺少 UIN 的项。 */
|
|
1676
1679
|
uidToUin?: ((uids: string[]) => Promise<Map<string, string>>) | undefined;
|
|
1677
1680
|
}
|
|
1678
1681
|
/** 好友 API:从 session 拿 buddy service,包装成语义化方法。 */
|
|
@@ -1682,6 +1685,7 @@ export declare class FriendApi {
|
|
|
1682
1685
|
constructor(session: NodeIQQNTWrapperSession, opts?: FriendApiOptions);
|
|
1683
1686
|
/** 好友列表(分类拍平为 Friend[];昵称/备注从 service 缓存读取)。 */
|
|
1684
1687
|
getFriendList(): Promise<Friend[]>;
|
|
1688
|
+
private friendsFromCategories;
|
|
1685
1689
|
/** 带分类的好友列表(get_friends_with_category,分类保留)。 */
|
|
1686
1690
|
getFriendCategories(): Promise<FriendCategory[]>;
|
|
1687
1691
|
/** 原始分类(getBuddyListV2 / 缓存)。 */
|
|
@@ -1698,8 +1702,6 @@ export declare class FriendApi {
|
|
|
1698
1702
|
deleteFriend(uid: string, tempBlock?: boolean, tempBothDel?: boolean): Promise<void>;
|
|
1699
1703
|
/** 可疑好友申请列表(get_doubt_friends_add_request;uin 经 uidToUin 转换)。 */
|
|
1700
1704
|
getDoubtFriendRequest(count: number): Promise<DoubtFriendRequestInfo[]>;
|
|
1701
|
-
/** 单项转换:DoubtBuddyReq → OB11 结构(可选字段条件赋值,exactOptionalPropertyTypes)。 */
|
|
1702
|
-
private toDoubtFriendRequestInfo;
|
|
1703
1705
|
/** 处理可疑好友申请(set_doubt_friends_add_request;uid=flag)。 */
|
|
1704
1706
|
handleDoubtFriendRequest(uid: string): void;
|
|
1705
1707
|
}
|
|
@@ -1792,16 +1794,51 @@ export declare class GroupApi {
|
|
|
1792
1794
|
remainAtAllCountForGroup: number;
|
|
1793
1795
|
}>;
|
|
1794
1796
|
}
|
|
1797
|
+
declare const requestTypes: {
|
|
1798
|
+
readonly invitation: 1;
|
|
1799
|
+
readonly invited_join_request: 5;
|
|
1800
|
+
readonly join_request: 7;
|
|
1801
|
+
};
|
|
1802
|
+
type GroupRequestKind = keyof typeof requestTypes;
|
|
1803
|
+
interface GroupRequestRef {
|
|
1804
|
+
seq: string;
|
|
1805
|
+
groupCode: string;
|
|
1806
|
+
kind: GroupRequestKind;
|
|
1807
|
+
doubt: boolean;
|
|
1808
|
+
}
|
|
1809
|
+
interface PendingGroupRequest {
|
|
1810
|
+
request: GroupRequestRef;
|
|
1811
|
+
initiatorUid?: string;
|
|
1812
|
+
targetUid?: string;
|
|
1813
|
+
comment?: string;
|
|
1814
|
+
}
|
|
1815
|
+
/** 仅接受有完整审批标识的未处理群通知。 */
|
|
1816
|
+
export declare function toPendingGroupRequest(notify: GroupNotify, doubt: boolean): PendingGroupRequest | undefined;
|
|
1817
|
+
/** 兼容按序号审批的协议。指定队列时只读取该队列。 */
|
|
1818
|
+
export declare function findPendingGroupRequest(api: Pick<GroupNotifyApi, "getSingleScreenNotifies">, filter: {
|
|
1819
|
+
seq: string;
|
|
1820
|
+
doubt?: boolean | undefined;
|
|
1821
|
+
groupCode?: string;
|
|
1822
|
+
kind?: GroupRequestKind | readonly GroupRequestKind[] | undefined;
|
|
1823
|
+
}, count: number): Promise<{
|
|
1824
|
+
request: GroupRequestRef;
|
|
1825
|
+
notify: GroupNotify;
|
|
1826
|
+
}>;
|
|
1795
1827
|
/** 群通知 API:从 session 拿 group service,包装成语义化方法。 */
|
|
1796
1828
|
export declare class GroupNotifyApi {
|
|
1797
1829
|
private readonly service;
|
|
1798
1830
|
constructor(session: NodeIQQNTWrapperSession);
|
|
1799
1831
|
/** 单屏通知列表(get_group_system_msg / set_group_add_request 共用)。 */
|
|
1800
1832
|
getSingleScreenNotifies(doubt: boolean, count: number): Promise<GroupNotify[]>;
|
|
1833
|
+
/** 从实时通知提取可供 IPC 消费的请求。 */
|
|
1834
|
+
getPendingGroupRequests(doubt: boolean, notifies: unknown): PendingGroupRequest[];
|
|
1835
|
+
/** 处理同一登录会话发出的请求引用。QQ 负责权限与请求有效性判定。 */
|
|
1836
|
+
respondToRequest(request: GroupRequestRef, approve: boolean, reason?: string): Promise<void>;
|
|
1801
1837
|
/** 禁言成员列表(get_group_shut_list)。 */
|
|
1802
1838
|
getGroupShutUpMemberList(groupCode: string): Promise<GroupMember[]>;
|
|
1803
1839
|
/** 处理群请求(set_group_add_request 应答;approve=true 同意 / false 拒绝)。 */
|
|
1804
1840
|
handleGroupRequest(doubt: boolean, notify: GroupNotify, operateType: NTGroupRequestOperateTypes, reason: string): Promise<void>;
|
|
1841
|
+
private operateRequest;
|
|
1805
1842
|
}
|
|
1806
1843
|
/** Listener 接口形状(宽约束;精确签名由实例化时的具体接口保证)。 */
|
|
1807
1844
|
type ListenerShape = Record<string, unknown>;
|
|
@@ -3610,4 +3647,4 @@ interface QqVersionInfo {
|
|
|
3610
3647
|
}
|
|
3611
3648
|
/** @deprecated 使用 `QqVersionInfo`(缩写大小写统一为 `Qq`)。 */
|
|
3612
3649
|
type QQVersionInfo = QqVersionInfo;
|
|
3613
|
-
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 EssenceAddedItem, type EssenceCacheEntry, type EssenceDiffResult, type EssenceListSyncDeps, 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 };
|
|
3650
|
+
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 EssenceAddedItem, type EssenceCacheEntry, type EssenceDiffResult, type EssenceListSyncDeps, 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 GroupRequestKind, type GroupRequestRef, 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 PendingGroupRequest, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
-
import { appendFileSync, chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { appendFileSync, chmodSync, constants, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { open, readFile, rename, rm, stat } from "node:fs/promises";
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
|
-
import process from "node:process";
|
|
5
|
+
import process$1 from "node:process";
|
|
6
6
|
import { parse, stringify } from "smol-toml";
|
|
7
7
|
import pino from "pino";
|
|
8
8
|
import { homedir, hostname, platform, release, type, version } from "node:os";
|
|
@@ -276,7 +276,7 @@ var ConfigBase = class {
|
|
|
276
276
|
const file = await open(tmpPath, "wx", 384);
|
|
277
277
|
try {
|
|
278
278
|
try {
|
|
279
|
-
if (process.platform !== "win32") await file.chmod(384);
|
|
279
|
+
if (process$1.platform !== "win32") await file.chmod(384);
|
|
280
280
|
await file.writeFile(text, "utf8");
|
|
281
281
|
} finally {
|
|
282
282
|
await file.close();
|
|
@@ -712,7 +712,7 @@ function renderPrettyLine(record, ctx) {
|
|
|
712
712
|
}
|
|
713
713
|
/** 创建控制台渲染流(pretty / single-line / json)。 */
|
|
714
714
|
function createConsoleFormatStream(opts) {
|
|
715
|
-
const out = opts.destination ?? process.stdout;
|
|
715
|
+
const out = opts.destination ?? process$1.stdout;
|
|
716
716
|
const ctx = {
|
|
717
717
|
timestamp: opts.timestamp,
|
|
718
718
|
timeOriginMs: performance.timeOrigin,
|
|
@@ -824,7 +824,7 @@ const DEFAULT_DATA_ROOT_NAME = ".napuketto";
|
|
|
824
824
|
const MAIN_CONFIG_FILE = "napuketto.toml";
|
|
825
825
|
/** Check an actual write destination when the development launcher has set a boundary. */
|
|
826
826
|
function resolveSandboxWritePath(path, field) {
|
|
827
|
-
const sandbox = process.env["NAPUKETTO_SANDBOX_ROOT"];
|
|
827
|
+
const sandbox = process$1.env["NAPUKETTO_SANDBOX_ROOT"];
|
|
828
828
|
if (!sandbox) return path;
|
|
829
829
|
const target = resolve(path);
|
|
830
830
|
if (!isPathWithin(sandbox, target)) throw configError(`${field} 必须位于调试沙箱内: ${target}`);
|
|
@@ -850,7 +850,7 @@ function expandTilde(p) {
|
|
|
850
850
|
function resolveProjectRoot() {
|
|
851
851
|
const moduleRoot = findProjectRoot(dirname(fileURLToPath(import.meta.url)), "pnpm-workspace.yaml");
|
|
852
852
|
if (moduleRoot !== void 0) return moduleRoot;
|
|
853
|
-
return findProjectRoot(process.cwd(), "pnpm-workspace.yaml") ?? findProjectRoot(process.cwd(), "package.json");
|
|
853
|
+
return findProjectRoot(process$1.cwd(), "pnpm-workspace.yaml") ?? findProjectRoot(process$1.cwd(), "package.json");
|
|
854
854
|
}
|
|
855
855
|
/**
|
|
856
856
|
* 解析数据根:显式参数 > 环境变量 > `<项目根>/.napuketto`(默认)> 用户目录兜底(裸脚本)。
|
|
@@ -858,9 +858,9 @@ function resolveProjectRoot() {
|
|
|
858
858
|
* 返回绝对路径。独立导出便于 cli / 探测脚本复用。
|
|
859
859
|
*/
|
|
860
860
|
function resolveDataRoot(dataRoot) {
|
|
861
|
-
const explicit = dataRoot ?? process.env["NAPUKETTO_DATA"] ?? process.env["NAPKETTO_DATA"];
|
|
861
|
+
const explicit = dataRoot ?? process$1.env["NAPUKETTO_DATA"] ?? process$1.env["NAPKETTO_DATA"];
|
|
862
862
|
if (explicit !== void 0 && explicit !== "") return resolveSandboxWritePath(resolve(expandTilde(explicit)), "数据目录");
|
|
863
|
-
const sandbox = process.env["NAPUKETTO_SANDBOX_ROOT"];
|
|
863
|
+
const sandbox = process$1.env["NAPUKETTO_SANDBOX_ROOT"];
|
|
864
864
|
if (sandbox) return resolveSandboxWritePath(join(sandbox, DEFAULT_DATA_ROOT_NAME), "数据目录");
|
|
865
865
|
const projectRoot = resolveProjectRoot();
|
|
866
866
|
if (projectRoot !== void 0) return join(projectRoot, DEFAULT_DATA_ROOT_NAME);
|
|
@@ -888,9 +888,9 @@ function findProjectRoot(startDir, marker) {
|
|
|
888
888
|
* 返回绝对路径。独立导出便于 cli / loader 装配链复用。
|
|
889
889
|
*/
|
|
890
890
|
function resolveConfigPath(opts = {}) {
|
|
891
|
-
const explicit = process.env["NAPUKETTO_CONFIG"] ?? process.env["NAPKETTO_CONFIG"];
|
|
891
|
+
const explicit = process$1.env["NAPUKETTO_CONFIG"] ?? process$1.env["NAPKETTO_CONFIG"];
|
|
892
892
|
if (explicit !== void 0 && explicit !== "") return resolveSandboxWritePath(resolve(explicit), "配置文件");
|
|
893
|
-
const sandbox = process.env["NAPUKETTO_SANDBOX_ROOT"];
|
|
893
|
+
const sandbox = process$1.env["NAPUKETTO_SANDBOX_ROOT"];
|
|
894
894
|
if (sandbox) return resolveSandboxWritePath(join(sandbox, MAIN_CONFIG_FILE), "配置文件");
|
|
895
895
|
const projectRoot = resolveProjectRoot();
|
|
896
896
|
if (projectRoot !== void 0) return join(projectRoot, MAIN_CONFIG_FILE);
|
|
@@ -1029,7 +1029,7 @@ function mergeTargets(targets) {
|
|
|
1029
1029
|
*/
|
|
1030
1030
|
function createLogger(opts = {}) {
|
|
1031
1031
|
const consoleLevel = opts.level ?? "info";
|
|
1032
|
-
const destination = opts.destination ?? process.stdout;
|
|
1032
|
+
const destination = opts.destination ?? process$1.stdout;
|
|
1033
1033
|
const isTty = destination.isTTY === true;
|
|
1034
1034
|
const format = opts.format ?? (isTty ? "pretty" : "single-line");
|
|
1035
1035
|
const targets = [buildConsoleTarget(opts, {
|
|
@@ -1045,7 +1045,7 @@ function createLogger(opts = {}) {
|
|
|
1045
1045
|
hooks: { streamWrite: redactLogLine },
|
|
1046
1046
|
timestamp: () => `,"time":${wallMs()}`,
|
|
1047
1047
|
...opts.base === void 0 ? {} : { base: {
|
|
1048
|
-
pid: process.pid,
|
|
1048
|
+
pid: process$1.pid,
|
|
1049
1049
|
...opts.base
|
|
1050
1050
|
} }
|
|
1051
1051
|
};
|
|
@@ -1295,6 +1295,7 @@ function clearTimer(timer) {
|
|
|
1295
1295
|
* (getBuddyReq / approvalFriendRequest / setBuddyRemark / delBuddy /
|
|
1296
1296
|
* getDoubtBuddyReq / approvalDoubtBuddyReq)。
|
|
1297
1297
|
*/
|
|
1298
|
+
const QQ_NUMBER = /^[1-9]\d*$/;
|
|
1298
1299
|
/** 好友 API:从 session 拿 buddy service,包装成语义化方法。 */
|
|
1299
1300
|
var FriendApi = class {
|
|
1300
1301
|
service;
|
|
@@ -1305,34 +1306,30 @@ var FriendApi = class {
|
|
|
1305
1306
|
}
|
|
1306
1307
|
/** 好友列表(分类拍平为 Friend[];昵称/备注从 service 缓存读取)。 */
|
|
1307
1308
|
async getFriendList() {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
uin: uinMap.get(uid) ?? uid,
|
|
1323
|
-
nickname: this.service.getBuddyNick(uid),
|
|
1324
|
-
remark: this.service.getBuddyRemark(uid)
|
|
1309
|
+
return this.friendsFromCategories(await this.getBuddyCategories());
|
|
1310
|
+
}
|
|
1311
|
+
async friendsFromCategories(categories) {
|
|
1312
|
+
const entries = categories.flatMap(buddyEntries);
|
|
1313
|
+
const unresolved = new Set(entries.filter((entry) => buddyUin(entry) === null).map(({ uid }) => uid));
|
|
1314
|
+
const uinMap = unresolved.size > 0 ? await this.uidToUin?.([...unresolved]) : void 0;
|
|
1315
|
+
return entries.map((entry) => {
|
|
1316
|
+
const { uid, coreInfo } = entry;
|
|
1317
|
+
return {
|
|
1318
|
+
uid,
|
|
1319
|
+
uin: buddyUin(entry) ?? validUin(uinMap?.get(uid)),
|
|
1320
|
+
nickname: coreInfo?.nick ?? this.service.getBuddyNick(uid),
|
|
1321
|
+
remark: coreInfo?.remark ?? this.service.getBuddyRemark(uid)
|
|
1322
|
+
};
|
|
1325
1323
|
});
|
|
1326
|
-
return out;
|
|
1327
1324
|
}
|
|
1328
1325
|
/** 带分类的好友列表(get_friends_with_category,分类保留)。 */
|
|
1329
1326
|
async getFriendCategories() {
|
|
1330
1327
|
const categories = await this.getBuddyCategories();
|
|
1331
1328
|
const friendMap = /* @__PURE__ */ new Map();
|
|
1332
|
-
for (const friend of await this.
|
|
1329
|
+
for (const friend of await this.friendsFromCategories(categories)) friendMap.set(friend.uid, friend);
|
|
1333
1330
|
return categories.map((cat) => {
|
|
1334
1331
|
const buddies = [];
|
|
1335
|
-
for (const uid of cat
|
|
1332
|
+
for (const { uid } of buddyEntries(cat)) {
|
|
1336
1333
|
const friend = friendMap.get(uid);
|
|
1337
1334
|
if (friend !== void 0) buddies.push(friend);
|
|
1338
1335
|
}
|
|
@@ -1397,19 +1394,22 @@ var FriendApi = class {
|
|
|
1397
1394
|
const list = raw.doubtList ?? [];
|
|
1398
1395
|
let uinMap = /* @__PURE__ */ new Map();
|
|
1399
1396
|
if (this.uidToUin !== void 0 && list.length > 0) uinMap = await this.uidToUin(list.map((item) => item.uid));
|
|
1400
|
-
|
|
1401
|
-
for (const item of list) out.push(this.toDoubtFriendRequestInfo(item, uinMap));
|
|
1402
|
-
return out;
|
|
1403
|
-
}
|
|
1404
|
-
/** 单项转换:DoubtBuddyReq → OB11 结构(可选字段条件赋值,exactOptionalPropertyTypes)。 */
|
|
1405
|
-
toDoubtFriendRequestInfo(item, uinMap) {
|
|
1406
|
-
return toDoubtFriendRequestInfo(item, uinMap);
|
|
1397
|
+
return list.map((item) => toDoubtFriendRequestInfo(item, uinMap));
|
|
1407
1398
|
}
|
|
1408
1399
|
/** 处理可疑好友申请(set_doubt_friends_add_request;uid=flag)。 */
|
|
1409
1400
|
handleDoubtFriendRequest(uid) {
|
|
1410
1401
|
this.service.approvalDoubtBuddyReq(uid, "", "");
|
|
1411
1402
|
}
|
|
1412
1403
|
};
|
|
1404
|
+
function buddyEntries(category) {
|
|
1405
|
+
return category.buddyList ?? category.buddyUids?.map((uid) => ({ uid })) ?? [];
|
|
1406
|
+
}
|
|
1407
|
+
function buddyUin(entry) {
|
|
1408
|
+
return validUin(entry.uin) ?? validUin(entry.coreInfo?.uin);
|
|
1409
|
+
}
|
|
1410
|
+
function validUin(value) {
|
|
1411
|
+
return typeof value === "string" && QQ_NUMBER.test(value) ? value : null;
|
|
1412
|
+
}
|
|
1413
1413
|
/** 可选字段条件赋值(undefined 跳过,兼容 exactOptionalPropertyTypes)。 */
|
|
1414
1414
|
function assignOptional(info, key, value) {
|
|
1415
1415
|
if (value !== void 0) info[key] = value;
|
|
@@ -1421,7 +1421,7 @@ function assignOptional(info, key, value) {
|
|
|
1421
1421
|
* 经 JSON.stringify 变 null。这里只接受正安全整数(QQ 号),其余交给调用方省略字段。
|
|
1422
1422
|
*/
|
|
1423
1423
|
function resolveDoubtUin(uid, uinMap) {
|
|
1424
|
-
const value = Number(uinMap.get(uid)
|
|
1424
|
+
const value = Number(validUin(uinMap.get(uid)));
|
|
1425
1425
|
return Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
1426
1426
|
}
|
|
1427
1427
|
/** 单项转换:DoubtBuddyReq → OB11 结构(导出供单测,friend.test.ts)。 */
|
|
@@ -1602,10 +1602,10 @@ function textToCanonical(textEl) {
|
|
|
1602
1602
|
type: "at",
|
|
1603
1603
|
target: "all"
|
|
1604
1604
|
};
|
|
1605
|
-
if (atType === AtType.ONE || atType === AtType.ME) {
|
|
1605
|
+
if ((atType === AtType.ONE || atType === AtType.ME) && atUid != null && atUid.trim() !== "") {
|
|
1606
1606
|
const base = {
|
|
1607
1607
|
type: "at",
|
|
1608
|
-
target: atUid
|
|
1608
|
+
target: atUid
|
|
1609
1609
|
};
|
|
1610
1610
|
const display = content.startsWith("@") ? content.slice(1) : content;
|
|
1611
1611
|
if (display === "") return base;
|
|
@@ -1745,9 +1745,13 @@ function replyToCanonical(reply) {
|
|
|
1745
1745
|
type: "reply",
|
|
1746
1746
|
messageId: ""
|
|
1747
1747
|
};
|
|
1748
|
+
const senderUid = emptyToUndefined(reply.senderUid);
|
|
1749
|
+
const senderUin = emptyToUndefined(reply.senderUin);
|
|
1748
1750
|
return {
|
|
1749
1751
|
type: "reply",
|
|
1750
|
-
messageId: reply.replayMsgId ?? ""
|
|
1752
|
+
messageId: reply.replayMsgId ?? "",
|
|
1753
|
+
...senderUid !== void 0 ? { senderUid } : {},
|
|
1754
|
+
...senderUin !== void 0 ? { senderUin } : {}
|
|
1751
1755
|
};
|
|
1752
1756
|
}
|
|
1753
1757
|
/**
|
|
@@ -2023,6 +2027,7 @@ var GroupApi = class {
|
|
|
2023
2027
|
*/
|
|
2024
2028
|
async setMemberShutUp(groupCode, members) {
|
|
2025
2029
|
if (members.length === 0) throw kernelError("setMemberShutUp 需要至少一个成员", "INVALID_PARAM");
|
|
2030
|
+
if (members.some(({ duration }) => !Number.isSafeInteger(duration) || duration < 0)) throw kernelError("禁言时长必须是非负整数秒,0 表示解除", "INVALID_PARAM");
|
|
2026
2031
|
const raw = await this.service.setMemberShutUp(groupCode, members.map((m) => ({
|
|
2027
2032
|
uid: m.uid,
|
|
2028
2033
|
timeStamp: m.duration
|
|
@@ -2252,6 +2257,66 @@ function extractGroupDetail(result, raw) {
|
|
|
2252
2257
|
return isGroupDetailInfo(candidate) ? candidate : null;
|
|
2253
2258
|
}
|
|
2254
2259
|
// src/apis/group-notify.ts
|
|
2260
|
+
/**
|
|
2261
|
+
* GroupNotifyApi:群通知/禁言列表语义化 API(ADR-009 统一错误语义,P2-13)
|
|
2262
|
+
*
|
|
2263
|
+
* get_group_system_msg / set_group_add_request / get_group_shut_list 共用。
|
|
2264
|
+
* getSingleScreenNotifies / getGroupShutUpMemberList 的列表可能走 listener 回调,
|
|
2265
|
+
* 直接调用返回形状待探测校准:兼容 result 数组 / 字段 / Map。
|
|
2266
|
+
*
|
|
2267
|
+
* 列表提取一律走元素级类型守卫(`isGroupNotify` / `isGroupMember`):
|
|
2268
|
+
* 原生返回数组里混入 null / 字符串 / 残缺对象时逐项丢弃,而不是整数组强转。
|
|
2269
|
+
*/
|
|
2270
|
+
const requestTypes = {
|
|
2271
|
+
invitation: GroupNotifyMsgType.INVITED_BY_MEMBER,
|
|
2272
|
+
invited_join_request: GroupNotifyMsgType.INVITED_NEED_ADMINI_STRATOR_PASS,
|
|
2273
|
+
join_request: GroupNotifyMsgType.REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS
|
|
2274
|
+
};
|
|
2275
|
+
const GROUP_CODE = /^[1-9]\d*$/;
|
|
2276
|
+
/** 仅接受有完整审批标识的未处理群通知。 */
|
|
2277
|
+
function toPendingGroupRequest(notify, doubt) {
|
|
2278
|
+
const { status, type, seq, group, user1, user2, postscript } = notify;
|
|
2279
|
+
const groupCode = group?.groupCode;
|
|
2280
|
+
if (status !== GroupNotifyMsgStatus.KUNHANDLE || typeof seq !== "string" || seq.trim() === "" || typeof groupCode !== "string" || !GROUP_CODE.test(groupCode)) return;
|
|
2281
|
+
const kind = requestKinds.find((key) => requestTypes[key] === type);
|
|
2282
|
+
if (kind === void 0) return;
|
|
2283
|
+
return {
|
|
2284
|
+
request: {
|
|
2285
|
+
seq,
|
|
2286
|
+
groupCode,
|
|
2287
|
+
kind,
|
|
2288
|
+
doubt
|
|
2289
|
+
},
|
|
2290
|
+
...typeof user1?.uid === "string" && user1.uid !== "" ? { initiatorUid: user1.uid } : {},
|
|
2291
|
+
...typeof user2?.uid === "string" && user2.uid !== "" ? { targetUid: user2.uid } : {},
|
|
2292
|
+
...typeof postscript === "string" ? { comment: postscript } : {}
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
2295
|
+
const requestKinds = [
|
|
2296
|
+
"invitation",
|
|
2297
|
+
"invited_join_request",
|
|
2298
|
+
"join_request"
|
|
2299
|
+
];
|
|
2300
|
+
/** 兼容按序号审批的协议。指定队列时只读取该队列。 */
|
|
2301
|
+
async function findPendingGroupRequest(api, filter, count) {
|
|
2302
|
+
const queues = filter.doubt === void 0 ? [false, true] : [filter.doubt];
|
|
2303
|
+
const kinds = typeof filter.kind === "string" ? [filter.kind] : filter.kind;
|
|
2304
|
+
const matches = /* @__PURE__ */ new Map();
|
|
2305
|
+
for (const doubt of queues) {
|
|
2306
|
+
const notifies = await api.getSingleScreenNotifies(doubt, count);
|
|
2307
|
+
for (const notify of notifies.filter(({ seq }) => seq === filter.seq)) {
|
|
2308
|
+
const request = toPendingGroupRequest(notify, doubt)?.request;
|
|
2309
|
+
if (request !== void 0 && request.groupCode === (filter.groupCode ?? request.groupCode) && kinds?.includes(request.kind) !== false) matches.set(JSON.stringify(request), {
|
|
2310
|
+
request,
|
|
2311
|
+
notify
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
if (matches.size > 1) throw kernelError("群请求标识有多个匹配,请指定队列、群号和类型", "INVALID_PARAM");
|
|
2316
|
+
const match = matches.values().next().value;
|
|
2317
|
+
if (match === void 0) throw kernelError("未找到待处理群请求", "NOT_FOUND");
|
|
2318
|
+
return match;
|
|
2319
|
+
}
|
|
2255
2320
|
/** 群通知 API:从 session 拿 group service,包装成语义化方法。 */
|
|
2256
2321
|
var GroupNotifyApi = class {
|
|
2257
2322
|
service;
|
|
@@ -2261,7 +2326,27 @@ var GroupNotifyApi = class {
|
|
|
2261
2326
|
/** 单屏通知列表(get_group_system_msg / set_group_add_request 共用)。 */
|
|
2262
2327
|
async getSingleScreenNotifies(doubt, count) {
|
|
2263
2328
|
const raw = await this.service.getSingleScreenNotifies(doubt, "", count);
|
|
2264
|
-
|
|
2329
|
+
checkLooseResult("getSingleScreenNotifies", raw);
|
|
2330
|
+
const result = isRecord(raw) ? raw["result"] : void 0;
|
|
2331
|
+
return extractNotifyList(result !== null && typeof result === "object" ? result : raw);
|
|
2332
|
+
}
|
|
2333
|
+
/** 从实时通知提取可供 IPC 消费的请求。 */
|
|
2334
|
+
getPendingGroupRequests(doubt, notifies) {
|
|
2335
|
+
return extractNotifyList(notifies).flatMap((notify) => {
|
|
2336
|
+
const pending = toPendingGroupRequest(notify, doubt);
|
|
2337
|
+
return pending === void 0 ? [] : [pending];
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
/** 处理同一登录会话发出的请求引用。QQ 负责权限与请求有效性判定。 */
|
|
2341
|
+
async respondToRequest(request, approve, reason = "") {
|
|
2342
|
+
const { seq, groupCode, kind, doubt } = request;
|
|
2343
|
+
if (!requestKinds.includes(kind) || seq.trim() === "" || !GROUP_CODE.test(groupCode)) throw kernelError("群请求引用无效", "INVALID_PARAM");
|
|
2344
|
+
await this.operateRequest(doubt, {
|
|
2345
|
+
seq,
|
|
2346
|
+
type: requestTypes[kind],
|
|
2347
|
+
groupCode,
|
|
2348
|
+
postscript: reason || " "
|
|
2349
|
+
}, approve ? NTGroupRequestOperateTypes.KAGREE : NTGroupRequestOperateTypes.KREFUSE);
|
|
2265
2350
|
}
|
|
2266
2351
|
/** 禁言成员列表(get_group_shut_list)。 */
|
|
2267
2352
|
async getGroupShutUpMemberList(groupCode) {
|
|
@@ -2277,15 +2362,18 @@ var GroupNotifyApi = class {
|
|
|
2277
2362
|
if (group !== void 0) ({groupCode} = group);
|
|
2278
2363
|
let postscript = reason;
|
|
2279
2364
|
if (postscript === "") postscript = " ";
|
|
2280
|
-
await this.
|
|
2365
|
+
await this.operateRequest(doubt, {
|
|
2366
|
+
seq,
|
|
2367
|
+
type,
|
|
2368
|
+
groupCode,
|
|
2369
|
+
postscript
|
|
2370
|
+
}, operateType);
|
|
2371
|
+
}
|
|
2372
|
+
async operateRequest(doubt, targetMsg, operateType) {
|
|
2373
|
+
checkLooseResult("operateSysNotify", await this.service.operateSysNotify(doubt, {
|
|
2281
2374
|
operateType,
|
|
2282
|
-
targetMsg
|
|
2283
|
-
|
|
2284
|
-
type,
|
|
2285
|
-
groupCode,
|
|
2286
|
-
postscript
|
|
2287
|
-
}
|
|
2288
|
-
});
|
|
2375
|
+
targetMsg
|
|
2376
|
+
}));
|
|
2289
2377
|
}
|
|
2290
2378
|
};
|
|
2291
2379
|
/** 群通知项形状判定(seq 字符串 + type 数字是 GroupNotify 的必备标识)。 */
|
|
@@ -2446,8 +2534,25 @@ async function statFile(path, label = "图片") {
|
|
|
2446
2534
|
/** 计算文件 md5(十六进制小写)。 */
|
|
2447
2535
|
async function hashFile(path, label = "图片") {
|
|
2448
2536
|
try {
|
|
2449
|
-
const
|
|
2450
|
-
|
|
2537
|
+
const flags = constants.O_RDONLY | (process.platform === "win32" ? 0 : constants.O_NONBLOCK);
|
|
2538
|
+
const handle = await open(path, flags);
|
|
2539
|
+
try {
|
|
2540
|
+
const info = await handle.stat();
|
|
2541
|
+
if (!info.isFile()) throw new Error("摘要输入必须是普通文件");
|
|
2542
|
+
const hash = createHash("md5");
|
|
2543
|
+
const chunk = Buffer.alloc(65536);
|
|
2544
|
+
let remaining = info.size;
|
|
2545
|
+
while (remaining > 0) {
|
|
2546
|
+
const { bytesRead } = await handle.read(chunk, 0, Math.min(remaining, chunk.length));
|
|
2547
|
+
if (bytesRead === 0) throw new Error("摘要读取期间文件缩短");
|
|
2548
|
+
hash.update(chunk.subarray(0, bytesRead));
|
|
2549
|
+
remaining -= bytesRead;
|
|
2550
|
+
}
|
|
2551
|
+
if ((await handle.read(chunk, 0, 1)).bytesRead !== 0) throw new Error("摘要读取期间文件增长");
|
|
2552
|
+
return hash.digest("hex");
|
|
2553
|
+
} finally {
|
|
2554
|
+
await handle.close();
|
|
2555
|
+
}
|
|
2451
2556
|
} catch {
|
|
2452
2557
|
throw kernelError(`${label}文件读取失败: ${path}`, "INVALID_PARAM");
|
|
2453
2558
|
}
|
|
@@ -5527,7 +5632,7 @@ function getElectronProcessType(proc) {
|
|
|
5527
5632
|
function defaultEngineConfig(env, qqDataPath) {
|
|
5528
5633
|
const platform = detectPlatformType();
|
|
5529
5634
|
const fullVersion = env.qqVersion ?? "";
|
|
5530
|
-
const wrapperPath = env.wrapperPath ?? process.env["NAPUKETTO_WRAPPER_PATH"] ?? process.env["NAPUTO_WRAPPER_PATH"] ?? "";
|
|
5635
|
+
const wrapperPath = env.wrapperPath ?? process$1.env["NAPUKETTO_WRAPPER_PATH"] ?? process$1.env["NAPUTO_WRAPPER_PATH"] ?? "";
|
|
5531
5636
|
const majorPath = wrapperPath !== "" ? join(dirname(wrapperPath), "major.node") : "";
|
|
5532
5637
|
const qua = (majorPath !== "" ? parseQuaFromMajor(majorPath) : null) ?? (fullVersion !== "" ? buildQua(fullVersion, platform) : "");
|
|
5533
5638
|
return {
|
|
@@ -5535,7 +5640,7 @@ function defaultEngineConfig(env, qqDataPath) {
|
|
|
5535
5640
|
platform_type: platform,
|
|
5536
5641
|
app_type: 4,
|
|
5537
5642
|
app_version: fullVersion,
|
|
5538
|
-
os_version: version() || process.platform,
|
|
5643
|
+
os_version: version() || process$1.platform,
|
|
5539
5644
|
use_xlog: platform !== PlatformType.KWINDOWS,
|
|
5540
5645
|
qua,
|
|
5541
5646
|
global_path_config: { desktopGlobalPath: qqDataPath ?? env.dataDir ?? "" },
|
|
@@ -5553,7 +5658,7 @@ function defaultEngineConfig(env, qqDataPath) {
|
|
|
5553
5658
|
* - "utility":utilityProcess Worker(路线 B,2026-08-06)
|
|
5554
5659
|
*/
|
|
5555
5660
|
function electronProcessType() {
|
|
5556
|
-
return getElectronProcessType(process);
|
|
5661
|
+
return getElectronProcessType(process$1);
|
|
5557
5662
|
}
|
|
5558
5663
|
/**
|
|
5559
5664
|
* 解析 QQ 用户数据根(登录数据目录,如 `C:\Users\<user>\Documents\Tencent Files`)。
|
|
@@ -5571,13 +5676,13 @@ function electronProcessType() {
|
|
|
5571
5676
|
* 其余 Windows 场景走官方 API + 默认位置兜底。
|
|
5572
5677
|
*/
|
|
5573
5678
|
function resolveQqUserDataRoot(exports, opts = {}) {
|
|
5574
|
-
if (process.env["NAPUKETTO_SANDBOX_ROOT"]) {
|
|
5575
|
-
const dataRoot = resolveDataRoot(opts.dataRoot || process.env["NAPUKETTO_DATA_ROOT"] || process.env["NAPUTO_DATA_ROOT"]);
|
|
5679
|
+
if (process$1.env["NAPUKETTO_SANDBOX_ROOT"]) {
|
|
5680
|
+
const dataRoot = resolveDataRoot(opts.dataRoot || process$1.env["NAPUKETTO_DATA_ROOT"] || process$1.env["NAPUTO_DATA_ROOT"]);
|
|
5576
5681
|
resolveSandboxWritePath(resolveQqGlobalPath(dataRoot), "QQ 数据目录");
|
|
5577
5682
|
return dataRoot;
|
|
5578
5683
|
}
|
|
5579
5684
|
if ((opts.platform ?? detectPlatformType()) === PlatformType.KLINUX) {
|
|
5580
|
-
const dataRoot = opts.dataRoot ?? process.env["NAPUKETTO_DATA_ROOT"] ?? process.env["NAPUTO_DATA_ROOT"] ?? process.env["NAPUKETTO_DATA"] ?? process.env["NAPKETTO_DATA"] ?? "";
|
|
5685
|
+
const dataRoot = opts.dataRoot ?? process$1.env["NAPUKETTO_DATA_ROOT"] ?? process$1.env["NAPUTO_DATA_ROOT"] ?? process$1.env["NAPUKETTO_DATA"] ?? process$1.env["NAPKETTO_DATA"] ?? "";
|
|
5581
5686
|
if (dataRoot !== "") return dataRoot;
|
|
5582
5687
|
}
|
|
5583
5688
|
return extractUserDataRoot(exports) ?? join(homedir(), "Documents", "Tencent Files");
|
|
@@ -5722,7 +5827,7 @@ function startNapuketto(options) {
|
|
|
5722
5827
|
prepareSession(ctx, hasCapturedSession, isSelfHost);
|
|
5723
5828
|
initEngine(ctx, resolveEngineConfig(ctx, env, engineConfig));
|
|
5724
5829
|
resolveLoginService(ctx, qqLoginService);
|
|
5725
|
-
ctx.wrapperPath = env?.wrapperPath ?? process.env["NAPUKETTO_WRAPPER_PATH"] ?? process.env["NAPUTO_WRAPPER_PATH"];
|
|
5830
|
+
ctx.wrapperPath = env?.wrapperPath ?? process$1.env["NAPUKETTO_WRAPPER_PATH"] ?? process$1.env["NAPUTO_WRAPPER_PATH"];
|
|
5726
5831
|
if (isSelfHost) activateO3MiscService(wrapperExports);
|
|
5727
5832
|
finishSession(ctx, hasCapturedSession, isSelfHost, sessionConfig);
|
|
5728
5833
|
return ctx;
|
|
@@ -5799,7 +5904,7 @@ function getOrCreateLoginService(exports) {
|
|
|
5799
5904
|
*/
|
|
5800
5905
|
function dlopenWrapper(wrapperPath) {
|
|
5801
5906
|
const m = { exports: {} };
|
|
5802
|
-
process.dlopen(m, wrapperPath);
|
|
5907
|
+
process$1.dlopen(m, wrapperPath);
|
|
5803
5908
|
if (!Object.keys(m.exports).includes("NodeIKernelLoginService")) throw kernelError("exports 无 NodeIKernelLoginService(stub 环境异常?)", "INVALID_STATE");
|
|
5804
5909
|
if (!isWrapperNodeApi(m.exports)) throw kernelError(`wrapper.node at ${wrapperPath} did not export expected QQNT symbols`, "INVALID_STATE");
|
|
5805
5910
|
return m.exports;
|
|
@@ -6104,7 +6209,7 @@ const WRAPPER_PATH_ENV_KEYS = ["NAPUKETTO_WRAPPER_PATH", "NAPUTO_WRAPPER_PATH"];
|
|
|
6104
6209
|
function resolveWrapperPath$1(wrapper) {
|
|
6105
6210
|
if (wrapper.wrapperPath !== void 0 && wrapper.wrapperPath !== "") return wrapper.wrapperPath;
|
|
6106
6211
|
for (const key of WRAPPER_PATH_ENV_KEYS) {
|
|
6107
|
-
const value = process.env[key];
|
|
6212
|
+
const value = process$1.env[key];
|
|
6108
6213
|
if (value !== void 0 && value !== "") return value;
|
|
6109
6214
|
}
|
|
6110
6215
|
}
|
|
@@ -6809,7 +6914,7 @@ function probeRuntime(ctx, file = "napuketto-probe.json") {
|
|
|
6809
6914
|
/** 探测结果落盘(增量与最终共用;最终写入后记 probeFile 路径)。 */
|
|
6810
6915
|
function writeProbeFile(result, file) {
|
|
6811
6916
|
try {
|
|
6812
|
-
const dir = process.env["NAPUKETTO_CFG_DIR"] ?? process.env["NAPUTO_CFG_DIR"] ?? process.cwd();
|
|
6917
|
+
const dir = process$1.env["NAPUKETTO_CFG_DIR"] ?? process$1.env["NAPUTO_CFG_DIR"] ?? process$1.cwd();
|
|
6813
6918
|
mkdirSync(dir, { recursive: true });
|
|
6814
6919
|
const full = join(dir, file);
|
|
6815
6920
|
writeFileSync(full, JSON.stringify(result, null, 2), "utf8");
|
|
@@ -6918,7 +7023,7 @@ function createRecordingListener(service, onEvent) {
|
|
|
6918
7023
|
* 空壳的 service getter 函数仍在但调用返回 null(late probe 61/63 null 的根因)。
|
|
6919
7024
|
*/
|
|
6920
7025
|
function startListenerRecording(ctx, file = "napuketto-listener-record.jsonl") {
|
|
6921
|
-
const dir = process.env["NAPUKETTO_CFG_DIR"] ?? process.env["NAPUTO_CFG_DIR"] ?? process.cwd();
|
|
7026
|
+
const dir = process$1.env["NAPUKETTO_CFG_DIR"] ?? process$1.env["NAPUTO_CFG_DIR"] ?? process$1.cwd();
|
|
6922
7027
|
mkdirSync(dir, { recursive: true });
|
|
6923
7028
|
const full = join(dir, file);
|
|
6924
7029
|
writeFileSync(full, "", "utf8");
|
|
@@ -7067,4 +7172,4 @@ function listQQVersions(installDir) {
|
|
|
7067
7172
|
return statSync(full).isDirectory() && existsSync(join(full, "resources", "app", "wrapper.node"));
|
|
7068
7173
|
}).sort().reverse();
|
|
7069
7174
|
}
|
|
7070
|
-
export { BuddyCache, CONFIG_FILE_MODE, ChatType, ConfigBase, ConfigError, DEFAULT_DATA_ROOT_NAME, DependsAdapter, DispatcherAdapter, EXIT_CONFIG_INVALID, ElementType, EssenceListSync, FlashTransferApi, FriendApi, FriendBridge, GlobalAdapter, GrayTipSubType, GroupApi, GroupBridge, GroupCache, GroupListUpdateType, GroupMemberDataSource, GroupNotifyApi, GroupNotifyMsgStatus, GroupNotifyMsgType, KERNEL_ERROR_CODES, KernelError, LoginBridge, MAIN_CONFIG_FILE, MsgApi, MsgBridge, NTEventChannel, NTGroupMemberRole, NTGroupRequestOperateTypes, NapukettoCore, PathWrapper, ProfileApi, ProfileLikeApi, QrLoginSession, RecentContactApi, RecentContactBridge, RichMediaApi, TicketApi, TipGroupElementType, VIDEO_THUMB_KEY, WebApi, WebHonorType, activateO3MiscService, buildEngineConfig, buildLoginConfig, buildSessionConfig, configError, createConsoleFormatStream, createCoreContext, createKernelRuntime, createSessionListener as createLifecycleSessionListener, createSessionListener, createLogger, createLoginListener, createRecordingListener, createSession, createWrapper, diffEssenceList, dlopenWrapper, electronProcessType, errorMessage, getErrorCode, getErrorMessage, getExistingSession, getMainSession, getOwnProp, hasBooleanProp, hasCallableProp, hasFunctionProp, hasMethodSurface, hasNumberProp, hasStaticCreator, hasStaticGetter, hasStringProp, initAndStartSession, initEngine, initSession, isCallable, isKernelError, isPromiseLike, isRecord, kernelError, listLoginAccounts, listQQVersions, narrowBuddyCategories, narrowEssenceGroupArg, parseAppidFromMajor, parseJsonWithGuard, parseLogConfig, parseToml, probeRuntime, quickLogin, readMachineGuid, requireKernelService, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveSandboxWritePath, resolveWrapperPath, sleep, startListenerRecording, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitFor, waitForNetworkConnection, waitSessionReady };
|
|
7175
|
+
export { BuddyCache, CONFIG_FILE_MODE, ChatType, ConfigBase, ConfigError, DEFAULT_DATA_ROOT_NAME, DependsAdapter, DispatcherAdapter, EXIT_CONFIG_INVALID, ElementType, EssenceListSync, FlashTransferApi, FriendApi, FriendBridge, GlobalAdapter, GrayTipSubType, GroupApi, GroupBridge, GroupCache, GroupListUpdateType, GroupMemberDataSource, GroupNotifyApi, GroupNotifyMsgStatus, GroupNotifyMsgType, KERNEL_ERROR_CODES, KernelError, LoginBridge, MAIN_CONFIG_FILE, MsgApi, MsgBridge, NTEventChannel, NTGroupMemberRole, NTGroupRequestOperateTypes, NapukettoCore, PathWrapper, ProfileApi, ProfileLikeApi, QrLoginSession, RecentContactApi, RecentContactBridge, RichMediaApi, TicketApi, TipGroupElementType, VIDEO_THUMB_KEY, WebApi, WebHonorType, activateO3MiscService, buildEngineConfig, buildLoginConfig, buildSessionConfig, configError, createConsoleFormatStream, createCoreContext, createKernelRuntime, createSessionListener as createLifecycleSessionListener, createSessionListener, createLogger, createLoginListener, createRecordingListener, createSession, createWrapper, diffEssenceList, dlopenWrapper, electronProcessType, errorMessage, findPendingGroupRequest, getErrorCode, getErrorMessage, getExistingSession, getMainSession, getOwnProp, hasBooleanProp, hasCallableProp, hasFunctionProp, hasMethodSurface, hasNumberProp, hasStaticCreator, hasStaticGetter, hasStringProp, initAndStartSession, initEngine, initSession, isCallable, isKernelError, isPromiseLike, isRecord, kernelError, listLoginAccounts, listQQVersions, narrowBuddyCategories, narrowEssenceGroupArg, parseAppidFromMajor, parseJsonWithGuard, parseLogConfig, parseToml, probeRuntime, quickLogin, readMachineGuid, requireKernelService, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveSandboxWritePath, resolveWrapperPath, sleep, startListenerRecording, startNapuketto, startSession, stringifyToml, toCanonicalElements, toPendingGroupRequest, toSendElements, waitFor, waitForNetworkConnection, waitSessionReady };
|