@napuketto/kernel 0.8.0 → 0.9.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 +100 -199
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +216 -175
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -18
- package/dist/index.cjs +0 -5627
- package/dist/index.d.cts +0 -3086
- package/dist/index.d.cts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4,13 +4,12 @@ import { basename, dirname, extname, join, resolve } from "node:path";
|
|
|
4
4
|
import { parse, stringify } from "smol-toml";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import pino from "pino";
|
|
7
|
-
import pinoPretty from "pino-pretty";
|
|
8
7
|
import { homedir, hostname, platform, release, type, version } from "node:os";
|
|
9
8
|
import { fileURLToPath } from "node:url";
|
|
10
9
|
import { createHash } from "node:crypto";
|
|
11
10
|
import { get } from "node:https";
|
|
12
11
|
import { EventEmitter } from "node:events";
|
|
13
|
-
|
|
12
|
+
// src/infra/errors.ts
|
|
14
13
|
/**
|
|
15
14
|
* 全部错误码集合。协议层映射表可据此推导:
|
|
16
15
|
* `Record<(typeof KERNEL_ERROR_CODES)[number], number>`。
|
|
@@ -61,8 +60,7 @@ function configError(message, options) {
|
|
|
61
60
|
}
|
|
62
61
|
/** 配置校验失败的进程退出码(UNIX sysexits EX_CONFIG 惯例)。 */
|
|
63
62
|
const EXIT_CONFIG_INVALID = 78;
|
|
64
|
-
|
|
65
|
-
//#region src/infra/config.ts
|
|
63
|
+
// src/infra/config.ts
|
|
66
64
|
/**
|
|
67
65
|
* 配置基类(ADR-012)
|
|
68
66
|
*
|
|
@@ -181,8 +179,7 @@ function parseToml(text) {
|
|
|
181
179
|
function stringifyToml(value) {
|
|
182
180
|
return stringify(value);
|
|
183
181
|
}
|
|
184
|
-
|
|
185
|
-
//#region src/infra/log-config.ts
|
|
182
|
+
// src/infra/log-config.ts
|
|
186
183
|
/**
|
|
187
184
|
* [log] 配置段解析(napuketto.toml 全局段,2026-10-25 日志可配置化)。
|
|
188
185
|
*
|
|
@@ -329,19 +326,21 @@ function parseLogConfig(section, env = {}) {
|
|
|
329
326
|
delete draft.fileLevelExplicit;
|
|
330
327
|
return draft;
|
|
331
328
|
}
|
|
332
|
-
|
|
333
|
-
//#region src/infra/log-format.ts
|
|
329
|
+
// src/infra/log-format.ts
|
|
334
330
|
/**
|
|
335
|
-
*
|
|
331
|
+
* 控制台渲染流(pretty / single-line / json,2026-10-25 日志可配置化;
|
|
332
|
+
* 2026-11-03 起 pretty 自渲染,移除对 pino-pretty 的依赖)。
|
|
336
333
|
*
|
|
337
|
-
* pino
|
|
338
|
-
*
|
|
339
|
-
* 嵌入式宿主的「一条记录一行、字段 k=v / NDJSON」契约,故自写轻量渲染流:
|
|
334
|
+
* 三种格式共用同一个「pino JSON 行 → 人读行」渲染入口(文件目的地恒为 JSON 行,
|
|
335
|
+
* 不受本模块影响):
|
|
340
336
|
*
|
|
341
|
-
*
|
|
337
|
+
* pretty:多行彩色,终端交互形态
|
|
338
|
+
* `[HH:MM:ss.l] INFO (name/pid): 消息` + 逐行 `key: value`(4 空格缩进,
|
|
339
|
+
* 嵌套对象/数组按 JSON 形状展开;字段名紫、消息青、级别按级别着色)
|
|
340
|
+
* single-line:`[时间] LEVEL (name/pid): 消息 key=value key=value`
|
|
342
341
|
* json:NDJSON,每行 {time, level, module, account?, pid, msg, ...fields}
|
|
343
342
|
*
|
|
344
|
-
* 时间渲染(LogConfig.timestamp):local = [HH:MM:ss.l](与
|
|
343
|
+
* 时间渲染(LogConfig.timestamp):local = [HH:MM:ss.l](与 history 一致)、
|
|
345
344
|
* iso8601 = 2026-10-25T16:01:33.294+08:00、elapsed = +123.456s(进程内单调秒)。
|
|
346
345
|
* json 的 time 恒为 ISO8601(机器可解析契约,不受 timestamp 键影响)。
|
|
347
346
|
*/
|
|
@@ -354,7 +353,7 @@ const LEVEL_LABELS = {
|
|
|
354
353
|
50: "error",
|
|
355
354
|
60: "fatal"
|
|
356
355
|
};
|
|
357
|
-
/** single-line
|
|
356
|
+
/** 级别颜色(pretty 级别标签 / single-line 级别与元数据头共用)。 */
|
|
358
357
|
const LEVEL_COLORS = {
|
|
359
358
|
trace: "\x1B[34m",
|
|
360
359
|
debug: "\x1B[36m",
|
|
@@ -364,7 +363,17 @@ const LEVEL_COLORS = {
|
|
|
364
363
|
fatal: "\x1B[91m"
|
|
365
364
|
};
|
|
366
365
|
const DIM = "\x1B[2m";
|
|
366
|
+
/** 字段名(紫,沿用原 pino-pretty 缺省配色)。 */
|
|
367
|
+
const KEY_COLOR = "\x1B[35m";
|
|
368
|
+
/** 消息(青,沿用原 pino-pretty 缺省配色)。 */
|
|
369
|
+
const MESSAGE_COLOR = "\x1B[36m";
|
|
367
370
|
const RESET = "\x1B[0m";
|
|
371
|
+
/** pretty 顶层字段缩进(4 空格,与原多行输出一致)。 */
|
|
372
|
+
const PRETTY_INDENT = " ";
|
|
373
|
+
/** pretty 嵌套值缩进(2 空格 JSON 缩进,与原多行输出一致)。 */
|
|
374
|
+
const NESTED_INDENT = " ";
|
|
375
|
+
/** 换行切分(多行字符串展开用;顶层常量避免每次调用重建正则)。 */
|
|
376
|
+
const NEWLINE = /\r?\n/;
|
|
368
377
|
/** 2 位补零。 */
|
|
369
378
|
function pad2(n) {
|
|
370
379
|
return String(n).padStart(2, "0");
|
|
@@ -377,7 +386,7 @@ function isoLocalTime(epochMs) {
|
|
|
377
386
|
const abs = Math.abs(offsetMinutes);
|
|
378
387
|
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}T${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}.${String(d.getMilliseconds()).padStart(3, "0")}${sign}${pad2(Math.floor(abs / 60))}:${pad2(abs % 60)}`;
|
|
379
388
|
}
|
|
380
|
-
/** 单调墙钟毫秒 →
|
|
389
|
+
/** 单调墙钟毫秒 → 本地时分秒(原 `SYS:HH:MM:ss.l` 短格式)。 */
|
|
381
390
|
function localShortTime(epochMs) {
|
|
382
391
|
const d = new Date(epochMs);
|
|
383
392
|
return `${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}.${String(d.getMilliseconds()).padStart(3, "0")}`;
|
|
@@ -399,12 +408,16 @@ function levelLabel(raw) {
|
|
|
399
408
|
if (typeof raw === "number") return LEVEL_LABELS[raw] ?? String(raw);
|
|
400
409
|
return typeof raw === "string" ? raw.toUpperCase() : "LOG";
|
|
401
410
|
}
|
|
411
|
+
/** 着色(useColor=false / 空串 / 未知级别无色码时原样返回,避免多余转义)。 */
|
|
412
|
+
function paint(code, text, useColor) {
|
|
413
|
+
return useColor && code !== "" && text !== "" ? `${code}${text}${RESET}` : text;
|
|
414
|
+
}
|
|
402
415
|
/** k=v 内联值:字符串裸输出(含空格时不加引号——宽松人类格式),其余 JSON 序列化。 */
|
|
403
416
|
function inlineValue(value) {
|
|
404
417
|
if (typeof value === "string") return value;
|
|
405
418
|
return JSON.stringify(value) ?? "null";
|
|
406
419
|
}
|
|
407
|
-
/**
|
|
420
|
+
/** 结构化输出忽略的标准字段(渲染进头/独立字段,不进字段尾部)。 */
|
|
408
421
|
const RESERVED_KEYS = /* @__PURE__ */ new Set([
|
|
409
422
|
"pid",
|
|
410
423
|
"hostname",
|
|
@@ -428,7 +441,7 @@ function renderJsonLine(record, ctx) {
|
|
|
428
441
|
};
|
|
429
442
|
return `${JSON.stringify(jsonLine)}\n`;
|
|
430
443
|
}
|
|
431
|
-
/**
|
|
444
|
+
/** 元数据头:(name/pid),无 name 时 (pid)。 */
|
|
432
445
|
function renderMeta(record) {
|
|
433
446
|
const pid = record["pid"] ?? "-";
|
|
434
447
|
const name = record["name"];
|
|
@@ -440,7 +453,7 @@ function renderKvFields(record) {
|
|
|
440
453
|
for (const [key, value] of Object.entries(record)) if (!RESERVED_KEYS.has(key)) fields.push(`${key}=${inlineValue(value)}`);
|
|
441
454
|
return fields.length > 0 ? ` ${fields.join(" ")}` : "";
|
|
442
455
|
}
|
|
443
|
-
/** single-line 渲染:[时间] LEVEL (name/pid): 消息 k=v k=v
|
|
456
|
+
/** single-line 渲染:[时间] LEVEL (name/pid): 消息 k=v k=v(级别大写)。 */
|
|
444
457
|
function renderSingleLine(record, ctx) {
|
|
445
458
|
const label = levelLabel(record["level"]);
|
|
446
459
|
const msg = typeof record["msg"] === "string" ? record["msg"] : "";
|
|
@@ -454,15 +467,97 @@ function renderSingleLine(record, ctx) {
|
|
|
454
467
|
}
|
|
455
468
|
return `[${time}] ${labelUpper} ${meta}: ${msg}${fieldsSuffix}\n`;
|
|
456
469
|
}
|
|
457
|
-
/**
|
|
470
|
+
/** 标量渲染(字符串 JSON 引号;数字/布尔/null/undefined 原样)。 */
|
|
471
|
+
function renderScalar(value) {
|
|
472
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
473
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
474
|
+
if (value === null || value === void 0) return String(value);
|
|
475
|
+
return String(value);
|
|
476
|
+
}
|
|
477
|
+
/** 给渲染块末行追加逗号(容器内非末项用)。 */
|
|
478
|
+
function withTrailingComma(lines, trailing) {
|
|
479
|
+
if (!trailing || lines.length === 0) return lines;
|
|
480
|
+
const copy = [...lines];
|
|
481
|
+
const last = copy.length - 1;
|
|
482
|
+
copy[last] = `${copy[last] ?? ""},`;
|
|
483
|
+
return copy;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* 容器(对象/数组)内一条属性的行:首行接 `key: 值`,续行保持嵌套缩进。
|
|
487
|
+
* 多行字符串的首行为空串,此时 key 行不带尾随内容(值从下一行开始)。
|
|
488
|
+
*/
|
|
489
|
+
function renderEntryLines(pad, key, value, depth) {
|
|
490
|
+
const entryPad = `${pad}${NESTED_INDENT}`;
|
|
491
|
+
const [first = "", ...rest] = renderValueLines(value, depth + 1);
|
|
492
|
+
const inline = first.slice(entryPad.length);
|
|
493
|
+
const keyText = `${entryPad}${JSON.stringify(key)}:`;
|
|
494
|
+
const head = inline === "" ? keyText : `${keyText} ${inline}`;
|
|
495
|
+
return rest.length === 0 ? [head] : [head, ...rest];
|
|
496
|
+
}
|
|
497
|
+
/** 数组渲染:`[` / 元素(逗号分隔)/ `]`。 */
|
|
498
|
+
function renderArrayLines(value, depth) {
|
|
499
|
+
const pad = NESTED_INDENT.repeat(depth);
|
|
500
|
+
if (value.length === 0) return [`${pad}[]`];
|
|
501
|
+
const lines = [`${pad}[`];
|
|
502
|
+
const lastIndex = value.length - 1;
|
|
503
|
+
for (const [index, item] of value.entries()) lines.push(...withTrailingComma(renderValueLines(item, depth + 1), index < lastIndex));
|
|
504
|
+
lines.push(`${pad}]`);
|
|
505
|
+
return lines;
|
|
506
|
+
}
|
|
507
|
+
/** 对象渲染:`{` / 属性(逗号分隔)/ `}`。 */
|
|
508
|
+
function renderObjectLines(value, depth) {
|
|
509
|
+
const pad = NESTED_INDENT.repeat(depth);
|
|
510
|
+
const entries = Object.entries(value);
|
|
511
|
+
if (entries.length === 0) return [`${pad}{}`];
|
|
512
|
+
const lines = [`${pad}{`];
|
|
513
|
+
const lastIndex = entries.length - 1;
|
|
514
|
+
for (const [index, [key, entryValue]] of entries.entries()) lines.push(...withTrailingComma(renderEntryLines(pad, key, entryValue, depth), index < lastIndex));
|
|
515
|
+
lines.push(`${pad}}`);
|
|
516
|
+
return lines;
|
|
517
|
+
}
|
|
518
|
+
/** 多行字符串展开:首行留空,内容逐行多缩进一级(典型 err.stack)。 */
|
|
519
|
+
function renderMultilineStringLines(value, depth) {
|
|
520
|
+
const pad = NESTED_INDENT.repeat(depth);
|
|
521
|
+
return [`${pad}`, ...value.split(NEWLINE).map((line) => `${pad}${PRETTY_INDENT}${line}`)];
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* pretty 值渲染成行(每行带 depth 级 2 空格缩进):
|
|
525
|
+
* - 对象/数组按 JSON 形状展开(嵌套键带引号);空容器渲染成 `[]` / `{}`;
|
|
526
|
+
* - 多行字符串(典型为 err.stack)不带引号展开,避免整段堆栈被转义成一行 `\n`;
|
|
527
|
+
* - 其余标量原样(字符串带 JSON 引号)。
|
|
528
|
+
*/
|
|
529
|
+
function renderValueLines(value, depth) {
|
|
530
|
+
if (Array.isArray(value)) return renderArrayLines(value, depth);
|
|
531
|
+
if (typeof value === "object" && value !== null) return renderObjectLines(value, depth);
|
|
532
|
+
if (typeof value === "string" && value.includes("\n")) return renderMultilineStringLines(value, depth);
|
|
533
|
+
return [`${NESTED_INDENT.repeat(depth)}${renderScalar(value)}`];
|
|
534
|
+
}
|
|
535
|
+
/** pretty 单条顶层字段:` key: 值`(嵌套续行按 JSON 缩进对齐)。 */
|
|
536
|
+
function renderPrettyField(key, value, useColor) {
|
|
537
|
+
const [first = "", ...rest] = renderValueLines(value, 0);
|
|
538
|
+
const label = paint(KEY_COLOR, key, useColor);
|
|
539
|
+
return [first === "" ? `${PRETTY_INDENT}${label}:` : `${PRETTY_INDENT}${label}: ${first}`, ...rest.map((line) => `${PRETTY_INDENT}${line}`)];
|
|
540
|
+
}
|
|
541
|
+
/** pretty 渲染:多行彩色 `[时间] LEVEL (name/pid): 消息` + 逐行字段。 */
|
|
542
|
+
function renderPrettyLine(record, ctx) {
|
|
543
|
+
const label = levelLabel(record["level"]);
|
|
544
|
+
const color = LEVEL_COLORS[label.toLowerCase()] ?? "";
|
|
545
|
+
const time = renderTime(record["time"], ctx.timestamp, false, ctx.timeOriginMs);
|
|
546
|
+
const msg = typeof record["msg"] === "string" ? record["msg"] : "";
|
|
547
|
+
const head = `[${time}] ${paint(color, label.toUpperCase(), ctx.useColor)} ${renderMeta(record)}:`;
|
|
548
|
+
const lines = msg === "" ? [head] : [`${head} ${paint(MESSAGE_COLOR, msg, ctx.useColor)}`];
|
|
549
|
+
for (const [key, value] of Object.entries(record)) if (!RESERVED_KEYS.has(key)) lines.push(...renderPrettyField(key, value, ctx.useColor));
|
|
550
|
+
return `${lines.join("\n")}\n`;
|
|
551
|
+
}
|
|
552
|
+
/** 创建控制台渲染流(pretty / single-line / json)。 */
|
|
458
553
|
function createConsoleFormatStream(opts) {
|
|
459
554
|
const out = opts.destination ?? process.stdout;
|
|
460
555
|
const ctx = {
|
|
461
556
|
timestamp: opts.timestamp,
|
|
462
557
|
timeOriginMs: performance.timeOrigin,
|
|
463
|
-
useColor: opts.format
|
|
558
|
+
useColor: opts.format !== "json" && opts.colorize
|
|
464
559
|
};
|
|
465
|
-
const render = opts.format === "json" ? renderJsonLine : renderSingleLine;
|
|
560
|
+
const render = opts.format === "pretty" ? renderPrettyLine : opts.format === "json" ? renderJsonLine : renderSingleLine;
|
|
466
561
|
return { write(line) {
|
|
467
562
|
let record;
|
|
468
563
|
try {
|
|
@@ -474,8 +569,7 @@ function createConsoleFormatStream(opts) {
|
|
|
474
569
|
out.write(render(record, ctx));
|
|
475
570
|
} };
|
|
476
571
|
}
|
|
477
|
-
|
|
478
|
-
//#region src/infra/logger.ts
|
|
572
|
+
// src/infra/logger.ts
|
|
479
573
|
/**
|
|
480
574
|
* pino 日志封装(ADR-007)
|
|
481
575
|
*
|
|
@@ -483,6 +577,7 @@ function createConsoleFormatStream(opts) {
|
|
|
483
577
|
* - 统一 level 控制(控制台与文件可分别设级,2026-10-25 日志可配置化)
|
|
484
578
|
* - 内置 redact(token / 票据等敏感字段不打日志),可追加
|
|
485
579
|
* - 无全局单例(ADR-015 推论):每进程实例化一份,由装配层持有
|
|
580
|
+
* - 三种控制台格式全部由 log-format 自渲染(2026-11-03 起不再依赖 pino-pretty)
|
|
486
581
|
*
|
|
487
582
|
* 时间源(2026-10-25 修复):QQNT 原生层会在 onRecvSysMsg 回调窗口内篡改进程
|
|
488
583
|
* Date(实测记录时间冻结为假值、回调外恢复),故时间戳统一取
|
|
@@ -514,85 +609,75 @@ function minLevel(a, b) {
|
|
|
514
609
|
function wallMs() {
|
|
515
610
|
return performance.timeOrigin + performance.now();
|
|
516
611
|
}
|
|
517
|
-
/** 进程内相对秒标签(elapsed 模式,pretty 字符串时间路径用)。 */
|
|
518
|
-
function elapsedLabelNow() {
|
|
519
|
-
return `+${(performance.now() / 1e3).toFixed(3)}s`;
|
|
520
|
-
}
|
|
521
612
|
function toSingle(streams) {
|
|
522
613
|
const [only] = streams;
|
|
523
614
|
if (only === void 0) throw new KernelError("logger 内部错误:目的地列表为空", "UNKNOWN");
|
|
524
615
|
return only.stream;
|
|
525
616
|
}
|
|
526
|
-
/**
|
|
527
|
-
function
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
colorize,
|
|
537
|
-
...timestampMode === "local" ? { translateTime: "SYS:HH:MM:ss.l" } : {},
|
|
538
|
-
...timestampMode === "iso8601" ? { translateTime: "SYS:yyyy-mm-dd'T'HH:MM:ss.l Z" } : {},
|
|
539
|
-
singleLine: false,
|
|
540
|
-
destination
|
|
541
|
-
});
|
|
617
|
+
/** 控制台目的地(console=false 返回 null)。 */
|
|
618
|
+
function buildConsoleTarget(opts, render, destination) {
|
|
619
|
+
if ((opts.console ?? true) !== true) return null;
|
|
620
|
+
return {
|
|
621
|
+
stream: createConsoleFormatStream({
|
|
622
|
+
...render,
|
|
623
|
+
destination
|
|
624
|
+
}),
|
|
625
|
+
level: opts.level ?? "info"
|
|
626
|
+
};
|
|
542
627
|
}
|
|
543
|
-
/**
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
const format = opts.format ?? (isTty ? "pretty" : "single-line");
|
|
628
|
+
/** 文件目的地(未配置 file 返回 null;同步写入,父目录自动创建)。 */
|
|
629
|
+
function buildFileTarget(opts, level) {
|
|
630
|
+
const { file } = opts;
|
|
631
|
+
if (file === void 0) return null;
|
|
632
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
549
633
|
return {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
634
|
+
stream: pino.destination({
|
|
635
|
+
dest: file,
|
|
636
|
+
sync: true
|
|
637
|
+
}),
|
|
638
|
+
level
|
|
554
639
|
};
|
|
555
640
|
}
|
|
641
|
+
/** 记录产生门槛 = 全部目的地中最低级别(multistream 再按各自级别分发过滤)。 */
|
|
642
|
+
function gateLevel(targets) {
|
|
643
|
+
let gate = "fatal";
|
|
644
|
+
for (const target of targets) gate = minLevel(gate, target.level);
|
|
645
|
+
return gate;
|
|
646
|
+
}
|
|
647
|
+
/** 单目的地直连(避免 multistream 包装),多目的地走 multistream。 */
|
|
648
|
+
function mergeTargets(targets) {
|
|
649
|
+
return targets.length === 1 ? toSingle(targets) : pino.multistream(targets);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* 创建 pino logger:console(pretty/single-line/json)+ 可选文件,统一 level / redact。
|
|
653
|
+
*
|
|
654
|
+
* 文件目的地用同步写入(`sync: true`):日志量级下性能可接受,且进程退出不丢日志,
|
|
655
|
+
* 无需额外的 flush 步骤(对比异步 SonicBoom 的 flushSync 时序陷阱)。
|
|
656
|
+
* 文件目的地恒为 JSON 行(数值时间戳),格式/时间戳渲染仅作用于控制台目的地。
|
|
657
|
+
*/
|
|
556
658
|
function createLogger(opts = {}) {
|
|
557
659
|
const consoleLevel = opts.level ?? "info";
|
|
558
|
-
const
|
|
559
|
-
const
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
});
|
|
566
|
-
if (file)
|
|
567
|
-
mkdirSync(dirname(file), { recursive: true });
|
|
568
|
-
streams.push({
|
|
569
|
-
stream: pino.destination({
|
|
570
|
-
dest: file,
|
|
571
|
-
sync: true
|
|
572
|
-
}),
|
|
573
|
-
level: fileLevel
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
if (streams.length === 0) throw new KernelError("logger 至少需要一个输出目标:console 或 file", "INVALID_PARAM");
|
|
577
|
-
let gate = "fatal";
|
|
578
|
-
for (const entry of streams) gate = minLevel(gate, entry.level);
|
|
579
|
-
const pinoTimestamp = render.format === "pretty" && render.timestampMode === "elapsed" ? () => `,"time":"${elapsedLabelNow()}"` : () => `,"time":${wallMs()}`;
|
|
660
|
+
const destination = opts.destination ?? process.stdout;
|
|
661
|
+
const isTty = destination.isTTY === true;
|
|
662
|
+
const format = opts.format ?? (isTty ? "pretty" : "single-line");
|
|
663
|
+
const targets = [buildConsoleTarget(opts, {
|
|
664
|
+
format,
|
|
665
|
+
timestamp: opts.timestamp ?? "local",
|
|
666
|
+
colorize: opts.colorize ?? (format === "pretty" && isTty)
|
|
667
|
+
}, destination), buildFileTarget(opts, opts.fileLevel ?? consoleLevel)].filter((target) => target !== null);
|
|
668
|
+
if (targets.length === 0) throw new KernelError("logger 至少需要一个输出目标:console 或 file", "INVALID_PARAM");
|
|
580
669
|
const pinoOptions = {
|
|
581
|
-
level:
|
|
670
|
+
level: gateLevel(targets),
|
|
582
671
|
redact: [...DEFAULT_REDACT_PATHS, ...opts.redact ?? []],
|
|
583
|
-
timestamp:
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
672
|
+
timestamp: () => `,"time":${wallMs()}`,
|
|
673
|
+
...opts.base === void 0 ? {} : { base: {
|
|
674
|
+
pid: process.pid,
|
|
675
|
+
...opts.base
|
|
676
|
+
} }
|
|
588
677
|
};
|
|
589
|
-
|
|
590
|
-
if (streams.length === 1) stream = toSingle(streams);
|
|
591
|
-
else stream = pino.multistream(streams);
|
|
592
|
-
return pino(pinoOptions, stream);
|
|
678
|
+
return pino(pinoOptions, mergeTargets(targets));
|
|
593
679
|
}
|
|
594
|
-
|
|
595
|
-
//#region src/infra/paths.ts
|
|
680
|
+
// src/infra/paths.ts
|
|
596
681
|
/**
|
|
597
682
|
* 数据目录布局(ADR-016,2026-08-08 修订:数据根默认放项目根)
|
|
598
683
|
*
|
|
@@ -722,8 +807,7 @@ var PathWrapper = class {
|
|
|
722
807
|
});
|
|
723
808
|
}
|
|
724
809
|
};
|
|
725
|
-
|
|
726
|
-
//#region src/apis/result.ts
|
|
810
|
+
// src/apis/result.ts
|
|
727
811
|
/**
|
|
728
812
|
* 原生调用结果解包(ADR-009 统一错误语义)
|
|
729
813
|
*
|
|
@@ -771,8 +855,7 @@ function unwrapResult(label, raw) {
|
|
|
771
855
|
if (code === "UNKNOWN" && label === "sendMsg") code = "SEND_FAILED";
|
|
772
856
|
throw kernelError(`${label} 失败: ${msg}`, code);
|
|
773
857
|
}
|
|
774
|
-
|
|
775
|
-
//#region src/apis/friend.ts
|
|
858
|
+
// src/apis/friend.ts
|
|
776
859
|
/**
|
|
777
860
|
* FriendApi:好友语义化 API(ADR-009 统一错误语义)
|
|
778
861
|
*
|
|
@@ -917,8 +1000,7 @@ function toDoubtFriendRequestInfo(item, uinMap) {
|
|
|
917
1000
|
assignOptional(info, "time", item.reqTime);
|
|
918
1001
|
return info;
|
|
919
1002
|
}
|
|
920
|
-
|
|
921
|
-
//#region src/types/entities.ts
|
|
1003
|
+
// src/types/entities.ts
|
|
922
1004
|
/**
|
|
923
1005
|
* 实体类型层(运行时探测产物 + 公开资料作说明书,ADR-006)
|
|
924
1006
|
*
|
|
@@ -957,8 +1039,7 @@ const TipGroupElementType = {
|
|
|
957
1039
|
UNBLOCK: 7,
|
|
958
1040
|
SHUT_UP: 8
|
|
959
1041
|
};
|
|
960
|
-
|
|
961
|
-
//#region src/types/listeners/group.ts
|
|
1042
|
+
// src/types/listeners/group.ts
|
|
962
1043
|
/** 群列表更新类型(说明书参考,值待探测校准)。 */
|
|
963
1044
|
const GroupListUpdateType = {
|
|
964
1045
|
/** 全量更新(groupList 为完整列表)。 */
|
|
@@ -966,8 +1047,7 @@ const GroupListUpdateType = {
|
|
|
966
1047
|
/** 增量更新(合并到现有缓存)。 */
|
|
967
1048
|
PARTIAL: 1
|
|
968
1049
|
};
|
|
969
|
-
|
|
970
|
-
//#region src/types/services/msg-service.ts
|
|
1050
|
+
// src/types/services/msg-service.ts
|
|
971
1051
|
/** 消息元素类型枚举(QQ wrapper 外部契约,自研描述)。 */
|
|
972
1052
|
const ElementType = {
|
|
973
1053
|
UNKNOWN: 0,
|
|
@@ -991,8 +1071,7 @@ const ElementType = {
|
|
|
991
1071
|
INTEXT_GIFT: 18,
|
|
992
1072
|
CALENDAR: 19
|
|
993
1073
|
};
|
|
994
|
-
|
|
995
|
-
//#region src/types/message-element.ts
|
|
1074
|
+
// src/types/message-element.ts
|
|
996
1075
|
/**
|
|
997
1076
|
* canonical 消息元素模型(协议无关,ADR-008 延伸)
|
|
998
1077
|
*
|
|
@@ -1268,8 +1347,7 @@ function toSendElements(elements) {
|
|
|
1268
1347
|
}
|
|
1269
1348
|
return out;
|
|
1270
1349
|
}
|
|
1271
|
-
|
|
1272
|
-
//#region src/types/services/group-service.ts
|
|
1350
|
+
// src/types/services/group-service.ts
|
|
1273
1351
|
/** 群成员角色(QQ wrapper 契约)。 */
|
|
1274
1352
|
const NTGroupMemberRole = {
|
|
1275
1353
|
UNSPECIFIED: 0,
|
|
@@ -1313,8 +1391,7 @@ const NTGroupRequestOperateTypes = {
|
|
|
1313
1391
|
KIGNORE: 3,
|
|
1314
1392
|
KDELETE: 4
|
|
1315
1393
|
};
|
|
1316
|
-
|
|
1317
|
-
//#region src/types/wrapper.ts
|
|
1394
|
+
// src/types/wrapper.ts
|
|
1318
1395
|
/**
|
|
1319
1396
|
* wrapper.node 的 NAPI 接口面(自研描述,非移植)
|
|
1320
1397
|
*
|
|
@@ -1343,8 +1420,7 @@ const VendorType = {
|
|
|
1343
1420
|
KSUPPORTVIVOPUSH: 5,
|
|
1344
1421
|
KSUPPORTGOOGLEPUSH: 99
|
|
1345
1422
|
};
|
|
1346
|
-
|
|
1347
|
-
//#region src/apis/group.ts
|
|
1423
|
+
// src/apis/group.ts
|
|
1348
1424
|
/**
|
|
1349
1425
|
* GroupApi:群语义化 API(ADR-009 统一错误语义)
|
|
1350
1426
|
*
|
|
@@ -1628,8 +1704,7 @@ function extractGroupDetail(result, raw) {
|
|
|
1628
1704
|
if (candidate !== void 0 && candidate !== null && typeof candidate === "object") return candidate;
|
|
1629
1705
|
return null;
|
|
1630
1706
|
}
|
|
1631
|
-
|
|
1632
|
-
//#region src/apis/group-notify.ts
|
|
1707
|
+
// src/apis/group-notify.ts
|
|
1633
1708
|
/**
|
|
1634
1709
|
* GroupNotifyApi:群通知/禁言列表语义化 API(ADR-009 统一错误语义,P2-13)
|
|
1635
1710
|
*
|
|
@@ -1693,8 +1768,7 @@ function extractMemberList(result) {
|
|
|
1693
1768
|
}
|
|
1694
1769
|
return [];
|
|
1695
1770
|
}
|
|
1696
|
-
|
|
1697
|
-
//#region src/apis/msg.ts
|
|
1771
|
+
// src/apis/msg.ts
|
|
1698
1772
|
/**
|
|
1699
1773
|
* MsgApi:消息语义化 API(ADR-009 统一错误语义)
|
|
1700
1774
|
*
|
|
@@ -2270,8 +2344,7 @@ function findForwardElement(msgs) {
|
|
|
2270
2344
|
if (first === void 0) return null;
|
|
2271
2345
|
return first.elements.find((el) => el.multiForwardMsgElement !== void 0)?.multiForwardMsgElement ?? null;
|
|
2272
2346
|
}
|
|
2273
|
-
|
|
2274
|
-
//#region src/apis/stranger-info.ts
|
|
2347
|
+
// src/apis/stranger-info.ts
|
|
2275
2348
|
/** 宽松取值:undefined 时给默认值(null 也归默认)。 */
|
|
2276
2349
|
function orDefault(value, fallback) {
|
|
2277
2350
|
return value ?? fallback;
|
|
@@ -2321,8 +2394,7 @@ function mapSex(raw) {
|
|
|
2321
2394
|
if (raw === 2) return "female";
|
|
2322
2395
|
return "unknown";
|
|
2323
2396
|
}
|
|
2324
|
-
|
|
2325
|
-
//#region src/apis/profile.ts
|
|
2397
|
+
// src/apis/profile.ts
|
|
2326
2398
|
/**
|
|
2327
2399
|
* ProfileApi:资料语义化 API(ADR-009 统一错误语义,P2-14/P2-15)
|
|
2328
2400
|
*
|
|
@@ -2362,8 +2434,7 @@ var ProfileApi = class {
|
|
|
2362
2434
|
return flattenStrangerInfo(uin, uid, byUin, info);
|
|
2363
2435
|
}
|
|
2364
2436
|
};
|
|
2365
|
-
|
|
2366
|
-
//#region src/apis/profile-like.ts
|
|
2437
|
+
// src/apis/profile-like.ts
|
|
2367
2438
|
/**
|
|
2368
2439
|
* ProfileLikeApi:资料点赞语义化 API(ADR-009 统一错误语义,P2-14)
|
|
2369
2440
|
*
|
|
@@ -2388,8 +2459,7 @@ var ProfileLikeApi = class {
|
|
|
2388
2459
|
if (raw.result !== 0) throw kernelError(`点赞失败: ${raw.errMsg}`, "UNKNOWN");
|
|
2389
2460
|
}
|
|
2390
2461
|
};
|
|
2391
|
-
|
|
2392
|
-
//#region src/apis/recent-contact.ts
|
|
2462
|
+
// src/apis/recent-contact.ts
|
|
2393
2463
|
/**
|
|
2394
2464
|
* RecentContactApi:会话列表语义化 API(P2 批次二,get_peer_pins 数据源)
|
|
2395
2465
|
*
|
|
@@ -2468,8 +2538,7 @@ function pinnedItem(contact, scene) {
|
|
|
2468
2538
|
function errMsgString$1(e) {
|
|
2469
2539
|
return e instanceof Error ? e.message : String(e);
|
|
2470
2540
|
}
|
|
2471
|
-
|
|
2472
|
-
//#region src/apis/richmedia.ts
|
|
2541
|
+
// src/apis/richmedia.ts
|
|
2473
2542
|
/**
|
|
2474
2543
|
* RichMediaApi:富媒体语义化 API(ADR-009 统一错误语义,P2-14)
|
|
2475
2544
|
*
|
|
@@ -2613,8 +2682,7 @@ function countGroupFiles(result) {
|
|
|
2613
2682
|
if (Array.isArray(result)) return result.filter((item) => item.fileInfo !== void 0).length;
|
|
2614
2683
|
return 0;
|
|
2615
2684
|
}
|
|
2616
|
-
|
|
2617
|
-
//#region src/apis/ticket.ts
|
|
2685
|
+
// src/apis/ticket.ts
|
|
2618
2686
|
/**
|
|
2619
2687
|
* TicketApi:票据语义化 API(ADR-009 统一错误语义,P2-13)
|
|
2620
2688
|
*
|
|
@@ -2686,8 +2754,7 @@ function parseSetCookieHeaders(raw) {
|
|
|
2686
2754
|
}
|
|
2687
2755
|
return cookies;
|
|
2688
2756
|
}
|
|
2689
|
-
|
|
2690
|
-
//#region src/apis/webapi.ts
|
|
2757
|
+
// src/apis/webapi.ts
|
|
2691
2758
|
/**
|
|
2692
2759
|
* WebApi:群空间 web 接口(P2-15)
|
|
2693
2760
|
*
|
|
@@ -2859,8 +2926,7 @@ function honorTargets(type) {
|
|
|
2859
2926
|
if (type === WebHonorType.ALL) return [...all];
|
|
2860
2927
|
return all.filter((target) => target.kind === type);
|
|
2861
2928
|
}
|
|
2862
|
-
|
|
2863
|
-
//#region src/bridge/friend-bridge.ts
|
|
2929
|
+
// src/bridge/friend-bridge.ts
|
|
2864
2930
|
/**
|
|
2865
2931
|
* 好友事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2866
2932
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
@@ -2893,8 +2959,7 @@ var FriendBridge = class {
|
|
|
2893
2959
|
this.listenerId = null;
|
|
2894
2960
|
}
|
|
2895
2961
|
};
|
|
2896
|
-
|
|
2897
|
-
//#region src/bridge/group-bridge.ts
|
|
2962
|
+
// src/bridge/group-bridge.ts
|
|
2898
2963
|
/**
|
|
2899
2964
|
* 群事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2900
2965
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
@@ -2932,8 +2997,7 @@ var GroupBridge = class {
|
|
|
2932
2997
|
this.listenerId = null;
|
|
2933
2998
|
}
|
|
2934
2999
|
};
|
|
2935
|
-
|
|
2936
|
-
//#region src/bridge/login-bridge.ts
|
|
3000
|
+
// src/bridge/login-bridge.ts
|
|
2937
3001
|
/**
|
|
2938
3002
|
* 登录事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2939
3003
|
* 无全局单例(ADR-015 推论)——每进程一份。
|
|
@@ -2963,8 +3027,7 @@ var LoginBridge = class {
|
|
|
2963
3027
|
this.listenerId = null;
|
|
2964
3028
|
}
|
|
2965
3029
|
};
|
|
2966
|
-
|
|
2967
|
-
//#region src/bridge/msg-bridge.ts
|
|
3030
|
+
// src/bridge/msg-bridge.ts
|
|
2968
3031
|
/**
|
|
2969
3032
|
* 消息事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
2970
3033
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
@@ -3001,8 +3064,7 @@ var MsgBridge = class {
|
|
|
3001
3064
|
this.listenerId = null;
|
|
3002
3065
|
}
|
|
3003
3066
|
};
|
|
3004
|
-
|
|
3005
|
-
//#region src/bridge/recent-contact-bridge.ts
|
|
3067
|
+
// src/bridge/recent-contact-bridge.ts
|
|
3006
3068
|
/**
|
|
3007
3069
|
* 会话列表事件桥:注册原生监听 → 回调 emit 到 channel。
|
|
3008
3070
|
* 无全局单例(ADR-015 推论)——每进程每 session 实例化一份。
|
|
@@ -3033,8 +3095,7 @@ var RecentContactBridge = class {
|
|
|
3033
3095
|
this.listenerId = null;
|
|
3034
3096
|
}
|
|
3035
3097
|
};
|
|
3036
|
-
|
|
3037
|
-
//#region src/event-channel.ts
|
|
3098
|
+
// src/event-channel.ts
|
|
3038
3099
|
/**
|
|
3039
3100
|
* 类型化事件通道(ADR-003)
|
|
3040
3101
|
*
|
|
@@ -3141,8 +3202,7 @@ var NTEventChannel = class {
|
|
|
3141
3202
|
};
|
|
3142
3203
|
}
|
|
3143
3204
|
};
|
|
3144
|
-
|
|
3145
|
-
//#region src/cache/buddy-cache.ts
|
|
3205
|
+
// src/cache/buddy-cache.ts
|
|
3146
3206
|
/**
|
|
3147
3207
|
* 防御性收窄 onBuddyListChange 载荷 → BuddyCategory[](T10 实证形状;
|
|
3148
3208
|
* 非数组返回 null,调用方打 raw 日志积累校准数据)。
|
|
@@ -3220,8 +3280,7 @@ var BuddyCache = class {
|
|
|
3220
3280
|
return this.bootstrapped;
|
|
3221
3281
|
}
|
|
3222
3282
|
};
|
|
3223
|
-
|
|
3224
|
-
//#region src/login/wait.ts
|
|
3283
|
+
// src/login/wait.ts
|
|
3225
3284
|
/**
|
|
3226
3285
|
* 等待/延迟工具(login 模块共享,2026-08-08 克隆合并)
|
|
3227
3286
|
*/
|
|
@@ -3249,8 +3308,7 @@ function sleep(ms) {
|
|
|
3249
3308
|
setTimeout(resolve, ms);
|
|
3250
3309
|
});
|
|
3251
3310
|
}
|
|
3252
|
-
|
|
3253
|
-
//#region src/cache/group-cache.ts
|
|
3311
|
+
// src/cache/group-cache.ts
|
|
3254
3312
|
/**
|
|
3255
3313
|
* 群/成员缓存:事件主动维护 + 查询惰性回填。
|
|
3256
3314
|
* 只读接口 getGroupDetail / getMembers / getMember / getGroup(列表项)。
|
|
@@ -3413,8 +3471,7 @@ var GroupCache = class {
|
|
|
3413
3471
|
return await task;
|
|
3414
3472
|
}
|
|
3415
3473
|
};
|
|
3416
|
-
|
|
3417
|
-
//#region src/context.ts
|
|
3474
|
+
// src/context.ts
|
|
3418
3475
|
/** 创建装配根(初始 wrapper/login 为 null)。 */
|
|
3419
3476
|
function createCoreContext(opts) {
|
|
3420
3477
|
return {
|
|
@@ -3424,8 +3481,7 @@ function createCoreContext(opts) {
|
|
|
3424
3481
|
login: null
|
|
3425
3482
|
};
|
|
3426
3483
|
}
|
|
3427
|
-
|
|
3428
|
-
//#region src/wrapper/wrapper-adapters.ts
|
|
3484
|
+
// src/wrapper/wrapper-adapters.ts
|
|
3429
3485
|
/** NAPI 回调占位(方法存在即可被反射调用,无副作用)。 */
|
|
3430
3486
|
const noop = () => void 0;
|
|
3431
3487
|
/** NodeIGlobalAdapter 实现(engine.initWithDeskTopConfig 第二参)。 */
|
|
@@ -3474,8 +3530,7 @@ function createSessionListener(opts = {}) {
|
|
|
3474
3530
|
function createLoginListener() {
|
|
3475
3531
|
return {};
|
|
3476
3532
|
}
|
|
3477
|
-
|
|
3478
|
-
//#region src/login/login-connect.ts
|
|
3533
|
+
// src/login/login-connect.ts
|
|
3479
3534
|
/**
|
|
3480
3535
|
* 登录连接与快速登录(从 lifecycle.ts 拆分,2026-08-08 FTA 优化)
|
|
3481
3536
|
*
|
|
@@ -3664,8 +3719,7 @@ async function quickLogin(ctx, opts = {}) {
|
|
|
3664
3719
|
if (items.length === 0) throw kernelError("无历史登录账号", "NOT_LOGIN");
|
|
3665
3720
|
return loginWithNetworkRetry(ctx, loginService, pickLoginTarget(items, opts.uin), opts, quickTimeoutMs);
|
|
3666
3721
|
}
|
|
3667
|
-
|
|
3668
|
-
//#region src/login/lifecycle.ts
|
|
3722
|
+
// src/login/lifecycle.ts
|
|
3669
3723
|
/**
|
|
3670
3724
|
* 完整启动生命周期(wrapper.node 契约流程,2026-08-05 实测确认,自研实现)
|
|
3671
3725
|
*
|
|
@@ -3768,8 +3822,7 @@ function startupSessionStart(ctx) {
|
|
|
3768
3822
|
} catch {}
|
|
3769
3823
|
return true;
|
|
3770
3824
|
}
|
|
3771
|
-
|
|
3772
|
-
//#region src/login/login.ts
|
|
3825
|
+
// src/login/login.ts
|
|
3773
3826
|
/**
|
|
3774
3827
|
* login.ts:QR 登录流程编排 + 状态机 + selfInfo(ADR-010,2026-08-05)
|
|
3775
3828
|
*
|
|
@@ -3935,8 +3988,7 @@ var QrLoginSession = class {
|
|
|
3935
3988
|
for (const cb of this.qrCodeHandlers) cb(qr);
|
|
3936
3989
|
}
|
|
3937
3990
|
};
|
|
3938
|
-
|
|
3939
|
-
//#region src/wrapper/qq-data-path.ts
|
|
3991
|
+
// src/wrapper/qq-data-path.ts
|
|
3940
3992
|
/**
|
|
3941
3993
|
* QQ 数据根路径解析(P2-1,2026-08-06)
|
|
3942
3994
|
*
|
|
@@ -3996,8 +4048,7 @@ function findInObject(value) {
|
|
|
3996
4048
|
}
|
|
3997
4049
|
return null;
|
|
3998
4050
|
}
|
|
3999
|
-
|
|
4000
|
-
//#region src/wrapper/wrapper-config.ts
|
|
4051
|
+
// src/wrapper/wrapper-config.ts
|
|
4001
4052
|
/**
|
|
4002
4053
|
* wrapper 交互配置装配(纯函数,无状态)
|
|
4003
4054
|
*
|
|
@@ -4206,8 +4257,7 @@ function readMachineGuid(loginService) {
|
|
|
4206
4257
|
return "";
|
|
4207
4258
|
}
|
|
4208
4259
|
}
|
|
4209
|
-
|
|
4210
|
-
//#region src/wrapper/wrapper-loader.ts
|
|
4260
|
+
// src/wrapper/wrapper-loader.ts
|
|
4211
4261
|
/**
|
|
4212
4262
|
* wrapper 引导(NAPI 范式,2026-08-05 重构,替代旧 koffi 方案)
|
|
4213
4263
|
*
|
|
@@ -4436,8 +4486,7 @@ function getOrCreateLoginService(exports) {
|
|
|
4436
4486
|
return null;
|
|
4437
4487
|
}
|
|
4438
4488
|
}
|
|
4439
|
-
|
|
4440
|
-
//#region src/core.ts
|
|
4489
|
+
// src/core.ts
|
|
4441
4490
|
/**
|
|
4442
4491
|
* NapukettoCore:装配 + 启动(§9 第 6 项,2026-08-05 实现)
|
|
4443
4492
|
*
|
|
@@ -4683,8 +4732,7 @@ function resolveCommonPath(ctx, wrapper) {
|
|
|
4683
4732
|
}
|
|
4684
4733
|
return ctx.paths.accountDir;
|
|
4685
4734
|
}
|
|
4686
|
-
|
|
4687
|
-
//#region src/wrapper/session-resolver.ts
|
|
4735
|
+
// src/wrapper/session-resolver.ts
|
|
4688
4736
|
/** 从 getSessionIdList 的 Map 提取主 sessionId(nt_ 前缀优先)。 */
|
|
4689
4737
|
function findMainSessionId(ids) {
|
|
4690
4738
|
return firstStringId(ids, (s) => s.startsWith("nt_")) ?? firstStringId(ids, () => true);
|
|
@@ -4755,8 +4803,7 @@ function resolveMainFromStartup(ctx) {
|
|
|
4755
4803
|
if (session !== null) ctx.session = session;
|
|
4756
4804
|
return session;
|
|
4757
4805
|
}
|
|
4758
|
-
|
|
4759
|
-
//#region src/wrapper/probe/probe-serialize.ts
|
|
4806
|
+
// src/wrapper/probe/probe-serialize.ts
|
|
4760
4807
|
/**
|
|
4761
4808
|
* 运行时反射探测的序列化工具(从 probe.ts 拆分,2026-08-08 FTA 优化)
|
|
4762
4809
|
*
|
|
@@ -4863,8 +4910,7 @@ function tryShape(session, getter) {
|
|
|
4863
4910
|
return "[error]";
|
|
4864
4911
|
}
|
|
4865
4912
|
}
|
|
4866
|
-
|
|
4867
|
-
//#region src/wrapper/probe/probe-utils.ts
|
|
4913
|
+
// src/wrapper/probe/probe-utils.ts
|
|
4868
4914
|
/**
|
|
4869
4915
|
* 运行时反射探测基础工具(从 probe.ts 拆分,2026-08-08 FTA 优化)
|
|
4870
4916
|
*
|
|
@@ -4920,8 +4966,7 @@ function tryCall(obj, name) {
|
|
|
4920
4966
|
function isServiceGetter(name) {
|
|
4921
4967
|
return name.startsWith("get") && name.endsWith("Service");
|
|
4922
4968
|
}
|
|
4923
|
-
|
|
4924
|
-
//#region src/wrapper/probe/probe-services.ts
|
|
4969
|
+
// src/wrapper/probe/probe-services.ts
|
|
4925
4970
|
/** 探测关键 export 构造器方法(get/create/getNTWrapperSession 等)。 */
|
|
4926
4971
|
function probeExportCtors(ctx) {
|
|
4927
4972
|
const keys = [
|
|
@@ -4990,8 +5035,7 @@ const LOGIN_GETTER_PROBES = [
|
|
|
4990
5035
|
"getUid",
|
|
4991
5036
|
"getSelfUin"
|
|
4992
5037
|
];
|
|
4993
|
-
|
|
4994
|
-
//#region src/wrapper/probe/probe.ts
|
|
5038
|
+
// src/wrapper/probe/probe.ts
|
|
4995
5039
|
/**
|
|
4996
5040
|
* 运行时反射探测(ADR-006 落地,P1-4)
|
|
4997
5041
|
*
|
|
@@ -5268,8 +5312,7 @@ function writeProbeFile(result, file) {
|
|
|
5268
5312
|
result["probeFileError"] = errMsgString(e);
|
|
5269
5313
|
}
|
|
5270
5314
|
}
|
|
5271
|
-
|
|
5272
|
-
//#region src/wrapper/probe/probe-listener.ts
|
|
5315
|
+
// src/wrapper/probe/probe-listener.ts
|
|
5273
5316
|
/**
|
|
5274
5317
|
* listener 录制器(批次三前置探测,docs/protocols/milky.md §0.8.1、本包 design.md §10)
|
|
5275
5318
|
*
|
|
@@ -5459,8 +5502,7 @@ function attachRecordingListener(name, service, emit) {
|
|
|
5459
5502
|
...typeof listenerId === "number" ? { listenerId } : {}
|
|
5460
5503
|
};
|
|
5461
5504
|
}
|
|
5462
|
-
|
|
5463
|
-
//#region src/wrapper/wrapper-version.ts
|
|
5505
|
+
// src/wrapper/wrapper-version.ts
|
|
5464
5506
|
/**
|
|
5465
5507
|
* QQ 安装目录探测(ADR-018)
|
|
5466
5508
|
*
|
|
@@ -5516,7 +5558,6 @@ function listQQVersions(installDir) {
|
|
|
5516
5558
|
return statSync(full).isDirectory() && existsSync(join(full, "resources", "app", "wrapper.node"));
|
|
5517
5559
|
}).sort().reverse();
|
|
5518
5560
|
}
|
|
5519
|
-
//#endregion
|
|
5520
5561
|
export { BuddyCache, ChatType, ConfigBase, ConfigError, DEFAULT_DATA_ROOT_NAME, EXIT_CONFIG_INVALID, ElementType, FriendApi, FriendBridge, GrayTipSubType, GroupApi, GroupBridge, GroupCache, GroupListUpdateType, 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, WebApi, WebHonorType, buildEngineConfig, buildLoginConfig, buildSessionConfig, configError, createCoreContext, createSessionListener as createLifecycleSessionListener, createSessionListener, createLogger, createLoginListener, createRecordingListener, createSession, createWrapper, electronProcessType, getExistingSession, getMainSession, initAndStartSession, initEngine, initSession, isKernelError, kernelError, listLoginAccounts, listQQVersions, narrowBuddyCategories, parseAppidFromMajor, parseLogConfig, parseToml, probeRuntime, quickLogin, readMachineGuid, resolveAppidQua, resolveConfigPath, resolveDataRoot, resolveQQVersion, resolveQqGlobalPath, resolveQqUserDataRoot, resolveWrapperPath, startListenerRecording, startNapuketto, startSession, stringifyToml, toCanonicalElements, toSendElements, waitForNetworkConnection, waitSessionReady };
|
|
5521
5562
|
|
|
5522
5563
|
//# sourceMappingURL=index.mjs.map
|