@napuketto/kernel 0.13.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -64,6 +64,112 @@ function configError(message, options) {
64
64
  }
65
65
  /** 配置校验失败的进程退出码(UNIX sysexits EX_CONFIG 惯例)。 */
66
66
  const EXIT_CONFIG_INVALID = 78;
67
+ // src/utils/type-guards.ts
68
+ /**
69
+ * 通用运行时类型守卫集(全仓复用,零依赖)
70
+ *
71
+ * 目标:把「外部边界进来的 unknown」经**可证明的**运行时检查收窄为业务类型,
72
+ * 取代双重断言 / 单重断言一类绕过编译器的虚假类型安全。
73
+ *
74
+ * 约定:
75
+ * - 只做形状判定,不做业务语义校验(业务错误仍由调用方抛 KernelError);
76
+ * - 守卫是 `val is T` 型谓词,收窄由编译器自然推导,调用方无需再断言;
77
+ * - 失败路径统一经 kernelError 抛 INVALID_STATE(ADR-009),不抛裸 Error。
78
+ *
79
+ */
80
+ /** 判断未知值是否为非 null、非数组的普通对象 Record。 */
81
+ function isRecord(val) {
82
+ return typeof val === "object" && val !== null && !Array.isArray(val);
83
+ }
84
+ /** 判断未知值是否为可调用的函数。 */
85
+ function isCallable(val) {
86
+ return typeof val === "function";
87
+ }
88
+ /**
89
+ * 安全读取任意值上的属性(支持 plain object 及带有原型链的原生 C++ 包装实例 / 函数对象)。
90
+ */
91
+ function getOwnProp(val, key) {
92
+ if (typeof val !== "object" && typeof val !== "function" || val === null) return;
93
+ return Reflect.get(val, key);
94
+ }
95
+ /** 判断未知值是否为包含指定 string 属性的对象。 */
96
+ function hasStringProp(val, key) {
97
+ return isRecord(val) && typeof val[key] === "string";
98
+ }
99
+ /** 判断未知值是否为包含指定有限 number 属性的对象。 */
100
+ function hasNumberProp(val, key) {
101
+ return isRecord(val) && typeof val[key] === "number" && Number.isFinite(val[key]);
102
+ }
103
+ /** 判断未知值是否为包含指定 boolean 属性的对象。 */
104
+ function hasBooleanProp(val, key) {
105
+ return isRecord(val) && typeof val[key] === "boolean";
106
+ }
107
+ /**
108
+ * 判断未知值(对象或原生构造器函数)是否具备指定名称的可调用方法。
109
+ * 注意:参数类型收窄为 `...args: unknown[]`,支持直接传参或 `.call(target, ...)` 调用。
110
+ */
111
+ function hasFunctionProp(val, key) {
112
+ if (typeof val !== "object" && typeof val !== "function" || val === null) return false;
113
+ return typeof Reflect.get(val, key) === "function";
114
+ }
115
+ /** `hasFunctionProp` 的语义别名,专用于反射与原生边界探测。 */
116
+ const hasCallableProp = hasFunctionProp;
117
+ /**
118
+ * 判断目标对象/实例是否同时具备一组方法面(Method Surface)。
119
+ */
120
+ function hasMethodSurface(val, methods) {
121
+ if (typeof val !== "object" && typeof val !== "function" || val === null) return false;
122
+ for (const m of methods) if (typeof Reflect.get(val, m) !== "function") return false;
123
+ return true;
124
+ }
125
+ /** 判断未知值是否为包含静态 `.get()` 工厂方法的原生导出项。 */
126
+ function hasStaticGetter(val) {
127
+ return hasFunctionProp(val, "get");
128
+ }
129
+ /** 判断未知值是否为包含静态 `.create()` 工厂方法的原生导出项。 */
130
+ function hasStaticCreator(val) {
131
+ return hasFunctionProp(val, "create");
132
+ }
133
+ /** 判断未知值是否为 Promise-like(具备 `.then` 与 `.catch` 方法)。 */
134
+ function isPromiseLike(val) {
135
+ return hasFunctionProp(val, "then") && hasFunctionProp(val, "catch");
136
+ }
137
+ /** 从未知异常中安全提取系统错误码(如 ENOENT / ESRCH / EPERM)。 */
138
+ function getErrorCode(err) {
139
+ if (!isRecord(err)) return void 0;
140
+ return typeof err["code"] === "string" ? err["code"] : void 0;
141
+ }
142
+ /** 从未知异常中安全提取错误消息文本。 */
143
+ function getErrorMessage(err) {
144
+ if (err instanceof Error) return err.message;
145
+ if (isRecord(err) && typeof err["message"] === "string") return err["message"];
146
+ return String(err);
147
+ }
148
+ /** 安全解析 JSON 文本并交由类型守卫验证,校验失败或解析抛错均返回 null。 */
149
+ function parseJsonWithGuard(raw, guard) {
150
+ try {
151
+ const parsed = JSON.parse(raw);
152
+ return guard(parsed) ? parsed : null;
153
+ } catch {
154
+ return null;
155
+ }
156
+ }
157
+ /**
158
+ * 校验原生 Kernel Service 实例是否非空且具备要求的核心方法集合。
159
+ *
160
+ * 原生 `get*Service()` 在 session 未 init / 句柄失效时可能返回 null、undefined、
161
+ * 已 `isNull()` 的空句柄或残缺对象——直接断言成 NodeIKernel*Service
162
+ * 会让调用方在第一次方法调用时炸出裸 TypeError。这里统一在边界拦截:
163
+ * 空 / 非对象 / isNull() === true / 缺失关键方法一律抛 INVALID_STATE。
164
+ */
165
+ function requireKernelService(service, serviceName, requiredMethods = []) {
166
+ if (service === null || service === void 0 || typeof service !== "object") throw kernelError(`${serviceName}() 返回空(session 未 init)`, "INVALID_STATE");
167
+ if (hasFunctionProp(service, "isNull")) {
168
+ if (service["isNull"]() === true) throw kernelError(`${serviceName}() 返回空句柄(isNull 为 true)`, "INVALID_STATE");
169
+ }
170
+ for (const method of requiredMethods) if (typeof Reflect.get(service, method) !== "function") throw kernelError(`${serviceName}() 返回对象缺失必要方法: ${method}`, "INVALID_STATE");
171
+ return service;
172
+ }
67
173
  // src/infra/config.ts
68
174
  /**
69
175
  * 配置基类(ADR-012)
@@ -81,7 +187,7 @@ function inferFormat(path) {
81
187
  return "json";
82
188
  }
83
189
  function isMissingFileError(err) {
84
- if (err instanceof Error) return err.code === "ENOENT";
190
+ if (err instanceof Error) return getErrorCode(err) === "ENOENT";
85
191
  return false;
86
192
  }
87
193
  /**
@@ -152,7 +258,10 @@ var ConfigBase = class {
152
258
  }
153
259
  /** 对象 → 文本(TOML/JSON)。 */
154
260
  serialize(value) {
155
- if (this.format === "toml") return stringify(value);
261
+ if (this.format === "toml") {
262
+ if (!isRecord(value)) throw configError(`TOML 配置根必须是对象: ${this.path}`);
263
+ return stringify(value);
264
+ }
156
265
  return JSON.stringify(value, null, 4);
157
266
  }
158
267
  /** 文本 → 对象(TOML/JSON)。 */
@@ -224,20 +333,34 @@ const MODULE_NAME_VALUES = [
224
333
  "loader",
225
334
  "ob11"
226
335
  ];
336
+ /** 运行时判定是否为日志级别。 */
337
+ function isLogLevel(value) {
338
+ return typeof value === "string" && LOG_LEVEL_VALUES.some((v) => v === value);
339
+ }
340
+ /** 运行时判定是否为控制台输出格式。 */
341
+ function isLogFormat(value) {
342
+ return typeof value === "string" && LOG_FORMAT_VALUES.some((v) => v === value);
343
+ }
344
+ /** 运行时判定是否为时间戳模式。 */
345
+ function isTimestampMode(value) {
346
+ return typeof value === "string" && TIMESTAMP_MODE_VALUES.some((v) => v === value);
347
+ }
348
+ /** 运行时判定是否为可覆盖级别的模块名。 */
349
+ function isLogModuleName(value) {
350
+ return MODULE_NAME_VALUES.some((v) => v === value);
351
+ }
227
352
  /** 校验级别字面量;非法值抛 INVALID_PARAM。 */
228
353
  function requireLevel(value, key) {
229
- if (typeof value !== "string" || !LOG_LEVEL_VALUES.includes(value)) throw kernelError(`主配置 ${key} 必须是日志级别(${LOG_LEVEL_VALUES.join(" / ")})`, "INVALID_PARAM");
354
+ if (!isLogLevel(value)) throw kernelError(`主配置 ${key} 必须是日志级别(${LOG_LEVEL_VALUES.join(" / ")})`, "INVALID_PARAM");
230
355
  return value;
231
356
  }
232
357
  /** 宽松级别解析(env 覆盖用;非法/缺失返回 undefined 不生效)。 */
233
358
  function optionalLevel(value) {
234
- if (value === void 0) return;
235
- return LOG_LEVEL_VALUES.includes(value) ? value : void 0;
359
+ return isLogLevel(value) ? value : void 0;
236
360
  }
237
361
  /** 宽松格式解析(env 覆盖用)。 */
238
362
  function optionalFormat(value) {
239
- if (value === void 0) return;
240
- return LOG_FORMAT_VALUES.includes(value) ? value : void 0;
363
+ return isLogFormat(value) ? value : void 0;
241
364
  }
242
365
  /** 宽松布尔解析(env 用:仅识别 1/true/0/false,其余忽略)。 */
243
366
  function optionalBool(value) {
@@ -247,41 +370,44 @@ function optionalBool(value) {
247
370
  /** 解析 [log.levels] 按模块覆盖表(未知模块名报错,键集封闭防拼写错误)。 */
248
371
  function parseModuleLevels(raw) {
249
372
  if (raw === void 0) return {};
250
- if (typeof raw !== "object" || raw === null) throw kernelError("主配置 log.levels 必须是对象", "INVALID_PARAM");
373
+ if (!isRecord(raw)) throw kernelError("主配置 log.levels 必须是对象", "INVALID_PARAM");
251
374
  const out = {};
252
375
  for (const [key, value] of Object.entries(raw)) {
253
- if (!MODULE_NAME_VALUES.includes(key)) throw kernelError(`主配置 log.levels 未知模块 "${key}"(合法模块:${MODULE_NAME_VALUES.join(" / ")})`, "INVALID_PARAM");
376
+ if (!isLogModuleName(key)) throw kernelError(`主配置 log.levels 未知模块 "${key}"(合法模块:${MODULE_NAME_VALUES.join(" / ")})`, "INVALID_PARAM");
254
377
  out[key] = requireLevel(value, `log.levels.${key}`);
255
378
  }
256
379
  return out;
257
380
  }
258
381
  /** 解析 [log.file] 独立文件 sink。 */
259
382
  function parseLogFile(raw, fallbackLevel) {
260
- if (typeof raw !== "object" || raw === null) throw kernelError("主配置 log.file 必须是对象", "INVALID_PARAM");
261
- const record = raw;
262
- const path = record["path"];
383
+ if (!isRecord(raw)) throw kernelError("主配置 log.file 必须是对象", "INVALID_PARAM");
384
+ const path = raw["path"];
263
385
  if (typeof path !== "string" || path === "") throw kernelError("主配置 log.file.path 必须是非空字符串", "INVALID_PARAM");
264
386
  return {
265
387
  path,
266
- level: record["level"] === void 0 ? fallbackLevel : requireLevel(record["level"], "log.file.level")
388
+ level: raw["level"] === void 0 ? fallbackLevel : requireLevel(raw["level"], "log.file.level")
267
389
  };
268
390
  }
269
- /** 校验字面量枚举值(非法抛 INVALID_PARAM,报错文案带键名与合法值集)。 */
270
- function requireEnum(value, key, values) {
271
- if (typeof value !== "string" || !values.includes(value)) throw kernelError(`主配置 ${key} 必须是(${values.join(" / ")})`, "INVALID_PARAM");
272
- return value;
273
- }
274
391
  /** 校验布尔字段(undefined 保留原值)。 */
275
392
  function applyBoolean(draft, raw, key) {
276
- if (raw[key] === void 0) return;
277
- if (typeof raw[key] !== "boolean") throw kernelError(`主配置 log.${key} 必须是布尔值`, "INVALID_PARAM");
278
- draft[key] = raw[key];
393
+ const value = raw[key];
394
+ if (value === void 0) return;
395
+ if (typeof value !== "boolean") throw kernelError(`主配置 log.${key} 必须是布尔值`, "INVALID_PARAM");
396
+ draft[key] = value;
279
397
  }
280
398
  /** toml [log] 段字段填充(level/format/timestamp/banner/unboundReceive)。 */
281
399
  function applySectionFields(draft, raw) {
282
400
  if (raw["level"] !== void 0) draft.level = requireLevel(raw["level"], "log.level");
283
- if (raw["format"] !== void 0) draft.format = requireEnum(raw["format"], "log.format", LOG_FORMAT_VALUES);
284
- if (raw["timestamp"] !== void 0) draft.timestamp = requireEnum(raw["timestamp"], "log.timestamp", TIMESTAMP_MODE_VALUES);
401
+ const format = raw["format"];
402
+ if (format !== void 0) {
403
+ if (!isLogFormat(format)) throw kernelError(`主配置 log.format 必须是(${LOG_FORMAT_VALUES.join(" / ")})`, "INVALID_PARAM");
404
+ draft.format = format;
405
+ }
406
+ const timestamp = raw["timestamp"];
407
+ if (timestamp !== void 0) {
408
+ if (!isTimestampMode(timestamp)) throw kernelError(`主配置 log.timestamp 必须是(${TIMESTAMP_MODE_VALUES.join(" / ")})`, "INVALID_PARAM");
409
+ draft.timestamp = timestamp;
410
+ }
285
411
  applyBoolean(draft, raw, "banner");
286
412
  applyBoolean(draft, raw, "unboundReceive");
287
413
  }
@@ -317,68 +443,19 @@ function parseLogConfig(section, env = {}) {
317
443
  levels: {}
318
444
  };
319
445
  if (section !== void 0) {
320
- if (typeof section !== "object" || section === null) throw kernelError("主配置 log 段必须是对象", "INVALID_PARAM");
321
- const raw = section;
322
- applySectionFields(draft, raw);
323
- draft.levels = parseModuleLevels(raw["levels"]);
324
- if (raw["file"] !== void 0) {
325
- draft.file = parseLogFile(raw["file"], draft.level);
326
- draft.fileLevelExplicit = typeof raw["file"] === "object" && raw["file"] !== null && raw["file"]["level"] !== void 0;
446
+ if (!isRecord(section)) throw kernelError("主配置 log 段必须是对象", "INVALID_PARAM");
447
+ applySectionFields(draft, section);
448
+ draft.levels = parseModuleLevels(section["levels"]);
449
+ const file = section["file"];
450
+ if (file !== void 0) {
451
+ draft.file = parseLogFile(file, draft.level);
452
+ draft.fileLevelExplicit = isRecord(file) && file["level"] !== void 0;
327
453
  }
328
454
  }
329
455
  applyEnvOverrides(draft, env);
330
456
  delete draft.fileLevelExplicit;
331
457
  return draft;
332
458
  }
333
- // src/utils/type-guards.ts
334
- /**
335
- * 通用运行时类型守卫集(全仓复用,零依赖)
336
- *
337
- * 目标:把「外部边界进来的 unknown」经**可证明的**运行时检查收窄为业务类型,
338
- * 取代 `as unknown as T` / `as T` 一类绕过编译器的虚假类型安全。
339
- *
340
- * 约定:
341
- * - 只做形状判定,不做业务语义校验(业务错误仍由调用方抛 KernelError);
342
- * - 守卫是 `val is T` 型谓词,收窄由编译器自然推导,调用方无需再断言;
343
- * - 失败路径统一经 kernelError 抛 INVALID_STATE(ADR-009),不抛裸 Error。
344
- *
345
- */
346
- /** 判断未知值是否为非 null 且非数组的普通对象 Record。 */
347
- function isRecord(val) {
348
- return typeof val === "object" && val !== null && !Array.isArray(val);
349
- }
350
- /** 判断对象是否包含指定字段且类型为 string。 */
351
- function hasStringProp(obj, key) {
352
- return typeof obj[key] === "string";
353
- }
354
- /** 判断对象是否包含指定字段且类型为有限 number。 */
355
- function hasNumberProp(obj, key) {
356
- return typeof obj[key] === "number" && Number.isFinite(obj[key]);
357
- }
358
- /** 判断对象是否包含指定字段且类型为 boolean。 */
359
- function hasBooleanProp(obj, key) {
360
- return typeof obj[key] === "boolean";
361
- }
362
- /** 判断对象是否包含指定字段且类型为 function。 */
363
- function hasFunctionProp(obj, key) {
364
- return typeof obj[key] === "function";
365
- }
366
- /**
367
- * 校验并收窄 Kernel Session 返回的原生 Service 实例。
368
- *
369
- * 原生 `get*Service()` 在 session 未 init / 句柄失效时可能返回 null、undefined、
370
- * 已 `isNull()` 的空句柄或残缺对象——直接 `as unknown as NodeIKernel*Service`
371
- * 会让调用方在第一次方法调用时炸出裸 TypeError。这里统一在边界拦截:
372
- * 空 / 非对象 / isNull() === true / 缺失关键方法一律抛 INVALID_STATE。
373
- */
374
- function requireKernelService(raw, serviceName, requiredMethods = []) {
375
- if (raw === null || raw === void 0 || !isRecord(raw)) throw kernelError(`${serviceName}() 返回空(session 未 init)`, "INVALID_STATE");
376
- if (hasFunctionProp(raw, "isNull")) {
377
- if (raw["isNull"]() === true) throw kernelError(`${serviceName}() 返回空句柄(isNull 为 true)`, "INVALID_STATE");
378
- }
379
- for (const method of requiredMethods) if (typeof raw[method] !== "function") throw kernelError(`${serviceName}() 返回对象缺失必要方法: ${method}`, "INVALID_STATE");
380
- return raw;
381
- }
382
459
  // src/infra/log-format.ts
383
460
  /**
384
461
  * 控制台渲染流(pretty / single-line / json,2026-10-25 日志可配置化;
@@ -486,8 +563,8 @@ function renderJsonLine(record, ctx) {
486
563
  const jsonLine = {
487
564
  time: renderTime(time, ctx.timestamp, true, ctx.timeOriginMs),
488
565
  level: levelLabel(level).toLowerCase(),
489
- ...module !== void 0 ? { module } : typeof name === "string" ? { module: name } : {},
490
- ...account !== void 0 ? { account } : {},
566
+ ...typeof module === "string" ? { module } : typeof name === "string" ? { module: name } : {},
567
+ ...typeof account === "string" ? { account } : {},
491
568
  ...typeof pid === "number" ? { pid } : {},
492
569
  msg,
493
570
  ...fields
@@ -581,7 +658,7 @@ function renderMultilineStringLines(value, depth) {
581
658
  */
582
659
  function renderValueLines(value, depth) {
583
660
  if (Array.isArray(value)) return renderArrayLines(value, depth);
584
- if (typeof value === "object" && value !== null) return renderObjectLines(value, depth);
661
+ if (isRecord(value)) return renderObjectLines(value, depth);
585
662
  if (typeof value === "string" && value.includes("\n")) return renderMultilineStringLines(value, depth);
586
663
  return [`${NESTED_INDENT.repeat(depth)}${renderScalar(value)}`];
587
664
  }
@@ -1227,13 +1304,23 @@ var FriendApi = class {
1227
1304
  function assignOptional(info, key, value) {
1228
1305
  if (value !== void 0) info[key] = value;
1229
1306
  }
1307
+ /**
1308
+ * uid → uin 数值(解析失败返回 undefined,绝不产出 NaN)。
1309
+ *
1310
+ * uid 形如 `u_xxx` 且群口径未命中时 `Number(uid)` 是 NaN;NaN 混进 number 契约后
1311
+ * 经 JSON.stringify 变 null。这里只接受正安全整数(QQ 号),其余交给调用方省略字段。
1312
+ */
1313
+ function resolveDoubtUin(uid, uinMap) {
1314
+ const value = Number(uinMap.get(uid) ?? uid);
1315
+ return Number.isSafeInteger(value) && value > 0 ? value : void 0;
1316
+ }
1230
1317
  /** 单项转换:DoubtBuddyReq → OB11 结构(导出供单测,friend.test.ts)。 */
1231
1318
  function toDoubtFriendRequestInfo(item, uinMap) {
1232
1319
  const info = {
1233
1320
  flag: item.uid,
1234
- uin: Number(uinMap.get(item.uid) ?? item.uid),
1235
1321
  type: "doubt"
1236
1322
  };
1323
+ assignOptional(info, "uin", resolveDoubtUin(item.uid, uinMap));
1237
1324
  assignOptional(info, "nick", item.nick);
1238
1325
  assignOptional(info, "source", item.source);
1239
1326
  assignOptional(info, "reason", item.reason);
@@ -1975,9 +2062,19 @@ function toStringMap(value) {
1975
2062
  for (const [key, val] of value) if (typeof key === "string" && typeof val === "string") out.set(key, val);
1976
2063
  return out;
1977
2064
  }
1978
- /** 群成员形状判定(infos Map 的 value:uid + uin 齐备才算成员)。 */
2065
+ /** 可选字段:缺失(undefined/null)放行,存在时必须是 string。 */
2066
+ function isOptionalString$2(rec, key) {
2067
+ const v = rec[key];
2068
+ return v === void 0 || v === null || typeof v === "string";
2069
+ }
2070
+ /** 可选字段:缺失(undefined/null)放行,存在时必须是有限 number。 */
2071
+ function isOptionalNumber$2(rec, key) {
2072
+ const v = rec[key];
2073
+ return v === void 0 || v === null || typeof v === "number" && Number.isFinite(v);
2074
+ }
2075
+ /** 群成员形状判定(uid + uin 必备;展示 / 角色字段缺失即合法,存在则须类型正确)。 */
1979
2076
  function isGroupMember$1(val) {
1980
- return isRecord(val) && hasStringProp(val, "uid") && hasStringProp(val, "uin");
2077
+ return isRecord(val) && hasStringProp(val, "uid") && hasStringProp(val, "uin") && isOptionalString$2(val, "nick") && isOptionalString$2(val, "cardName") && isOptionalString$2(val, "remark") && isOptionalString$2(val, "joinTime") && isOptionalString$2(val, "lastSpeakTime") && isOptionalNumber$2(val, "role") && isOptionalNumber$2(val, "shutUpTime") && isOptionalNumber$2(val, "sex") && isOptionalNumber$2(val, "age");
1981
2078
  }
1982
2079
  /** infos Map → 成员数组(逐项形状校验,非成员项丢弃)。 */
1983
2080
  function memberListOf(infos) {
@@ -1985,9 +2082,9 @@ function memberListOf(infos) {
1985
2082
  for (const value of infos.values()) if (isGroupMember$1(value)) out.push(value);
1986
2083
  return out;
1987
2084
  }
1988
- /** 群详情形状判定(标识 / 名称 / 成员数四要素齐备才算详情)。 */
2085
+ /** 群详情形状判定(标识 / 名称 / 成员数四要素齐备;群号标识字段可选校验)。 */
1989
2086
  function isGroupDetailInfo(val) {
1990
- return isRecord(val) && hasStringProp(val, "groupCode") && hasStringProp(val, "groupName") && hasNumberProp(val, "memberNum") && hasNumberProp(val, "maxMemberNum");
2087
+ return isRecord(val) && hasStringProp(val, "groupCode") && hasStringProp(val, "groupName") && hasNumberProp(val, "memberNum") && hasNumberProp(val, "maxMemberNum") && isOptionalString$2(val, "groupUin") && isOptionalString$2(val, "ownerUin");
1991
2088
  }
1992
2089
  /**
1993
2090
  * 从 getAllMemberList 返回结构取出 infos Map。
@@ -2072,9 +2169,19 @@ var GroupNotifyApi = class {
2072
2169
  function isGroupNotify(val) {
2073
2170
  return isRecord(val) && hasStringProp(val, "seq") && hasNumberProp(val, "type");
2074
2171
  }
2075
- /** 群成员项形状判定(uid + uin 齐备才算成员)。 */
2172
+ /** 可选字段:缺失(undefined/null)放行,存在时必须是 string。 */
2173
+ function isOptionalString$1(rec, key) {
2174
+ const v = rec[key];
2175
+ return v === void 0 || v === null || typeof v === "string";
2176
+ }
2177
+ /** 可选字段:缺失放行,存在时必须是有限 number。 */
2178
+ function isOptionalNumber$1(rec, key) {
2179
+ const v = rec[key];
2180
+ return v === void 0 || v === null || typeof v === "number" && Number.isFinite(v);
2181
+ }
2182
+ /** 群成员项形状判定(uid + uin 必备;展示 / 角色字段缺失即合法,存在则须类型正确)。 */
2076
2183
  function isGroupMember(val) {
2077
- return isRecord(val) && hasStringProp(val, "uid") && hasStringProp(val, "uin");
2184
+ return isRecord(val) && hasStringProp(val, "uid") && hasStringProp(val, "uin") && isOptionalString$1(val, "nick") && isOptionalString$1(val, "cardName") && isOptionalString$1(val, "remark") && isOptionalString$1(val, "joinTime") && isOptionalString$1(val, "lastSpeakTime") && isOptionalNumber$1(val, "role") && isOptionalNumber$1(val, "shutUpTime");
2078
2185
  }
2079
2186
  /** 数组逐项守卫过滤(非数组 = 空数组)。 */
2080
2187
  function filterList(value, guard) {
@@ -2197,9 +2304,8 @@ function pttDownloadResult(latest, isLastPoll) {
2197
2304
  function extractFavEmojiUrls(list) {
2198
2305
  const out = [];
2199
2306
  for (const item of list) {
2200
- if (item === null || typeof item !== "object") continue;
2201
- const rec = item;
2202
- const url = rec["url"] ?? rec["imageUrl"] ?? rec["emojiUrl"];
2307
+ if (!isRecord(item)) continue;
2308
+ const url = item["url"] ?? item["imageUrl"] ?? item["emojiUrl"];
2203
2309
  if (typeof url === "string" && url !== "") out.push(url);
2204
2310
  }
2205
2311
  return out;
@@ -2253,7 +2359,7 @@ var MsgApi = class {
2253
2359
  "getMsgs"
2254
2360
  ]);
2255
2361
  this.channel = channel ?? null;
2256
- this.util = util !== null && util !== void 0 ? util : null;
2362
+ this.util = util ?? null;
2257
2363
  }
2258
2364
  /**
2259
2365
  * 生成 msgId 时间戳(单调递增)。
@@ -2482,10 +2588,11 @@ var MsgApi = class {
2482
2588
  downloadType,
2483
2589
  file_uuid: ""
2484
2590
  });
2485
- if (util !== null) {
2486
- const instance = typeof util.get === "function" ? util.get() : util;
2487
- const copy = instance["copyFile"];
2488
- if (typeof copy === "function") await copy.call(instance, path, relPath);
2591
+ if (util !== null && util !== void 0) {
2592
+ const instance = hasCallableProp(util, "get") ? util.get() : util;
2593
+ if (hasCallableProp(instance, "copyFile")) try {
2594
+ await instance.copyFile(path, relPath);
2595
+ } catch {}
2489
2596
  }
2490
2597
  return relPath;
2491
2598
  }
@@ -2630,7 +2737,8 @@ var MsgApi = class {
2630
2737
  throw kernelError(`queryFavEmojiByDesc 调用失败: ${errorMessage(e)}`, "UNKNOWN");
2631
2738
  }
2632
2739
  checkLooseResult("queryFavEmojiByDesc", raw);
2633
- const list = raw.emojiInfoList;
2740
+ if (!isRecord(raw)) return [];
2741
+ const list = raw["emojiInfoList"];
2634
2742
  if (!Array.isArray(list)) return [];
2635
2743
  return extractFavEmojiUrls(list);
2636
2744
  }
@@ -2836,16 +2944,16 @@ var RecentContactApi = class {
2836
2944
  };
2837
2945
  /** 从返回形状提取置顶会话(result 数组 / 顶层 contacts / 嵌套容器兼容,待校准)。 */
2838
2946
  function extractPinnedContacts(raw) {
2839
- const candidates = [raw.result, raw];
2840
- for (const container of [raw.result, raw]) {
2841
- if (container === null || typeof container !== "object") continue;
2842
- const rec = container;
2947
+ const resultField = getOwnProp(raw, "result");
2948
+ const candidates = [resultField, raw];
2949
+ for (const container of [resultField, raw]) {
2950
+ if (!isRecord(container)) continue;
2843
2951
  for (const key of [
2844
2952
  "contacts",
2845
2953
  "data",
2846
2954
  "result",
2847
2955
  "list"
2848
- ]) candidates.push(rec[key]);
2956
+ ]) candidates.push(container[key]);
2849
2957
  }
2850
2958
  for (const candidate of candidates) {
2851
2959
  if (!Array.isArray(candidate)) continue;
@@ -2853,10 +2961,13 @@ function extractPinnedContacts(raw) {
2853
2961
  }
2854
2962
  return [];
2855
2963
  }
2964
+ /** 会话项形状判定(peerUid + chatType 是 RecentContact 的必备标识)。 */
2965
+ function isRecentContact(val) {
2966
+ return isRecord(val) && typeof val["peerUid"] === "string" && typeof val["chatType"] === "number";
2967
+ }
2856
2968
  /** 单条会话 → 置顶项(置顶标记为真且场景可判定才产出)。 */
2857
2969
  function pinnedOf(item) {
2858
- if (item === null || typeof item !== "object") return [];
2859
- return pinnedContactOf(item);
2970
+ return isRecentContact(item) ? pinnedContactOf(item) : [];
2860
2971
  }
2861
2972
  /** 置顶判据(topFlag 实测字段名 + isTop 兼容形态)且 peerUid 可用才产出。 */
2862
2973
  function pinnedContactOf(contact) {
@@ -3215,9 +3326,19 @@ function parseHonorList(text, type) {
3215
3326
  }
3216
3327
  return out;
3217
3328
  }
3218
- /** 精华消息项形状判定(msg_content 数组是 EssenceMsgItem 的标识字段)。 */
3329
+ /** 可选字段:缺失放行,存在时类型必须正确。 */
3330
+ function isOptionalString(rec, key) {
3331
+ const v = rec[key];
3332
+ return v === void 0 || v === null || typeof v === "string";
3333
+ }
3334
+ /** 可选字段:缺失放行,存在时必须是有限 number。 */
3335
+ function isOptionalNumber(rec, key) {
3336
+ const v = rec[key];
3337
+ return v === void 0 || v === null || typeof v === "number" && Number.isFinite(v);
3338
+ }
3339
+ /** 精华消息项形状判定(msg_content 数组必备;其余字段存在时逐一校验类型)。 */
3219
3340
  function isEssenceMsgItem(val) {
3220
- return isRecord(val) && Array.isArray(val["msg_content"]);
3341
+ return isRecord(val) && Array.isArray(val["msg_content"]) && isOptionalString(val, "sender_uin") && isOptionalString(val, "sender_nick") && isOptionalString(val, "add_digest_uin") && isOptionalString(val, "add_digest_nick") && isOptionalNumber(val, "msg_seq") && isOptionalNumber(val, "msg_random") && isOptionalNumber(val, "add_digest_time");
3221
3342
  }
3222
3343
  /** msg_list → 精华消息数组(逐项守卫,非数组 / 残缺项丢弃)。 */
3223
3344
  function extractEssenceItems(list) {
@@ -3367,17 +3488,21 @@ var GroupBridge = class {
3367
3488
  }
3368
3489
  };
3369
3490
  // src/bridge/login-bridge.ts
3491
+ /** 运行时判定 loginService 是否具备监听注册方法面。 */
3492
+ function isBoundLoginService(val) {
3493
+ return hasCallableProp(val, "addKernelLoginListener");
3494
+ }
3370
3495
  /**
3371
3496
  * 登录事件桥:注册原生监听 → 回调 emit 到 channel。
3372
3497
  * 无全局单例(ADR-015 推论)——每进程一份。
3373
3498
  */
3374
3499
  var LoginBridge = class {
3375
- service;
3500
+ boundService;
3376
3501
  channel;
3377
3502
  listenerId = null;
3378
3503
  constructor(loginService, channel) {
3379
- if (loginService === null || loginService === void 0 || typeof loginService.addKernelLoginListener !== "function") throw kernelError("loginService 无效(缺 addKernelLoginListener)", "INVALID_STATE");
3380
- this.service = loginService;
3504
+ if (!isBoundLoginService(loginService)) throw kernelError("loginService 无效(缺 addKernelLoginListener)", "INVALID_STATE");
3505
+ this.boundService = loginService;
3381
3506
  this.channel = channel;
3382
3507
  }
3383
3508
  /** 注册原生监听(幂等)。 */
@@ -3387,12 +3512,12 @@ var LoginBridge = class {
3387
3512
  onLoginDisConnected: (...args) => this.channel.emit("Login/onLoginDisConnected", ...args),
3388
3513
  onLogoutSucceed: (...args) => this.channel.emit("Login/onLogoutSucceed", ...args)
3389
3514
  };
3390
- this.listenerId = this.service.addKernelLoginListener(listener);
3515
+ this.listenerId = this.boundService.addKernelLoginListener(listener);
3391
3516
  }
3392
3517
  /** 注销原生监听(幂等)。 */
3393
3518
  unregister() {
3394
3519
  if (this.listenerId === null) return;
3395
- this.service.removeKernelLoginListener(this.listenerId);
3520
+ this.boundService.removeKernelLoginListener?.(this.listenerId);
3396
3521
  this.listenerId = null;
3397
3522
  }
3398
3523
  /** 释放(等价 unregister,幂等)。 */
@@ -3589,9 +3714,10 @@ var NTEventChannel = class {
3589
3714
  * 每个 Service 只注册一次原生监听,缓存维护与协议翻译都订阅这里。
3590
3715
  */
3591
3716
  on(event, handler) {
3592
- this.emitter.addListener(event, handler);
3717
+ const erased = (...args) => Reflect.apply(handler, void 0, args);
3718
+ this.emitter.addListener(String(event), erased);
3593
3719
  return () => {
3594
- this.emitter.removeListener(event, handler);
3720
+ this.emitter.removeListener(String(event), erased);
3595
3721
  };
3596
3722
  }
3597
3723
  /**
@@ -3606,16 +3732,19 @@ var NTEventChannel = class {
3606
3732
  cleanup();
3607
3733
  resolve(args);
3608
3734
  };
3735
+ const erased = (...args) => {
3736
+ Reflect.apply(handler, void 0, args);
3737
+ };
3609
3738
  const timer = setTimeout(() => {
3610
3739
  cleanup();
3611
- reject(kernelError(`等待事件超时: ${event}`, "TIMEOUT"));
3740
+ reject(kernelError(`等待事件超时: ${String(event)}`, "TIMEOUT"));
3612
3741
  }, timeoutMs);
3613
3742
  timer.unref?.();
3614
3743
  const cleanup = () => {
3615
3744
  clearTimeout(timer);
3616
- this.emitter.removeListener(event, handler);
3745
+ this.emitter.removeListener(String(event), erased);
3617
3746
  };
3618
- this.emitter.addListener(event, handler);
3747
+ this.emitter.addListener(String(event), erased);
3619
3748
  });
3620
3749
  }
3621
3750
  /**
@@ -3636,14 +3765,14 @@ var NTEventChannel = class {
3636
3765
  }
3637
3766
  emit(event, ...args) {
3638
3767
  for (const anyHandler of this.anyHandlers) try {
3639
- const ret = anyHandler(event, ...args);
3768
+ const ret = anyHandler(String(event), ...args);
3640
3769
  this.catchAsyncListenerError(ret);
3641
3770
  } catch (err) {
3642
3771
  this.notifyError(err);
3643
3772
  }
3644
- const listeners = this.emitter.listeners(event);
3773
+ const listeners = this.emitter.listeners(String(event));
3645
3774
  for (const listener of listeners) try {
3646
- const ret = listener(...args);
3775
+ const ret = Reflect.apply(listener, void 0, args);
3647
3776
  this.catchAsyncListenerError(ret);
3648
3777
  } catch (err) {
3649
3778
  this.notifyError(err);
@@ -3654,7 +3783,7 @@ var NTEventChannel = class {
3654
3783
  * UnhandledRejection)——这里统一挂 catch 转发到 onError 兜底。
3655
3784
  */
3656
3785
  catchAsyncListenerError(ret) {
3657
- if (ret !== null && typeof ret === "object" && typeof ret.catch === "function") ret.catch((err) => {
3786
+ if (isPromiseLike(ret)) ret.catch((err) => {
3658
3787
  this.notifyError(err);
3659
3788
  });
3660
3789
  }
@@ -3683,14 +3812,97 @@ var NTEventChannel = class {
3683
3812
  }
3684
3813
  };
3685
3814
  // src/cache/buddy-cache.ts
3815
+ /** 可选展示字段:存在且类型正确才拷贝(未知值丢弃)。 */
3816
+ const MEMBER_STRING_KEYS = [
3817
+ "nick",
3818
+ "remark",
3819
+ "longNick",
3820
+ "avatarUrl",
3821
+ "topTime"
3822
+ ];
3823
+ const MEMBER_NUMBER_KEYS = [
3824
+ "categoryId",
3825
+ "birthday_year",
3826
+ "birthday_month",
3827
+ "birthday_day",
3828
+ "sex"
3829
+ ];
3830
+ /** 拷贝成员可选字段(类型正确才写入)。 */
3831
+ function copyMemberExtras(entry, raw) {
3832
+ for (const key of MEMBER_STRING_KEYS) {
3833
+ const value = raw[key];
3834
+ if (typeof value === "string") entry[key] = value;
3835
+ }
3836
+ for (const key of MEMBER_NUMBER_KEYS) {
3837
+ const value = raw[key];
3838
+ if (typeof value === "number") entry[key] = value;
3839
+ }
3840
+ const isBlocked = raw["isBlocked"];
3841
+ if (typeof isBlocked === "boolean") entry["isBlocked"] = isBlocked;
3842
+ }
3843
+ /** coreInfo 安全构造(uid/uin 必备)。 */
3844
+ function parseCoreInfo(raw) {
3845
+ if (!isRecord(raw) || typeof raw["uid"] !== "string" || typeof raw["uin"] !== "string") return null;
3846
+ const out = {
3847
+ uid: raw["uid"],
3848
+ uin: raw["uin"]
3849
+ };
3850
+ const nick = raw["nick"];
3851
+ const remark = raw["remark"];
3852
+ return {
3853
+ ...out,
3854
+ ...typeof nick === "string" ? { nick } : {},
3855
+ ...typeof remark === "string" ? { remark } : {}
3856
+ };
3857
+ }
3858
+ /**
3859
+ * 解析单个好友明细(T10 实测形状:uid/uin 齐备;其余展示字段按类型安全拷贝)。
3860
+ * 返回真实构造的新对象——不把原生载荷直接断言成 `BuddyListEntry`。
3861
+ */
3862
+ function parseBuddyMember(raw) {
3863
+ if (!isRecord(raw) || typeof raw["uid"] !== "string" || typeof raw["uin"] !== "string") return null;
3864
+ const entry = {
3865
+ uid: raw["uid"],
3866
+ uin: raw["uin"]
3867
+ };
3868
+ copyMemberExtras(entry, raw);
3869
+ const coreInfo = parseCoreInfo(raw["coreInfo"]);
3870
+ if (coreInfo !== null) entry.coreInfo = coreInfo;
3871
+ if (isRecord(raw["baseInfo"])) entry.baseInfo = raw["baseInfo"];
3872
+ return entry;
3873
+ }
3874
+ /** 单个分类项 → BuddyCategory(非对象返回 null)。 */
3875
+ function parseBuddyCategory(item) {
3876
+ if (!isRecord(item)) return null;
3877
+ const buddyListRaw = Array.isArray(item["buddyList"]) ? item["buddyList"] : [];
3878
+ const buddyList = [];
3879
+ for (const b of buddyListRaw) {
3880
+ const parsed = parseBuddyMember(b);
3881
+ if (parsed !== null) buddyList.push(parsed);
3882
+ }
3883
+ return {
3884
+ categoryId: typeof item["categoryId"] === "number" ? item["categoryId"] : 0,
3885
+ categorySortId: typeof item["categorySortId"] === "number" ? item["categorySortId"] : 0,
3886
+ categroyName: typeof item["categroyName"] === "string" ? item["categroyName"] : "",
3887
+ categroyMbCount: typeof item["categroyMbCount"] === "number" ? item["categroyMbCount"] : buddyList.length,
3888
+ onlineCount: typeof item["onlineCount"] === "number" ? item["onlineCount"] : 0,
3889
+ buddyList
3890
+ };
3891
+ }
3686
3892
  /**
3687
3893
  * 防御性收窄 onBuddyListChange 载荷 → BuddyCategory[](T10 实证形状;
3688
- * 非数组返回 null,调用方打 raw 日志积累校准数据)。
3894
+ * 非数组 / 非对象分类项返回 null,调用方打 raw 日志积累校准数据)。
3895
+ * 分类字段逐项做运行时类型校验并安全构造,缺失项取保守默认值。
3689
3896
  */
3690
3897
  function narrowBuddyCategories(arg) {
3691
3898
  if (!Array.isArray(arg)) return null;
3692
- for (const item of arg) if (item === null || typeof item !== "object") return null;
3693
- return arg;
3899
+ const categories = [];
3900
+ for (const item of arg) {
3901
+ const category = parseBuddyCategory(item);
3902
+ if (category === null) return null;
3903
+ categories.push(category);
3904
+ }
3905
+ return categories;
3694
3906
  }
3695
3907
  /** 从快照分类拍平好友明细(buddyList 缺失的分类跳过)。 */
3696
3908
  function flattenEntries(categories) {
@@ -4374,6 +4586,17 @@ function startupSessionStart(ctx) {
4374
4586
  *
4375
4587
  * 不含 UI 渲染(cli 只做二维码渲染/URL 打印)。
4376
4588
  */
4589
+ /** 运行时判定 loginService 是否具备 QrLoginSession 依赖的方法面。 */
4590
+ function isLoginServiceLike(val) {
4591
+ return hasMethodSurface(val, [
4592
+ "addKernelLoginListener",
4593
+ "removeKernelLoginListener",
4594
+ "connect",
4595
+ "getLoginList",
4596
+ "quickLoginWithUin",
4597
+ "getQRCodePicture"
4598
+ ]);
4599
+ }
4377
4600
  /** 二维码过期错误码(errType=1 errCode=3,实测)。 */
4378
4601
  const QR_EXPIRED_ERR_TYPE = 1;
4379
4602
  const QR_EXPIRED_ERR_CODE = 3;
@@ -4400,9 +4623,8 @@ var QrLoginSession = class {
4400
4623
  /** 超时上限(毫秒,默认 QR_LOGIN_TIMEOUT_MS)。 */
4401
4624
  timeoutMs;
4402
4625
  constructor(loginService, options = {}) {
4403
- const svc = loginService;
4404
- if (svc === null || typeof svc.addKernelLoginListener !== "function") throw kernelError("loginService 无效(缺 addKernelLoginListener)", "INVALID_STATE");
4405
- this.loginService = svc;
4626
+ if (!isLoginServiceLike(loginService)) throw kernelError("loginService 无效(缺 addKernelLoginListener)", "INVALID_STATE");
4627
+ this.loginService = loginService;
4406
4628
  this.timeoutMs = options.timeoutMs ?? 12e4;
4407
4629
  }
4408
4630
  /** 当前状态。 */
@@ -4435,7 +4657,7 @@ var QrLoginSession = class {
4435
4657
  if (opts.quickUin !== void 0 && opts.quickUin !== "") {
4436
4658
  this.restartTimeout();
4437
4659
  this.loginService.quickLoginWithUin(opts.quickUin).then((result) => {
4438
- if (result.loginErrorInfo.errMsg !== "") this.refreshAfterQuickLogin();
4660
+ if (extractLoginErrMsg(result) !== "") this.refreshAfterQuickLogin();
4439
4661
  }).catch(() => {
4440
4662
  this.refreshAfterQuickLogin();
4441
4663
  });
@@ -4639,7 +4861,7 @@ function createKernelRuntime(opts) {
4639
4861
  /** wrapper exports → util(支持直接传 exports 或 NodeQQNTWrapperUtil 本身)。 */
4640
4862
  function wrapperUtilOf(wrapperExports) {
4641
4863
  if (wrapperExports === void 0) return;
4642
- return wrapperExports["NodeQQNTWrapperUtil"] ?? wrapperExports;
4864
+ return getOwnProp(wrapperExports, "NodeQQNTWrapperUtil") ?? wrapperExports;
4643
4865
  }
4644
4866
  /** RecentContact 桥:老版本 wrapper 无 getRecentContactService 时跳过。 */
4645
4867
  function createRecentContactBridge(session, channel) {
@@ -4982,13 +5204,37 @@ function buildSessionConfig(options) {
4982
5204
  */
4983
5205
  function readMachineGuid(loginService) {
4984
5206
  try {
4985
- const fn = loginService?.["getMachineGuid"];
4986
- if (typeof fn !== "function") return "";
4987
- const value = fn.call(loginService);
4988
- return typeof value === "string" ? value : "";
5207
+ if (hasCallableProp(loginService, "getMachineGuid")) {
5208
+ const value = loginService.getMachineGuid();
5209
+ if (typeof value === "string" && value.length > 0) return value;
5210
+ }
4989
5211
  } catch {
4990
5212
  return "";
4991
5213
  }
5214
+ return "";
5215
+ }
5216
+ // src/wrapper/wrapper-guards.ts
5217
+ /** wrapper.node 顶层导出至少含一个已知符号(dlopen 后立即校验,细节由下游守卫补足)。 */
5218
+ function isWrapperNodeApi(val) {
5219
+ if (!isRecord(val)) return false;
5220
+ return "NodeIQQNTWrapperSession" in val || "NodeIQQNTWrapperEngine" in val || "NodeIKernelLoginService" in val || "NodeQQNTWrapperUtil" in val;
5221
+ }
5222
+ /** engine 实例最小可用面:`initWithDeskTopConfig`(`readyToShow` 为可选增强)。 */
5223
+ function isWrapperEngine(val) {
5224
+ return hasMethodSurface(val, ["initWithDeskTopConfig"]);
5225
+ }
5226
+ /** StartupSessionWrapper 实例可用面:`start()`。 */
5227
+ function isStartupSessionWrapper(val) {
5228
+ return hasCallableProp(val, "start");
5229
+ }
5230
+ /** session 实例最小可用面:`getMsgService()`(service 挂载即 session 可用)。 */
5231
+ function isWrapperSession(val) {
5232
+ return hasCallableProp(val, "getMsgService");
5233
+ }
5234
+ /** Electron 进程类型(Node 的 process 类型无此字段;"browser" / "utility"。 */
5235
+ function getElectronProcessType(proc) {
5236
+ const t = getOwnProp(proc, "type");
5237
+ return typeof t === "string" ? t : void 0;
4992
5238
  }
4993
5239
  // src/wrapper/wrapper-loader.ts
4994
5240
  /**
@@ -5038,7 +5284,7 @@ function defaultEngineConfig(env, qqDataPath) {
5038
5284
  * - "utility":utilityProcess Worker(路线 B,2026-08-06)
5039
5285
  */
5040
5286
  function electronProcessType() {
5041
- return process.type;
5287
+ return getElectronProcessType(process);
5042
5288
  }
5043
5289
  /**
5044
5290
  * 解析 QQ 用户数据根(登录数据目录,如 `C:\Users\<user>\Documents\Tencent Files`)。
@@ -5064,8 +5310,14 @@ function resolveQqUserDataRoot(exports, opts = {}) {
5064
5310
  /** 从 QQ 官方 API 提取数据根(不可用返回 null,调用方回退默认)。 */
5065
5311
  function extractUserDataRoot(exports) {
5066
5312
  try {
5067
- const raw = exports.NodeQQNTWrapperUtil?.get?.().getNTUserDataInfoConfig?.();
5068
- if (typeof raw === "string" && raw.trim() !== "") return extractDataRoot(raw.trim());
5313
+ const utilCtor = exports.NodeQQNTWrapperUtil;
5314
+ if (hasCallableProp(utilCtor, "get")) {
5315
+ const inst = utilCtor.get();
5316
+ if (hasCallableProp(inst, "getNTUserDataInfoConfig")) {
5317
+ const raw = inst.getNTUserDataInfoConfig();
5318
+ if (typeof raw === "string" && raw.trim() !== "") return extractDataRoot(raw.trim());
5319
+ }
5320
+ }
5069
5321
  } catch {}
5070
5322
  return null;
5071
5323
  }
@@ -5074,13 +5326,13 @@ function extractUserDataRoot(exports) {
5074
5326
  * 在 QQ 主进程内调用(boot.cjs → kernel 入口)。
5075
5327
  */
5076
5328
  function createWrapper(exports, versionInfo) {
5077
- const engineMaybe = exports.NodeIQQNTWrapperEngine;
5078
- if (engineMaybe === null || typeof engineMaybe.get !== "function") throw kernelError("wrapper.node exports 无效(缺少 NodeIQQNTWrapperEngine)", "INVALID_PARAM");
5079
- const engine = engineMaybe.get();
5080
- if (!engine || typeof engine.initWithDeskTopConfig !== "function") throw kernelError("NodeIQQNTWrapperEngine.get() 返回对象无效", "INVALID_PARAM");
5329
+ const engineCtor = exports.NodeIQQNTWrapperEngine;
5330
+ if (!hasCallableProp(engineCtor, "get")) throw kernelError("wrapper.node exports 无效(缺少 NodeIQQNTWrapperEngine)", "INVALID_PARAM");
5331
+ const rawEngine = engineCtor.get();
5332
+ if (!isWrapperEngine(rawEngine)) throw kernelError("NodeIQQNTWrapperEngine.get() 返回对象无效", "INVALID_PARAM");
5081
5333
  return {
5082
5334
  exports,
5083
- engine,
5335
+ engine: rawEngine,
5084
5336
  versionInfo,
5085
5337
  session: null,
5086
5338
  startupSession: null,
@@ -5104,40 +5356,57 @@ function initEngine(ctx, config) {
5104
5356
  */
5105
5357
  function createSession(ctx) {
5106
5358
  const S = ctx.exports.NodeIQQNTWrapperSession;
5107
- const session = createStartupSession(ctx) ?? getNTWrapperSession(S) ?? createNewSession(S) ?? new S();
5359
+ const session = createStartupSession(ctx) ?? getNTWrapperSession(S) ?? createNewSession(S) ?? newSession(S);
5108
5360
  ctx.session = session;
5109
5361
  return session;
5110
5362
  }
5363
+ /**
5364
+ * 步骤 4:`new S()`(最后兜底)。
5365
+ *
5366
+ * isWrapperNodeApi 只保证「至少一个已知导出键存在」;Session 构造器可能缺失或
5367
+ * 被版本漂移换成非函数值(stub 半成品)。`new undefined()` 会抛裸 TypeError,
5368
+ * 这里换成 KernelError,且只在真正要 `new` 时才拒绝(静态方法可用的导出仍容忍)。
5369
+ */
5370
+ function newSession(S) {
5371
+ if (typeof S !== "function") throw kernelError("wrapper.node 导出缺少可调用的 NodeIQQNTWrapperSession 构造器", "INVALID_PARAM");
5372
+ return new S();
5373
+ }
5111
5374
  /** 步骤 1:StartupSessionWrapper.create()(建立启动 session,失败忽略)。 */
5112
5375
  function createStartupSession(ctx) {
5113
- const Ssw = ctx.exports.NodeIQQNTStartupSessionWrapper;
5114
- if (Ssw === void 0 || typeof Ssw.create !== "function") return null;
5376
+ const sswCtor = ctx.exports.NodeIQQNTStartupSessionWrapper;
5377
+ if (!hasCallableProp(sswCtor, "create")) return null;
5115
5378
  try {
5116
- ctx.startupSession = Ssw.create();
5379
+ const inst = sswCtor.create();
5380
+ if (isStartupSessionWrapper(inst)) ctx.startupSession = inst;
5117
5381
  } catch {}
5118
5382
  return null;
5119
5383
  }
5120
5384
  /** 步骤 2:getNTWrapperSession("nt_1")(QQ 主 session,带 cpp_impl)。 */
5121
5385
  function getNTWrapperSession(S) {
5122
- if (typeof S.getNTWrapperSession !== "function") return null;
5386
+ if (!hasCallableProp(S, "getNTWrapperSession")) return null;
5123
5387
  try {
5124
- return S.getNTWrapperSession("nt_1");
5388
+ const got = S.getNTWrapperSession("nt_1");
5389
+ return isWrapperSession(got) ? got : null;
5125
5390
  } catch {
5126
5391
  return null;
5127
5392
  }
5128
5393
  }
5129
- /** 步骤 3:S.create() 回退。 */
5394
+ /** 步骤 3:S.create() 回退(返回值同样过 session 方法面守卫,拒绝空壳对象)。 */
5130
5395
  function createNewSession(S) {
5131
- if (typeof S.create !== "function") return null;
5396
+ const create = getOwnProp(S, "create");
5397
+ if (typeof create !== "function") return null;
5132
5398
  try {
5133
- return S.create();
5399
+ const created = Reflect.apply(create, S, []);
5400
+ return isWrapperSession(created) ? created : null;
5134
5401
  } catch {
5135
5402
  return null;
5136
5403
  }
5137
5404
  }
5138
5405
  /** session 初始化(4 参全为 JS 对象,NAPI 自动转换)。 */
5139
5406
  function initSession(ctx, config, listener) {
5140
- (ctx.session ?? createSession(ctx)).init(config, new DependsAdapter(), new DispatcherAdapter(), listener);
5407
+ const session = ctx.session ?? createSession(ctx);
5408
+ if (typeof getOwnProp(session, "init") !== "function") throw kernelError("session 实例缺少 init 方法(wrapper 版本不匹配或空壳 Session)", "INVALID_STATE");
5409
+ session.init(config, new DependsAdapter(), new DispatcherAdapter(), listener);
5141
5410
  }
5142
5411
  /**
5143
5412
  * 启动会话(有 startupSession 用 start(),否则 startNT(0))。
@@ -5238,7 +5507,7 @@ function resolveLoginService(ctx, qqLoginService) {
5238
5507
  function getOrCreateLoginService(exports) {
5239
5508
  try {
5240
5509
  const loginSvcCtor = exports.NodeIKernelLoginService;
5241
- if (loginSvcCtor !== null && typeof loginSvcCtor.get === "function") return loginSvcCtor.get();
5510
+ if (hasCallableProp(loginSvcCtor, "get")) return loginSvcCtor.get();
5242
5511
  return new exports.NodeIKernelLoginService();
5243
5512
  } catch {
5244
5513
  return null;
@@ -5256,7 +5525,8 @@ function getOrCreateLoginService(exports) {
5256
5525
  function dlopenWrapper(wrapperPath) {
5257
5526
  const m = { exports: {} };
5258
5527
  process.dlopen(m, wrapperPath);
5259
- if (!Object.keys(m.exports ?? {}).includes("NodeIKernelLoginService")) throw kernelError("exports 无 NodeIKernelLoginService(stub 环境异常?)", "INVALID_STATE");
5528
+ if (!Object.keys(m.exports).includes("NodeIKernelLoginService")) throw kernelError("exports 无 NodeIKernelLoginService(stub 环境异常?)", "INVALID_STATE");
5529
+ if (!isWrapperNodeApi(m.exports)) throw kernelError(`wrapper.node at ${wrapperPath} did not export expected QQNT symbols`, "INVALID_STATE");
5260
5530
  return m.exports;
5261
5531
  }
5262
5532
  /** 已激活 O3MiscService 的 exports(幂等标记,避免重复挂监听)。 */
@@ -5274,13 +5544,13 @@ const ACTIVATED_O3_EXPORTS = /* @__PURE__ */ new WeakSet();
5274
5544
  function activateO3MiscService(wrapperExports) {
5275
5545
  if (wrapperExports === void 0 || wrapperExports === null) return false;
5276
5546
  if (ACTIVATED_O3_EXPORTS.has(wrapperExports)) return true;
5277
- const O3 = wrapperExports["NodeIO3MiscService"];
5278
- if (O3 && typeof O3.get === "function") {
5279
- O3.get().addO3MiscListener({ getOnAmgomDataPiece() {} });
5280
- ACTIVATED_O3_EXPORTS.add(wrapperExports);
5281
- return true;
5282
- }
5283
- return false;
5547
+ const o3Ctor = wrapperExports["NodeIO3MiscService"];
5548
+ if (!hasCallableProp(o3Ctor, "get")) return false;
5549
+ const svc = o3Ctor.get();
5550
+ if (!hasCallableProp(svc, "addO3MiscListener")) return false;
5551
+ svc.addO3MiscListener({ getOnAmgomDataPiece() {} });
5552
+ ACTIVATED_O3_EXPORTS.add(wrapperExports);
5553
+ return true;
5284
5554
  }
5285
5555
  // src/core.ts
5286
5556
  /**
@@ -5665,13 +5935,13 @@ function firstStringId(ids, pred) {
5665
5935
  }
5666
5936
  /** 通过 getNTWrapperSession 拿主 session(内部辅助)。 */
5667
5937
  function resolveMainSession(created, getNTWrapperSession) {
5668
- created.start?.();
5669
- const ids = typeof created.getSessionIdList === "function" ? created.getSessionIdList() : null;
5938
+ if (hasCallableProp(created, "start")) created.start();
5939
+ const ids = hasCallableProp(created, "getSessionIdList") ? created.getSessionIdList() : null;
5670
5940
  if (!(ids instanceof Map)) return null;
5671
5941
  const mainId = findMainSessionId(ids);
5672
5942
  if (mainId === null) return null;
5673
5943
  const maybe = getNTWrapperSession(mainId);
5674
- return maybe !== null && maybe !== void 0 && typeof maybe.getMsgService === "function" ? maybe : null;
5944
+ return isWrapperSession(maybe) ? maybe : null;
5675
5945
  }
5676
5946
  /**
5677
5947
  * 复用 QQ 已有 session(P1-4:QQ 已登录,直接拿单例避免重复 init)。
@@ -5690,10 +5960,10 @@ function getExistingSession(ctx) {
5690
5960
  /** NodeIQQNTWrapperSession.get() 单例(无效/异常返回 null)。 */
5691
5961
  function trySessionGet(ctx) {
5692
5962
  try {
5693
- const S = ctx.exports.NodeIQQNTWrapperSession;
5694
- if (typeof S.get !== "function") return null;
5695
- const got = S.get();
5696
- return got && typeof got.getMsgService === "function" ? got : null;
5963
+ const sessionCtor = ctx.exports.NodeIQQNTWrapperSession;
5964
+ if (!hasCallableProp(sessionCtor, "get")) return null;
5965
+ const got = sessionCtor.get();
5966
+ return isWrapperSession(got) ? got : null;
5697
5967
  } catch {
5698
5968
  return null;
5699
5969
  }
@@ -5708,20 +5978,19 @@ function trySessionGet(ctx) {
5708
5978
  */
5709
5979
  function getMainSession(ctx) {
5710
5980
  try {
5711
- return resolveMainFromStartup(ctx) ?? null;
5981
+ return resolveMainFromStartup(ctx);
5712
5982
  } catch {
5713
5983
  return null;
5714
5984
  }
5715
5985
  }
5716
5986
  /** startup.create → start → getSessionIdList → getNTWrapperSession 链路。 */
5717
5987
  function resolveMainFromStartup(ctx) {
5718
- const startupRaw = ctx.exports.NodeIQQNTStartupSessionWrapper;
5988
+ const startupCtor = ctx.exports.NodeIQQNTStartupSessionWrapper;
5719
5989
  const sessionCtor = ctx.exports.NodeIQQNTWrapperSession;
5720
- if (typeof startupRaw.create !== "function" || typeof sessionCtor.getNTWrapperSession !== "function") return null;
5721
- const created = startupRaw.create();
5722
- if (!created) return null;
5723
- const getSession = (id) => sessionCtor.getNTWrapperSession(id);
5724
- return resolveMainSession(created, getSession);
5990
+ if (!hasCallableProp(startupCtor, "create") || !hasCallableProp(sessionCtor, "getNTWrapperSession")) return null;
5991
+ const created = startupCtor.create();
5992
+ if (created === null || created === void 0) return null;
5993
+ return resolveMainSession(created, (id) => sessionCtor.getNTWrapperSession(id));
5725
5994
  }
5726
5995
  // src/wrapper/probe/probe-serialize.ts
5727
5996
  /**
@@ -5762,12 +6031,13 @@ function serialize(value, depth = 0) {
5762
6031
  function serializeContainer(value, depth) {
5763
6032
  if (ArrayBuffer.isView(value)) return serializeBytes(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
5764
6033
  if (Array.isArray(value)) {
5765
- if (value.length >= BYTES_ARRAY_MIN && looksLikeBytes(value)) return serializeBytes(Uint8Array.from(value, (b) => b & 255));
6034
+ if (value.length >= BYTES_ARRAY_MIN && looksLikeBytes(value)) return serializeBytes(Uint8Array.from(value, (b) => typeof b === "number" ? b & 255 : 0));
5766
6035
  return serializeArray(value, depth);
5767
6036
  }
5768
6037
  if (value instanceof Map) return serializeMap(value, depth);
5769
6038
  if (value instanceof Set) return serializeSet(value, depth);
5770
- if (typeof value.then === "function") return "[Promise]";
6039
+ if (hasCallableProp(value, "then")) return "[Promise]";
6040
+ if (!isRecord(value)) return String(value);
5771
6041
  return serializeObject(value, depth);
5772
6042
  }
5773
6043
  /** 普通数组是否字节形态(全部元素为整数且落 [-128, 255]——原生把字节块转成带符号字节数组)。 */
@@ -5821,8 +6091,8 @@ function serializeObject(value, depth) {
5821
6091
  /** 尝试解析一个 service getter 的返回值形状(深度受限)。 */
5822
6092
  function tryShape(session, getter) {
5823
6093
  try {
5824
- const fn = session[getter];
5825
- if (typeof fn !== "function") return null;
6094
+ const fn = getOwnProp(session, getter);
6095
+ if (!isCallable(fn)) return null;
5826
6096
  const value = fn.call(session);
5827
6097
  if (value === null || value === void 0) return null;
5828
6098
  return serialize(value);
@@ -5864,8 +6134,8 @@ function collectOwnNames(obj, names) {
5864
6134
  /** 安全调用:尝试调用方法拿返回值,失败记录错误(不中断探测)。 */
5865
6135
  function tryCall(obj, name) {
5866
6136
  try {
5867
- const fn = obj[name];
5868
- if (typeof fn !== "function") return {
6137
+ const fn = getOwnProp(obj, name);
6138
+ if (!isCallable(fn)) return {
5869
6139
  ok: false,
5870
6140
  error: `not a function (typeof=${typeof fn})`
5871
6141
  };
@@ -5887,6 +6157,13 @@ function isServiceGetter(name) {
5887
6157
  return name.startsWith("get") && name.endsWith("Service");
5888
6158
  }
5889
6159
  // src/wrapper/probe/probe-services.ts
6160
+ /**
6161
+ * wrapper exports 探测(从 probe.ts 拆分,2026-08-08 FTA 优化)
6162
+ *
6163
+ * - probeExportCtors:关键 export 构造器方法面
6164
+ * - probeEngineCalls:engine 关键调用
6165
+ * - probeLoginService:LoginService 实例(QQ 已登录凭据入口)
6166
+ */
5890
6167
  /** 探测关键 export 构造器方法(get/create/getNTWrapperSession 等)。 */
5891
6168
  function probeExportCtors(ctx) {
5892
6169
  const keys = [
@@ -5898,7 +6175,7 @@ function probeExportCtors(ctx) {
5898
6175
  ];
5899
6176
  const out = {};
5900
6177
  for (const key of keys) {
5901
- const ctor = ctx.exports[key];
6178
+ const ctor = getOwnProp(ctx.exports, key);
5902
6179
  if (ctor !== null && ctor !== void 0) out[key] = {
5903
6180
  methods: listMethods(ctor),
5904
6181
  ownKeys: Object.getOwnPropertyNames(ctor)
@@ -5930,7 +6207,7 @@ const ENGINE_CALL_PROBES = [
5930
6207
  /** 探测 LoginService 实例(QQ 已登录凭据入口)。 */
5931
6208
  function probeLoginService(ctx) {
5932
6209
  const ctor = ctx.exports.NodeIKernelLoginService;
5933
- if (ctor === null || typeof ctor.get !== "function") return null;
6210
+ if (!hasCallableProp(ctor, "get")) return null;
5934
6211
  const inst = tryCall(ctor, "get");
5935
6212
  if (!(inst.ok && inst.value)) return { get: inst.error ?? "null/undefined" };
5936
6213
  return {
@@ -5942,7 +6219,7 @@ function probeLoginService(ctx) {
5942
6219
  /** 尝试关键登录信息 getter(无参调用,探测形状)。 */
5943
6220
  function probeLoginGetters(inst) {
5944
6221
  const out = {};
5945
- for (const m of LOGIN_GETTER_PROBES) if (typeof inst[m] === "function") out[m] = tryShape(inst, m);
6222
+ for (const m of LOGIN_GETTER_PROBES) if (hasCallableProp(inst, m)) out[m] = tryShape(inst, m);
5946
6223
  return out;
5947
6224
  }
5948
6225
  /** 登录信息 getter 候选(无参调用,探测形状)。 */
@@ -5992,10 +6269,9 @@ function probeSessionId(enumFn, thisCtx, id, out) {
5992
6269
  }
5993
6270
  /** 探测单个 session 记录(getter 存在性 + msgService 调用结果 + 方法面)。 */
5994
6271
  function probeSessionRecord(value) {
5995
- const rec = value;
5996
- const msg = tryMsgService(rec, value);
6272
+ const msg = tryMsgService(value);
5997
6273
  return {
5998
- hasMsgServiceGetter: typeof rec["getMsgService"] === "function",
6274
+ hasMsgServiceGetter: hasCallableProp(value, "getMsgService"),
5999
6275
  msgServiceOk: msg.service !== null,
6000
6276
  msgServiceMethods: msg.service ? listMethods(msg.service).length : 0,
6001
6277
  msgError: msg.error,
@@ -6003,10 +6279,14 @@ function probeSessionRecord(value) {
6003
6279
  };
6004
6280
  }
6005
6281
  /** 尝试调用 getMsgService(失败记录错误,成功返回实例)。 */
6006
- function tryMsgService(rec, thisCtx) {
6282
+ function tryMsgService(thisCtx) {
6007
6283
  try {
6284
+ if (!hasCallableProp(thisCtx, "getMsgService")) return {
6285
+ service: null,
6286
+ error: "missing getMsgService"
6287
+ };
6008
6288
  return {
6009
- service: rec["getMsgService"].call(thisCtx) ?? null,
6289
+ service: thisCtx.getMsgService.call(thisCtx) ?? null,
6010
6290
  error: null
6011
6291
  };
6012
6292
  } catch (e) {
@@ -6018,8 +6298,9 @@ function tryMsgService(rec, thisCtx) {
6018
6298
  }
6019
6299
  /** 取 NodeIQQNTWrapperSession.getNTWrapperSession 函数(无则 null)。 */
6020
6300
  function getNTWrapperSessionFn(ctx) {
6021
- const fn = ctx.exports.NodeIQQNTWrapperSession["getNTWrapperSession"];
6022
- return typeof fn === "function" ? fn : null;
6301
+ const ctor = ctx.exports.NodeIQQNTWrapperSession;
6302
+ if (hasCallableProp(ctor, "getNTWrapperSession")) return ctor.getNTWrapperSession;
6303
+ return null;
6023
6304
  }
6024
6305
  /** 探测 startup 实例:start() + getSessionIdList(),提取 sessionIds(Map 值或键)。 */
6025
6306
  function probeStartupChain(created) {
@@ -6081,7 +6362,7 @@ function probeSessionByName(ctx, name) {
6081
6362
  /** StartupSessionWrapper 可用性判定(缺 create 方法视为不可用)。 */
6082
6363
  function startupWrapper(ctx) {
6083
6364
  const startup = ctx.exports.NodeIQQNTStartupSessionWrapper;
6084
- return startup === null || typeof startup.create !== "function" ? null : startup;
6365
+ return hasCallableProp(startup, "create") ? startup : null;
6085
6366
  }
6086
6367
  /** create() 调用结果面(成功记实例方法面 + 序列化值,失败记 error)。 */
6087
6368
  function createFace(created) {
@@ -6339,7 +6620,7 @@ function startListenerRecording(ctx, file = "napuketto-listener-record.jsonl") {
6339
6620
  };
6340
6621
  const registered = {};
6341
6622
  const session = ctx.session;
6342
- if (session !== null && session !== void 0) for (const getter of INSTRUMENTED_SERVICE_GETTERS) registered[serviceShortName(getter)] = recordService(session, getter, emit);
6623
+ if (isRecord(session)) for (const getter of INSTRUMENTED_SERVICE_GETTERS) registered[serviceShortName(getter)] = recordService(session, getter, emit);
6343
6624
  registered["Login"] = recordLoginService(ctx, emit);
6344
6625
  return {
6345
6626
  file: full,
@@ -6350,12 +6631,12 @@ function startListenerRecording(ctx, file = "napuketto-listener-record.jsonl") {
6350
6631
  function recordService(session, getter, emit) {
6351
6632
  const name = serviceShortName(getter);
6352
6633
  try {
6353
- const fn = session[getter];
6354
- if (typeof fn !== "function") return {
6634
+ const getterFn = session[getter];
6635
+ if (!isCallable(getterFn)) return {
6355
6636
  ok: false,
6356
- error: `getter 缺失(typeof=${typeof fn})`
6637
+ error: `getter 缺失(typeof=${typeof getterFn})`
6357
6638
  };
6358
- const service = fn.call(session);
6639
+ const service = getterFn.call(session);
6359
6640
  if (service === null || service === void 0) return {
6360
6641
  ok: false,
6361
6642
  error: "null/undefined"
@@ -6370,9 +6651,9 @@ function recordService(session, getter, emit) {
6370
6651
  }
6371
6652
  /** LoginService 单例录制(NodeIKernelLoginService.get(),bot_offline 候选源)。 */
6372
6653
  function recordLoginService(ctx, emit) {
6373
- const ctor = ctx.exports["NodeIKernelLoginService"];
6654
+ const ctor = getOwnProp(ctx.exports, "NodeIKernelLoginService");
6374
6655
  try {
6375
- if (ctor === null || ctor === void 0 || typeof ctor.get !== "function") return {
6656
+ if (!hasCallableProp(ctor, "get")) return {
6376
6657
  ok: false,
6377
6658
  error: "NodeIKernelLoginService.get 缺失"
6378
6659
  };
@@ -6396,13 +6677,14 @@ function attachRecordingListener(name, service, emit) {
6396
6677
  ok: false,
6397
6678
  error: "无 add*Listener 方法"
6398
6679
  };
6399
- const add = service[addMethod];
6400
- if (typeof add !== "function") return {
6680
+ const add = getOwnProp(service, addMethod);
6681
+ if (!isCallable(add)) return {
6401
6682
  ok: false,
6402
6683
  error: `${addMethod} 非函数`
6403
6684
  };
6404
6685
  const listener = createRecordingListener(name, emit);
6405
- const listenerId = add.call(service, listener);
6686
+ const rawId = add.call(service, listener);
6687
+ const listenerId = typeof rawId === "number" ? rawId : void 0;
6406
6688
  emit({
6407
6689
  ts: (/* @__PURE__ */ new Date()).toISOString(),
6408
6690
  service: name,
@@ -6434,16 +6716,18 @@ function attachRecordingListener(name, service, emit) {
6434
6716
  function readVersionPackage(installDir, version) {
6435
6717
  const pkgPath = join(installDir, "versions", version, "resources", "app", "package.json");
6436
6718
  if (!existsSync(pkgPath)) throw kernelError(`QQ 版本目录缺少 package.json: ${pkgPath}`, "NOT_FOUND");
6719
+ let raw;
6437
6720
  try {
6438
- const raw = JSON.parse(readFileSync(pkgPath, "utf8"));
6439
- return {
6440
- name: raw.name ?? "",
6441
- version: raw.version ?? "",
6442
- ...raw.buildVersion !== void 0 ? { buildVersion: raw.buildVersion } : {}
6443
- };
6721
+ raw = JSON.parse(readFileSync(pkgPath, "utf8"));
6444
6722
  } catch (cause) {
6445
6723
  throw kernelError(`QQ 版本 package.json 解析失败: ${pkgPath}`, "INVALID_PARAM", { cause });
6446
6724
  }
6725
+ if (!isRecord(raw) || typeof raw["version"] !== "string" || raw["version"].length === 0) throw kernelError(`QQ 版本 package.json 缺少有效 version: ${pkgPath}`, "INVALID_PARAM");
6726
+ return {
6727
+ name: typeof raw["name"] === "string" ? raw["name"] : "",
6728
+ version: raw["version"],
6729
+ ...typeof raw["buildVersion"] === "string" ? { buildVersion: raw["buildVersion"] } : {}
6730
+ };
6447
6731
  }
6448
6732
  /** 解析 wrapper.node 绝对路径(按 ADR-018 目录约定)。 */
6449
6733
  function resolveWrapperPath(installDir, version) {
@@ -6474,6 +6758,6 @@ function listQQVersions(installDir) {
6474
6758
  return statSync(full).isDirectory() && existsSync(join(full, "resources", "app", "wrapper.node"));
6475
6759
  }).sort().reverse();
6476
6760
  }
6477
- export { BuddyCache, ChatType, ConfigBase, ConfigError, DEFAULT_DATA_ROOT_NAME, DependsAdapter, DispatcherAdapter, EXIT_CONFIG_INVALID, ElementType, 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, dlopenWrapper, electronProcessType, errorMessage, getExistingSession, getMainSession, hasBooleanProp, hasFunctionProp, hasNumberProp, hasStringProp, initAndStartSession, initEngine, initSession, isKernelError, isRecord, kernelError, listLoginAccounts, listQQVersions, narrowBuddyCategories, parseAppidFromMajor, parseLogConfig, parseToml, probeRuntime, quickLogin, readMachineGuid, requireKernelService, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveWrapperPath, sleep, startListenerRecording, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitFor, waitForNetworkConnection, waitSessionReady };
6761
+ export { BuddyCache, ChatType, ConfigBase, ConfigError, DEFAULT_DATA_ROOT_NAME, DependsAdapter, DispatcherAdapter, EXIT_CONFIG_INVALID, ElementType, 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, 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, parseAppidFromMajor, parseJsonWithGuard, parseLogConfig, parseToml, probeRuntime, quickLogin, readMachineGuid, requireKernelService, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveWrapperPath, sleep, startListenerRecording, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitFor, waitForNetworkConnection, waitSessionReady };
6478
6762
 
6479
6763
  //# sourceMappingURL=index.mjs.map