@napuketto/adapter 0.16.1 → 0.16.4

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.
Files changed (39) hide show
  1. package/dist/core/index.d.mts +2 -2
  2. package/dist/core/index.mjs +1 -1
  3. package/dist/{core-D5c78lFV.mjs → core-l7TM-aKF.mjs} +23 -2
  4. package/dist/core-l7TM-aKF.mjs.map +1 -0
  5. package/dist/{essence-Bxs-aKSC.mjs → essence-CU3kvItK.mjs} +75 -2
  6. package/dist/essence-CU3kvItK.mjs.map +1 -0
  7. package/dist/gray-tip-DNo_Mi4E.d.mts.map +1 -1
  8. package/dist/{index-Dhd-kaUF.d.mts → index-jdSniAj1.d.mts} +13 -3
  9. package/dist/index-jdSniAj1.d.mts.map +1 -0
  10. package/dist/kurobot/index.d.mts +12 -5
  11. package/dist/kurobot/index.d.mts.map +1 -1
  12. package/dist/kurobot/index.mjs +16 -15
  13. package/dist/kurobot/index.mjs.map +1 -1
  14. package/dist/log-AtQxAmbQ.mjs +214 -0
  15. package/dist/log-AtQxAmbQ.mjs.map +1 -0
  16. package/dist/milky/index.d.mts +15 -15
  17. package/dist/milky/index.d.mts.map +1 -1
  18. package/dist/milky/index.mjs +274 -265
  19. package/dist/milky/index.mjs.map +1 -1
  20. package/dist/onebot11/index.d.mts +1 -1
  21. package/dist/onebot11/index.d.mts.map +1 -1
  22. package/dist/onebot11/index.mjs +294 -276
  23. package/dist/onebot11/index.mjs.map +1 -1
  24. package/dist/raw-message-D5nMIebz.mjs +130 -0
  25. package/dist/raw-message-D5nMIebz.mjs.map +1 -0
  26. package/dist/satori/index.d.mts +116 -116
  27. package/dist/satori/index.d.mts.map +1 -1
  28. package/dist/satori/index.mjs +25 -31
  29. package/dist/satori/index.mjs.map +1 -1
  30. package/package.json +5 -5
  31. package/dist/core-D5c78lFV.mjs.map +0 -1
  32. package/dist/essence-Bxs-aKSC.mjs.map +0 -1
  33. package/dist/index-Dhd-kaUF.d.mts.map +0 -1
  34. package/dist/log-BsInJV_y.mjs +0 -123
  35. package/dist/log-BsInJV_y.mjs.map +0 -1
  36. package/dist/media-DMMn74TC.mjs +0 -126
  37. package/dist/media-DMMn74TC.mjs.map +0 -1
  38. package/dist/raw-message-DE3sdJg8.mjs +0 -45
  39. package/dist/raw-message-DE3sdJg8.mjs.map +0 -1
@@ -1,16 +1,102 @@
1
- import { i as runAction, n as BaseProtocolAdapter, r as ActionRegistry } from "../core-D5c78lFV.mjs";
2
- import { i as toUnixSeconds, n as senderNickname, r as subscribeRawMessages } from "../raw-message-DE3sdJg8.mjs";
3
- import { n as prepareVideoElements, r as createServerSchema, t as ensureSilk } from "../media-DMMn74TC.mjs";
4
- import { c as MS_TO_SEC, d as toUin, i as collectGrayTipUids, l as numericUin, n as sliceRaw, o as firstUntranslatedGrayTip, r as truncRaw, s as hasGrayTip, t as logEventFailure } from "../log-BsInJV_y.mjs";
5
- import { d as narrowBuddyReqs, i as narrowSysMsgBlobs, n as extractEssenceSetSysMsg, o as processSysMsgBlob, r as narrowEssenceGroupArg, s as recognizeSysMsg, t as EssenceListSync } from "../essence-Bxs-aKSC.mjs";
6
- import { ChatType, GrayTipSubType, GroupApi, GroupNotifyMsgStatus, GroupNotifyMsgType, NTGroupMemberRole, NTGroupRequestOperateTypes, TicketApi, TipGroupElementType, WebHonorType, kernelError, toCanonicalElements } from "@napuketto/kernel";
1
+ import { a as runAction, i as ActionRegistry, n as createServerSchema, r as BaseProtocolAdapter } from "../core-l7TM-aKF.mjs";
2
+ import { a as firstNonEmptyString, c as MS_TO_SEC, f as toUin, i as toUnixSeconds, l as NUMERIC_RE, n as senderNickname, o as stringOrUndefined, r as subscribeRawMessages, s as startupBaselineSec, u as numericUin } from "../raw-message-D5nMIebz.mjs";
3
+ import { a as ensureSilk, c as collectGrayTipUids, d as hasGrayTip, i as downloadBufferToFile, n as sliceRaw, o as fileUriToPath, r as truncRaw, s as prepareVideoElements, t as logEventFailure, u as firstUntranslatedGrayTip } from "../log-AtQxAmbQ.mjs";
4
+ import { a as narrowSysMsgBlobs, c as recognizeSysMsg, f as BuddyReqDedup, h as narrowBuddyReqs, i as OBSERVED_UNNAMED_SYSMSG_KEYS, m as filterBuddyReqs, n as extractEssenceSetSysMsg, p as batchUnreadNums, r as narrowEssenceGroupArg, s as processSysMsgBlob, t as EssenceListSync } from "../essence-CU3kvItK.mjs";
5
+ import { ChatType, GrayTipSubType, GroupApi, GroupNotifyMsgStatus, GroupNotifyMsgType, NTGroupMemberRole, NTGroupRequestOperateTypes, TicketApi, TipGroupElementType, WebHonorType, errorMessage, kernelError, toCanonicalElements } from "@napuketto/kernel";
7
6
  import { z } from "zod";
8
7
  import { randomUUID } from "node:crypto";
9
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
8
+ import { existsSync } from "node:fs";
9
+ import { mkdir } from "node:fs/promises";
10
10
  import { basename, join } from "node:path";
11
11
  import { downloadUrl, inferExtension } from "@napuketto/media";
12
- import { fileURLToPath } from "node:url";
13
12
  import { HttpClient, HttpServer, WsClient, WsServer } from "@napuketto/network";
13
+ // src/onebot11/helper/message-unique.ts
14
+ /** OB11 message_id 上限(int32 max = 0x7FFF_FFFF)。 */
15
+ const INT32_MAX = 2147483647;
16
+ /** int32 下限。 */
17
+ const INT32_MIN = 1;
18
+ var MessageUnique = class {
19
+ /** NT msgId → OB11 message_id。 */
20
+ msgIdToInt = /* @__PURE__ */ new Map();
21
+ /** OB11 message_id → NT msgId。 */
22
+ intToMsgId = /* @__PURE__ */ new Map();
23
+ /** NT msgId → Peer(delete_msg / get_msg 等只有 message_id 时反查用)。 */
24
+ msgIdToPeer = /* @__PURE__ */ new Map();
25
+ /** 递增计数器。 */
26
+ cursor = 1;
27
+ /** 已释放的槽位(可复用)。 */
28
+ freed = /* @__PURE__ */ new Set();
29
+ /**
30
+ * 为新 NT 消息分配 OB11 message_id(幂等:同一 msgId 返回同一 id)。
31
+ * peer 可选:传入则记录,供 message_id → peer 反查。
32
+ */
33
+ alloc(msgId, peer) {
34
+ const existing = this.msgIdToInt.get(msgId);
35
+ if (existing !== void 0) {
36
+ if (peer !== void 0) this.msgIdToPeer.set(msgId, peer);
37
+ return existing;
38
+ }
39
+ const id = this.nextFreeId();
40
+ this.msgIdToInt.set(msgId, id);
41
+ this.intToMsgId.set(id, msgId);
42
+ if (peer !== void 0) this.msgIdToPeer.set(msgId, peer);
43
+ this.freed.delete(id);
44
+ return id;
45
+ }
46
+ /** OB11 message_id → NT msgId。 */
47
+ getMsgId(messageId) {
48
+ return this.intToMsgId.get(messageId);
49
+ }
50
+ /** NT msgId → OB11 message_id(未分配返回 undefined)。 */
51
+ getMessageId(msgId) {
52
+ return this.msgIdToInt.get(msgId);
53
+ }
54
+ /** NT msgId → Peer(alloc 时未记录返回 undefined)。 */
55
+ getPeer(msgId) {
56
+ return this.msgIdToPeer.get(msgId);
57
+ }
58
+ /** 释放 NT msgId 占用的槽位(消息过期/删除时调用,可选)。 */
59
+ release(msgId) {
60
+ const id = this.msgIdToInt.get(msgId);
61
+ if (id === void 0) return;
62
+ this.msgIdToInt.delete(msgId);
63
+ this.intToMsgId.delete(id);
64
+ this.msgIdToPeer.delete(msgId);
65
+ this.freed.add(id);
66
+ }
67
+ /** 取下一个可用 id:优先释放池,否则递增(溢出后线性扫描空洞)。 */
68
+ nextFreeId() {
69
+ for (const id of this.freed) return id;
70
+ if (this.cursor > INT32_MAX) {
71
+ for (let i = INT32_MIN; i <= INT32_MAX; i += 1) if (!this.intToMsgId.has(i)) {
72
+ this.cursor = i + 1;
73
+ return i;
74
+ }
75
+ throw kernelError("MessageUnique 槽位耗尽(>2^31 条消息)", "INVALID_STATE");
76
+ }
77
+ const id = this.cursor;
78
+ this.cursor += 1;
79
+ return id;
80
+ }
81
+ };
82
+ /**
83
+ * 从 OB11 message_id 反查 NT msgId + Peer。
84
+ * delete_msg / get_msg / set_msg_emoji_like / fetch_ptt_text / 精华消息等
85
+ * 只有 message_id 参数的动作共用(消息不存在抛 KernelError NOT_FOUND)。
86
+ */
87
+ function resolveMsgIdAndPeer(messageId, unique) {
88
+ let shortId;
89
+ if (typeof messageId === "number") shortId = messageId;
90
+ else shortId = Number(messageId);
91
+ const msgId = unique.getMsgId(shortId);
92
+ if (msgId === void 0) throw kernelError(`消息 ${messageId} 不存在`, "NOT_FOUND");
93
+ const peer = unique.getPeer(msgId);
94
+ if (peer === void 0) throw kernelError(`消息 ${messageId} 无会话记录`, "NOT_FOUND");
95
+ return {
96
+ msgId,
97
+ peer
98
+ };
99
+ }
14
100
  // src/onebot11/action/base-action.ts
15
101
  /**
16
102
  * OB11 动作运行时:声明式动作工厂 + 响应信封 + 错误码映射 + 共享解析助手。
@@ -71,6 +157,32 @@ async function resolveUid(uin, uinToUid) {
71
157
  if (uid === void 0) throw kernelError(`用户 ${uin} 的 uid 解析失败`, "INVALID_PARAM");
72
158
  return uid;
73
159
  }
160
+ /** 解析目标 Peer(group_id 直通;user_id 经 uin→uid)。 */
161
+ async function resolveTargetPeer(payload, deps, missingHint) {
162
+ if (payload.group_id !== void 0) return {
163
+ chatType: ChatType.GROUP,
164
+ peerUid: String(payload.group_id)
165
+ };
166
+ if (payload.user_id !== void 0) return {
167
+ chatType: ChatType.C2C,
168
+ peerUid: await resolveUid(String(payload.user_id), deps.uinToUid)
169
+ };
170
+ throw kernelError(missingHint, "INVALID_PARAM");
171
+ }
172
+ /**
173
+ * 按 message_id(OB11 int32 或 NT msgId)拉取单条消息。
174
+ * 消息不存在/已被撤回 → 抛 KernelError NOT_FOUND。
175
+ */
176
+ async function fetchMsgById(messageId, messageUnique, msgApi) {
177
+ const { msgId, peer } = resolveMsgIdAndPeer(messageId, messageUnique);
178
+ const [msg] = await msgApi.fetchMsgsByMsgId(peer, [msgId]);
179
+ if (msg === void 0) throw kernelError(`消息 ${messageId} 不存在或已被撤回`, "NOT_FOUND");
180
+ return {
181
+ msg,
182
+ peer,
183
+ msgId
184
+ };
185
+ }
74
186
  // src/onebot11/action/friend/manage.ts
75
187
  /**
76
188
  * 好友管理域动作
@@ -195,93 +307,6 @@ no_cache: z.boolean().optional() }),
195
307
  })
196
308
  ];
197
309
  }
198
- // src/onebot11/helper/message-unique.ts
199
- /** OB11 message_id 上限(int32 max = 0x7FFF_FFFF)。 */
200
- const INT32_MAX = 2147483647;
201
- /** int32 下限。 */
202
- const INT32_MIN = 1;
203
- var MessageUnique = class {
204
- /** NT msgId → OB11 message_id。 */
205
- msgIdToInt = /* @__PURE__ */ new Map();
206
- /** OB11 message_id → NT msgId。 */
207
- intToMsgId = /* @__PURE__ */ new Map();
208
- /** NT msgId → Peer(delete_msg / get_msg 等只有 message_id 时反查用)。 */
209
- msgIdToPeer = /* @__PURE__ */ new Map();
210
- /** 递增计数器。 */
211
- cursor = 1;
212
- /** 已释放的槽位(可复用)。 */
213
- freed = /* @__PURE__ */ new Set();
214
- /**
215
- * 为新 NT 消息分配 OB11 message_id(幂等:同一 msgId 返回同一 id)。
216
- * peer 可选:传入则记录,供 message_id → peer 反查。
217
- */
218
- alloc(msgId, peer) {
219
- const existing = this.msgIdToInt.get(msgId);
220
- if (existing !== void 0) {
221
- if (peer !== void 0) this.msgIdToPeer.set(msgId, peer);
222
- return existing;
223
- }
224
- const id = this.nextFreeId();
225
- this.msgIdToInt.set(msgId, id);
226
- this.intToMsgId.set(id, msgId);
227
- if (peer !== void 0) this.msgIdToPeer.set(msgId, peer);
228
- this.freed.delete(id);
229
- return id;
230
- }
231
- /** OB11 message_id → NT msgId。 */
232
- getMsgId(messageId) {
233
- return this.intToMsgId.get(messageId);
234
- }
235
- /** NT msgId → OB11 message_id(未分配返回 undefined)。 */
236
- getMessageId(msgId) {
237
- return this.msgIdToInt.get(msgId);
238
- }
239
- /** NT msgId → Peer(alloc 时未记录返回 undefined)。 */
240
- getPeer(msgId) {
241
- return this.msgIdToPeer.get(msgId);
242
- }
243
- /** 释放 NT msgId 占用的槽位(消息过期/删除时调用,可选)。 */
244
- release(msgId) {
245
- const id = this.msgIdToInt.get(msgId);
246
- if (id === void 0) return;
247
- this.msgIdToInt.delete(msgId);
248
- this.intToMsgId.delete(id);
249
- this.msgIdToPeer.delete(msgId);
250
- this.freed.add(id);
251
- }
252
- /** 取下一个可用 id:优先释放池,否则递增(溢出后线性扫描空洞)。 */
253
- nextFreeId() {
254
- for (const id of this.freed) return id;
255
- if (this.cursor > INT32_MAX) {
256
- for (let i = INT32_MIN; i <= INT32_MAX; i += 1) if (!this.intToMsgId.has(i)) {
257
- this.cursor = i + 1;
258
- return i;
259
- }
260
- throw kernelError("MessageUnique 槽位耗尽(>2^31 条消息)", "INVALID_STATE");
261
- }
262
- const id = this.cursor;
263
- this.cursor += 1;
264
- return id;
265
- }
266
- };
267
- /**
268
- * 从 OB11 message_id 反查 NT msgId + Peer。
269
- * delete_msg / get_msg / set_msg_emoji_like / fetch_ptt_text / 精华消息等
270
- * 只有 message_id 参数的动作共用(消息不存在抛 KernelError NOT_FOUND)。
271
- */
272
- function resolveMsgIdAndPeer(messageId, unique) {
273
- let shortId;
274
- if (typeof messageId === "number") shortId = messageId;
275
- else shortId = Number(messageId);
276
- const msgId = unique.getMsgId(shortId);
277
- if (msgId === void 0) throw kernelError(`消息 ${messageId} 不存在`, "NOT_FOUND");
278
- const peer = unique.getPeer(msgId);
279
- if (peer === void 0) throw kernelError(`消息 ${messageId} 无会话记录`, "NOT_FOUND");
280
- return {
281
- msgId,
282
- peer
283
- };
284
- }
285
310
  // src/onebot11/action/group/essence.ts
286
311
  /**
287
312
  * 群精华/荣誉域动作
@@ -373,98 +398,10 @@ function createGroupEssenceActions(api) {
373
398
  })
374
399
  ];
375
400
  }
376
- // src/onebot11/action/group/get-group-system-msg.ts
377
- /** 默认获取数量。 */
378
- const DEFAULT_COUNT$1 = 50;
379
- /** 收集全部涉及的 uid 批量转 uin(循环外一次请求)。 */
380
- async function collectUinMap(api, notifies) {
381
- const uids = [];
382
- for (const notify of notifies) {
383
- const { user1, user2 } = notify;
384
- if (user1 !== void 0) {
385
- const { uid } = user1;
386
- if (uid !== "") uids.push(uid);
387
- }
388
- if (user2 !== void 0) {
389
- const { uid } = user2;
390
- if (uid !== "") uids.push(uid);
391
- }
392
- }
393
- if (uids.length === 0) return /* @__PURE__ */ new Map();
394
- return await api.uidToUin(uids);
395
- }
396
- /** GroupNotify → OB11 群系统消息结构(纯函数,uin 已批量转换)。 */
397
- function toMessageInfo(notify, uinMap) {
398
- const { seq, status, postscript, user1, user2, group } = notify;
399
- let user1Uid = "";
400
- if (user1 !== void 0) {
401
- const { uid } = user1;
402
- user1Uid = uid;
403
- }
404
- let user2Uid = "";
405
- if (user2 !== void 0) {
406
- const { uid } = user2;
407
- user2Uid = uid;
408
- }
409
- let groupCode = 0;
410
- let groupName = "";
411
- if (group !== void 0) {
412
- const { groupCode: code, groupName: name } = group;
413
- groupCode = Number(code);
414
- groupName = name;
415
- }
416
- let invitorUin = Number(user1Uid);
417
- const mapped1 = uinMap.get(user1Uid);
418
- if (mapped1 !== void 0) invitorUin = Number(mapped1);
419
- let actor = Number(user2Uid);
420
- const mapped2 = uinMap.get(user2Uid);
421
- if (mapped2 !== void 0) actor = Number(mapped2);
422
- let invitorNick = "";
423
- if (user1 !== void 0) {
424
- const { nickName } = user1;
425
- invitorNick = nickName;
426
- }
427
- return {
428
- request_id: Number(seq),
429
- invitor_uin: invitorUin,
430
- invitor_nick: invitorNick,
431
- group_id: groupCode,
432
- message: postscript ?? "",
433
- group_name: groupName,
434
- checked: status !== 1,
435
- actor,
436
- requester_nick: invitorNick
437
- };
438
- }
439
- /** 群系统消息动作工厂(get_group_system_msg)。 */
440
- function createGroupSystemMsgActions(api) {
441
- return [defineOb11Action({
442
- name: "get_group_system_msg",
443
- schema: z.object({ count: z.number().optional() }),
444
- handle: async (payload) => {
445
- const count = payload.count ?? DEFAULT_COUNT$1;
446
- const notifies = await api.groupNotifyApi.getSingleScreenNotifies(false, count);
447
- const uinMap = await collectUinMap(api, notifies);
448
- const invited = [];
449
- const joined = [];
450
- for (const notify of notifies) {
451
- const info = toMessageInfo(notify, uinMap);
452
- if (notify.type === GroupNotifyMsgType.INVITED_BY_MEMBER) invited.push(info);
453
- else if (notify.type === GroupNotifyMsgType.REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS) joined.push(info);
454
- }
455
- const result = {
456
- invited_requests: invited,
457
- join_requests: joined
458
- };
459
- result["InvitedRequest"] = invited;
460
- return result;
461
- }
462
- })];
463
- }
464
401
  // src/onebot11/action/limits.ts
465
402
  /** 批量翻译的词条上限(translate_en2zh)。 */
466
403
  const MAX_TRANSLATE_WORDS = 2e3;
467
- // src/onebot11/action/group/group-files-op.ts
404
+ // src/onebot11/action/group/files-op.ts
468
405
  /**
469
406
  * 群文件操作动作:create_group_file_folder / delete_group_file /
470
407
  * delete_group_folder / rename_group_file / move_group_file / trans_group_file
@@ -547,7 +484,7 @@ function createGroupFileOpActions(api) {
547
484
  })
548
485
  ];
549
486
  }
550
- // src/onebot11/action/group/group-files-query.ts
487
+ // src/onebot11/action/group/files-query.ts
551
488
  /** 默认文件数量。 */
552
489
  const DEFAULT_FILE_COUNT = 50;
553
490
  /** 列表拆分 files/folders(fileInfo/folderInfo 取其一,纯函数)。 */
@@ -581,7 +518,7 @@ function toGroupFileInfo(file) {
581
518
  if (file.modifyTime !== void 0) out.modify_time = file.modifyTime;
582
519
  return out;
583
520
  }
584
- /** KernelFolderInfo → OB11 文件夹结构(纯函数)。 */
521
+ /** GroupFolderInfo → OB11 文件夹结构(纯函数)。 */
585
522
  function toGroupFolderInfo(folder) {
586
523
  return {
587
524
  folder_id: folder.folderId,
@@ -756,7 +693,7 @@ function createGroupManageActions(api) {
756
693
  */
757
694
  const getGroupAddRequestSchema = z.object({ count: z.number().optional() });
758
695
  /** 默认获取数量。 */
759
- const DEFAULT_COUNT = 100;
696
+ const DEFAULT_COUNT$1 = 100;
760
697
  /** GroupNotify → OB11 群请求项(纯函数)。 */
761
698
  function toGroupAddRequestItem(notify) {
762
699
  const { seq, type, status, postscript, user1, group } = notify;
@@ -799,14 +736,14 @@ function createGroupNotifyActions(api) {
799
736
  name: "get_group_add_request",
800
737
  schema: getGroupAddRequestSchema,
801
738
  handle: async (payload) => {
802
- return (await api.groupNotifyApi.getSingleScreenNotifies(false, payload.count ?? DEFAULT_COUNT)).map(toGroupAddRequestItem);
739
+ return (await api.groupNotifyApi.getSingleScreenNotifies(false, payload.count ?? DEFAULT_COUNT$1)).map(toGroupAddRequestItem);
803
740
  }
804
741
  }),
805
742
  defineOb11Action({
806
743
  name: "get_group_ignored_notifies",
807
744
  schema: getGroupAddRequestSchema,
808
745
  handle: async (payload) => {
809
- return (await api.groupNotifyApi.getSingleScreenNotifies(true, payload.count ?? DEFAULT_COUNT)).map(toGroupAddRequestItem);
746
+ return (await api.groupNotifyApi.getSingleScreenNotifies(true, payload.count ?? DEFAULT_COUNT$1)).map(toGroupAddRequestItem);
810
747
  }
811
748
  }),
812
749
  defineOb11Action({
@@ -818,7 +755,7 @@ function createGroupNotifyActions(api) {
818
755
  count: z.number().optional()
819
756
  }),
820
757
  handle: async (payload) => {
821
- const count = payload.count ?? DEFAULT_COUNT;
758
+ const count = payload.count ?? DEFAULT_COUNT$1;
822
759
  const notify = await findGroupNotify(api.groupNotifyApi, payload.flag, count);
823
760
  if (notify === null) throw kernelError("未找到对应的群请求(flag 无效或已过期)", "NOT_FOUND");
824
761
  let operateType = NTGroupRequestOperateTypes.KREFUSE;
@@ -982,6 +919,94 @@ no_cache: z.boolean().optional() }),
982
919
  })
983
920
  ];
984
921
  }
922
+ // src/onebot11/action/group/system-msg.ts
923
+ /** 默认获取数量。 */
924
+ const DEFAULT_COUNT = 50;
925
+ /** 收集全部涉及的 uid 批量转 uin(循环外一次请求)。 */
926
+ async function collectUinMap(api, notifies) {
927
+ const uids = [];
928
+ for (const notify of notifies) {
929
+ const { user1, user2 } = notify;
930
+ if (user1 !== void 0) {
931
+ const { uid } = user1;
932
+ if (uid !== "") uids.push(uid);
933
+ }
934
+ if (user2 !== void 0) {
935
+ const { uid } = user2;
936
+ if (uid !== "") uids.push(uid);
937
+ }
938
+ }
939
+ if (uids.length === 0) return /* @__PURE__ */ new Map();
940
+ return await api.uidToUin(uids);
941
+ }
942
+ /** GroupNotify → OB11 群系统消息结构(纯函数,uin 已批量转换)。 */
943
+ function toMessageInfo(notify, uinMap) {
944
+ const { seq, status, postscript, user1, user2, group } = notify;
945
+ let user1Uid = "";
946
+ if (user1 !== void 0) {
947
+ const { uid } = user1;
948
+ user1Uid = uid;
949
+ }
950
+ let user2Uid = "";
951
+ if (user2 !== void 0) {
952
+ const { uid } = user2;
953
+ user2Uid = uid;
954
+ }
955
+ let groupCode = 0;
956
+ let groupName = "";
957
+ if (group !== void 0) {
958
+ const { groupCode: code, groupName: name } = group;
959
+ groupCode = Number(code);
960
+ groupName = name;
961
+ }
962
+ let invitorUin = Number(user1Uid);
963
+ const mapped1 = uinMap.get(user1Uid);
964
+ if (mapped1 !== void 0) invitorUin = Number(mapped1);
965
+ let actor = Number(user2Uid);
966
+ const mapped2 = uinMap.get(user2Uid);
967
+ if (mapped2 !== void 0) actor = Number(mapped2);
968
+ let invitorNick = "";
969
+ if (user1 !== void 0) {
970
+ const { nickName } = user1;
971
+ invitorNick = nickName;
972
+ }
973
+ return {
974
+ request_id: Number(seq),
975
+ invitor_uin: invitorUin,
976
+ invitor_nick: invitorNick,
977
+ group_id: groupCode,
978
+ message: postscript ?? "",
979
+ group_name: groupName,
980
+ checked: status !== 1,
981
+ actor,
982
+ requester_nick: invitorNick
983
+ };
984
+ }
985
+ /** 群系统消息动作工厂(get_group_system_msg)。 */
986
+ function createGroupSystemMsgActions(api) {
987
+ return [defineOb11Action({
988
+ name: "get_group_system_msg",
989
+ schema: z.object({ count: z.number().optional() }),
990
+ handle: async (payload) => {
991
+ const count = payload.count ?? DEFAULT_COUNT;
992
+ const notifies = await api.groupNotifyApi.getSingleScreenNotifies(false, count);
993
+ const uinMap = await collectUinMap(api, notifies);
994
+ const invited = [];
995
+ const joined = [];
996
+ for (const notify of notifies) {
997
+ const info = toMessageInfo(notify, uinMap);
998
+ if (notify.type === GroupNotifyMsgType.INVITED_BY_MEMBER) invited.push(info);
999
+ else if (notify.type === GroupNotifyMsgType.REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS) joined.push(info);
1000
+ }
1001
+ const result = {
1002
+ invited_requests: invited,
1003
+ join_requests: joined
1004
+ };
1005
+ result["InvitedRequest"] = invited;
1006
+ return result;
1007
+ }
1008
+ })];
1009
+ }
985
1010
  // src/onebot11/helper/codec/cqcode.ts
986
1011
  /**
987
1012
  * CQ 码编解码(OneBot 11 消息段序列化格式)
@@ -1738,56 +1763,21 @@ function toOb11GroupRequestEvent(notify, ctx) {
1738
1763
  }
1739
1764
  /**
1740
1765
  * BuddyReq → OB11 好友请求事件(friend)。
1741
- * comment 取 words 字段(验证留言,形状待校准,缺省空串);flag = reqTime。
1766
+ * comment 取验证留言:QQNT 实际字段是 `extWords`,`words` 为旧口径兜底(都缺省空串);
1767
+ * flag = reqTime。
1742
1768
  */
1743
1769
  function toOb11FriendRequestEvent(req, ctx) {
1744
- const words = req["words"];
1770
+ const comment = firstNonEmptyString(stringOrUndefined(req["extWords"]), stringOrUndefined(req["words"])) ?? "";
1745
1771
  return {
1746
1772
  time: Math.floor(Date.now() / MS_TO_SEC),
1747
1773
  self_id: Number(ctx.selfUin),
1748
1774
  post_type: "request",
1749
1775
  request_type: "friend",
1750
1776
  user_id: toUin(req.friendUid, ctx),
1751
- comment: typeof words === "string" ? words : "",
1777
+ comment,
1752
1778
  flag: req.reqTime
1753
1779
  };
1754
1780
  }
1755
- // src/onebot11/action/message/resolve-peer.ts
1756
- /**
1757
- * OB11 目标 Peer 解析 / 单条消息拉取(多个动作共用)
1758
- *
1759
- * group_id 直通(群消息 peerUid = 群号);user_id 经 uin→uid 解析。
1760
- */
1761
- /** 解析目标 Peer(group_id 直通;user_id 经 uin→uid)。 */
1762
- async function resolveTargetPeer(payload, deps, missingHint) {
1763
- if (payload.group_id !== void 0) return {
1764
- chatType: ChatType.GROUP,
1765
- peerUid: String(payload.group_id)
1766
- };
1767
- if (payload.user_id !== void 0) {
1768
- const uid = (await deps.uinToUid([String(payload.user_id)])).get(String(payload.user_id));
1769
- if (uid === void 0) throw kernelError(`用户 ${payload.user_id} 的 uid 解析失败`, "INVALID_PARAM");
1770
- return {
1771
- chatType: ChatType.C2C,
1772
- peerUid: uid
1773
- };
1774
- }
1775
- throw kernelError(missingHint, "INVALID_PARAM");
1776
- }
1777
- /**
1778
- * 按 message_id(OB11 int32 或 NT msgId)拉取单条消息。
1779
- * 消息不存在/已被撤回 → 抛 KernelError NOT_FOUND。
1780
- */
1781
- async function fetchMsgById(messageId, messageUnique, msgApi) {
1782
- const { msgId, peer } = resolveMsgIdAndPeer(messageId, messageUnique);
1783
- const [msg] = await msgApi.fetchMsgsByMsgId(peer, [msgId]);
1784
- if (msg === void 0) throw kernelError(`消息 ${messageId} 不存在或已被撤回`, "NOT_FOUND");
1785
- return {
1786
- msg,
1787
- peer,
1788
- msgId
1789
- };
1790
- }
1791
1781
  // src/onebot11/action/message/forward.ts
1792
1782
  /**
1793
1783
  * 消息转发域动作
@@ -1954,7 +1944,7 @@ async function fetchAndTranslateHistory(peer, messageSeq, count, deps) {
1954
1944
  } catch (err) {
1955
1945
  deps.logger?.warn({
1956
1946
  count: atUids.size,
1957
- error: err instanceof Error ? err.message : String(err)
1947
+ error: errorMessage(err)
1958
1948
  }, "ob11: 历史消息 at uid→uin 失败,at 原样");
1959
1949
  }
1960
1950
  const ctx = {
@@ -1994,7 +1984,7 @@ function createHistoryActions(api) {
1994
1984
  } catch (err) {
1995
1985
  api.logger?.warn({
1996
1986
  count: atUids.length,
1997
- error: err instanceof Error ? err.message : String(err)
1987
+ error: errorMessage(err)
1998
1988
  }, "ob11: get_msg at uid→uin 失败,at 原样");
1999
1989
  }
2000
1990
  const senderRole = msg.chatType === ChatType.GROUP ? await api.groupMemberRole(msg.peerUid, msg.senderUid) : void 0;
@@ -2070,7 +2060,6 @@ async function downloadImageToCache(url, deps) {
2070
2060
  const cacheDir = deps.cacheDir;
2071
2061
  if (cacheDir === void 0 || cacheDir === "") return null;
2072
2062
  const mediaDir = join(cacheDir, "media");
2073
- const { mkdir } = await import("node:fs/promises");
2074
2063
  await mkdir(mediaDir, { recursive: true });
2075
2064
  const dest = join(mediaDir, `${randomUUID()}${inferExtension(null, url)}`);
2076
2065
  try {
@@ -2079,7 +2068,7 @@ async function downloadImageToCache(url, deps) {
2079
2068
  } catch (err) {
2080
2069
  deps.logger?.warn({
2081
2070
  url,
2082
- error: err instanceof Error ? err.message : String(err)
2071
+ error: errorMessage(err)
2083
2072
  }, "ob11: 图片主动下载失败,get_image 退原始 url");
2084
2073
  return null;
2085
2074
  }
@@ -2135,7 +2124,7 @@ async function downloadPttFallback(msgId, peer, id, deps) {
2135
2124
  } catch (err) {
2136
2125
  deps.logger?.warn({
2137
2126
  message_id: id,
2138
- error: err instanceof Error ? err.message : String(err)
2127
+ error: errorMessage(err)
2139
2128
  }, "ob11: 语音原生下载失败,get_record 回退原始路径");
2140
2129
  }
2141
2130
  return null;
@@ -2346,7 +2335,7 @@ async function sendOb11Message(payload, deps) {
2346
2335
  } catch (err) {
2347
2336
  deps.logger?.warn({
2348
2337
  count: atUins.length,
2349
- error: err instanceof Error ? err.message : String(err)
2338
+ error: errorMessage(err)
2350
2339
  }, "ob11: at uin→uid 失败,at 段原样发送");
2351
2340
  }
2352
2341
  canonical = applySendContext(canonical, {
@@ -2443,11 +2432,7 @@ async function downloadAvatarToCache(url, cacheDir) {
2443
2432
  if (cacheDir === void 0 || cacheDir === "") throw kernelError("set_qq_avatar 处理 URL 需要缓存目录(装配方未注入)", "INVALID_STATE");
2444
2433
  const safeName = basename(new URL(url).pathname) || "avatar.bin";
2445
2434
  const filePath = join(cacheDir, `avatar-${Date.now()}-${safeName}`);
2446
- const res = await fetch(url);
2447
- if (!res.ok) throw new Error(`头像下载失败: ${res.status} ${res.statusText}`);
2448
- const buf = new Uint8Array(await res.arrayBuffer());
2449
- writeFileSync(filePath, buf);
2450
- return filePath;
2435
+ return await downloadBufferToFile(url, filePath, void 0, "头像下载失败");
2451
2436
  }
2452
2437
  /**
2453
2438
  * 账号票据与资料域动作工厂(cookies / clientkey / csrf_token / credentials /
@@ -2549,8 +2534,6 @@ function createSystemAccountActions(api) {
2549
2534
  * 输入只接受本地路径与 `file://` URI:远程 `http(s)://` / `base64://` 需要下载缓存与媒体
2550
2535
  * 依赖,当前未接(明确报错,不静默失败)。
2551
2536
  */
2552
- /** file:// 前缀(fileURLToPath 失败时的裸剥离兜底)。 */
2553
- const FILE_URI_PREFIX_RE = /^file:\/\//;
2554
2537
  /** 路径分隔符(取文件名用)。 */
2555
2538
  const PATH_SEPARATORS = /[\\/]/;
2556
2539
  const downloadFileSchema = z.object({
@@ -2573,11 +2556,7 @@ const uploadPrivateFileSchema = z.object({
2573
2556
  /** 本地路径 / file:// 展开;远程 URI 明确拒绝(未接下载缓存)。 */
2574
2557
  function resolveLocalFile(file) {
2575
2558
  if (file.startsWith("http://") || file.startsWith("https://") || file.startsWith("base64://")) throw kernelError("upload_group_file/upload_private_file 目前只支持本地路径与 file:// URI(远程 URI 需要下载缓存,未接入)", "INVALID_PARAM");
2576
- if (file.startsWith("file://")) try {
2577
- return fileURLToPath(file);
2578
- } catch {
2579
- return file.replace(FILE_URI_PREFIX_RE, "");
2580
- }
2559
+ if (file.startsWith("file://")) return fileUriToPath(file);
2581
2560
  return file;
2582
2561
  }
2583
2562
  /** 取路径末段作为缺省文件集名(卡片标题)。 */
@@ -2597,13 +2576,9 @@ function createSystemFileActions(api) {
2597
2576
  if (cacheDir === void 0 || cacheDir === "") throw kernelError("download_file 未配置缓存目录(装配方未注入)", "INVALID_STATE");
2598
2577
  const safeName = basename(new URL(payload.url).pathname) || "download.bin";
2599
2578
  const filePath = join(cacheDir, `download-${Date.now()}-${safeName}`);
2600
- mkdirSync(cacheDir, { recursive: true });
2601
2579
  const init = {};
2602
2580
  if (payload.headers !== void 0) init.headers = payload.headers;
2603
- const res = await fetch(payload.url, init);
2604
- if (!res.ok) throw new Error(`下载失败: ${res.status} ${res.statusText}`);
2605
- const buf = new Uint8Array(await res.arrayBuffer());
2606
- writeFileSync(filePath, buf);
2581
+ await downloadBufferToFile(payload.url, filePath, init);
2607
2582
  return { file: filePath };
2608
2583
  }
2609
2584
  }),
@@ -2846,7 +2821,7 @@ function createOb11ActionRegistry(deps) {
2846
2821
  for (const factory of ACTION_FACTORIES) for (const action of factory(deps.api)) registry.register(action);
2847
2822
  return registry;
2848
2823
  }
2849
- // src/onebot11/api/one-bot-api.ts
2824
+ // src/onebot11/api/onebot-api.ts
2850
2825
  /**
2851
2826
  * OneBot 11 动作统一依赖聚合。
2852
2827
  * 各动作经 `Pick<OneBotApi, ...>` 取所需成员;注册处只构造一次本对象。
@@ -2943,7 +2918,7 @@ var OneBotApi = class {
2943
2918
  this.logger?.warn({
2944
2919
  group: groupCode,
2945
2920
  uid,
2946
- error: err instanceof Error ? err.message : String(err)
2921
+ error: errorMessage(err)
2947
2922
  }, "ob11: 群成员缓存读取失败,sender.role 回退 member");
2948
2923
  return;
2949
2924
  }
@@ -2961,13 +2936,15 @@ var OneBotApi = class {
2961
2936
  } catch (err) {
2962
2937
  this.logger?.warn({
2963
2938
  group: groupCode,
2964
- error: err instanceof Error ? err.message : String(err)
2939
+ error: errorMessage(err)
2965
2940
  }, "ob11: 群成员表缓存读取失败,历史 role 回退 member");
2966
2941
  return;
2967
2942
  }
2968
2943
  }
2969
2944
  };
2970
2945
  // src/onebot11/enrichment.ts
2946
+ /** 资料详情兜底的单批上限(好友申请批通常只有个位数,超限多为历史积压)。 */
2947
+ const MAX_PROFILE_LOOKUPS = 10;
2971
2948
  /** OB11 收链路异步回填器。 */
2972
2949
  var Ob11Enrichment = class {
2973
2950
  api;
@@ -2976,18 +2953,44 @@ var Ob11Enrichment = class {
2976
2953
  this.api = deps.api;
2977
2954
  this.calibLogger = deps.logger;
2978
2955
  }
2979
- /** uid 批量 → uin(失败退空 Map:翻译层退化为 uid 数值,不阻塞请求上报)。 */
2956
+ /**
2957
+ * uid 批量 → uin(失败退空 Map:翻译层退化为 uid 数值,不阻塞请求上报)。
2958
+ *
2959
+ * 群成员口径(`getUinByUids`)解析不到的 uid 用资料详情兜底(issue #122):
2960
+ * 好友申请的申请人通常不在任何群里,群口径必然失败,不回退会让 `user_id` 恒 0。
2961
+ */
2980
2962
  async uidToUinMap(uids) {
2981
2963
  if (uids.length === 0) return /* @__PURE__ */ new Map();
2964
+ let map;
2982
2965
  try {
2983
- return await this.api.uidToUin(uids);
2966
+ map = await this.api.uidToUin(uids);
2984
2967
  } catch (err) {
2985
2968
  this.calibLogger?.warn({
2986
2969
  count: uids.length,
2987
- error: err instanceof Error ? err.message : String(err)
2970
+ error: errorMessage(err)
2988
2971
  }, "ob11: 请求 uid→uin 批量转换失败,退用 uid");
2989
- return /* @__PURE__ */ new Map();
2972
+ map = /* @__PURE__ */ new Map();
2973
+ }
2974
+ await this.fillMissingUins(uids, map);
2975
+ return map;
2976
+ }
2977
+ /**
2978
+ * 群口径未命中的 uid 逐个走 `profileApi.getUinByUid` 兜底(原地补 map)。
2979
+ * fail-soft:单条失败 / 查不到保持未命中(翻译层退 0);条数设上限,防历史积压
2980
+ * 批次把逐条 IPC 打满。
2981
+ */
2982
+ async fillMissingUins(uids, map) {
2983
+ const missing = [...new Set(uids)].filter((uid) => uid !== "" && !map.has(uid));
2984
+ for (const uid of missing.slice(0, MAX_PROFILE_LOOKUPS)) try {
2985
+ const uin = await this.api.profileApi.getUinByUid(uid);
2986
+ if (uin !== null) map.set(uid, uin);
2987
+ } catch (err) {
2988
+ this.calibLogger?.debug({ error: errorMessage(err) }, "ob11: uid→uin 资料兜底失败(该 uid 退 0)");
2990
2989
  }
2990
+ if (missing.length > MAX_PROFILE_LOOKUPS) this.calibLogger?.debug({
2991
+ missing: missing.length,
2992
+ limit: MAX_PROFILE_LOOKUPS
2993
+ }, "ob11: 待兜底 uid 超上限,其余保持未命中");
2991
2994
  }
2992
2995
  /**
2993
2996
  * notice uid 批量转换(空集退空 Map)。失败上抛不吞:grayTip 解析宽容但
@@ -3010,7 +3013,7 @@ var Ob11Enrichment = class {
3010
3013
  } catch (err) {
3011
3014
  this.calibLogger?.warn({
3012
3015
  count: atUids.length,
3013
- error: err instanceof Error ? err.message : String(err)
3016
+ error: errorMessage(err)
3014
3017
  }, "ob11: 消息 at uid→uin 失败,at 原样");
3015
3018
  }
3016
3019
  const senderRole = msg.chatType === ChatType.GROUP ? await this.api.groupMemberRole(msg.peerUid, msg.senderUid) : void 0;
@@ -3033,7 +3036,7 @@ var Ob11Enrichment = class {
3033
3036
  msgType: env.msgType,
3034
3037
  subType: env.subType,
3035
3038
  count: uids.length,
3036
- error: err instanceof Error ? err.message : String(err)
3039
+ error: errorMessage(err)
3037
3040
  }, "ob11: sysmsg uid→uin 失败,实体 uin 恒 0");
3038
3041
  return () => 0;
3039
3042
  }
@@ -3051,7 +3054,7 @@ var Ob11Enrichment = class {
3051
3054
  const hit = (await this.api.msgApi.fetchMessages(peer, { count: 60 }).catch((err) => {
3052
3055
  this.calibLogger?.debug({
3053
3056
  group: groupCode,
3054
- error: err instanceof Error ? err.message : String(err)
3057
+ error: errorMessage(err)
3055
3058
  }, "ob11: 精华反查近段历史拉取失败");
3056
3059
  return [];
3057
3060
  })).find((m) => Number(m.msgSeq) === seq);
@@ -3322,7 +3325,7 @@ var Ob11InboundMessage = class {
3322
3325
  handleRawMessage(msg) {
3323
3326
  if (hasGrayTip(msg)) {
3324
3327
  this.broadcastNotice(msg).catch((err) => {
3325
- this.deps.logger?.debug({ err: err instanceof Error ? err.message : String(err) }, "ob11: notice 翻译失败(整个事件丢弃)");
3328
+ this.deps.logger?.debug({ err: errorMessage(err) }, "ob11: notice 翻译失败(整个事件丢弃)");
3326
3329
  });
3327
3330
  return;
3328
3331
  }
@@ -3358,9 +3361,17 @@ var Ob11InboundMessage = class {
3358
3361
  /** OB11 请求域处理器(群通知 / 好友申请的 uid 回填与广播)。 */
3359
3362
  var Ob11InboundRequest = class {
3360
3363
  deps;
3364
+ /** 已广播申请的 `${friendUid}:${reqTime}`(实例级,跨 reloadTransports 保留)。 */
3365
+ dedup = new BuddyReqDedup();
3366
+ /** 历史积压基准(订阅时刷新:重连后以此刻为界)。 */
3367
+ baselineSec = startupBaselineSec();
3361
3368
  constructor(deps) {
3362
3369
  this.deps = deps;
3363
3370
  }
3371
+ /** 刷新启动基准(pipeline subscribe 时调用)。 */
3372
+ markStartup() {
3373
+ this.baselineSec = startupBaselineSec();
3374
+ }
3364
3375
  /** 群系统通知 → group request 事件(批量 uidToUin 后翻译,纯函数)。 */
3365
3376
  async groupNotifies(doubt, notifies) {
3366
3377
  if (doubt || !Array.isArray(notifies)) return;
@@ -3376,13 +3387,23 @@ var Ob11InboundRequest = class {
3376
3387
  }
3377
3388
  /** 好友申请翻译派发(flag=reqTime;uid→uin 批量失败退空 Map)。 */
3378
3389
  async broadcastBuddyReqs(arg) {
3390
+ if (batchUnreadNums(arg) === 0) {
3391
+ this.deps.logger?.debug({}, "ob11: onBuddyReqChange unreadNums=0(整批跳过)");
3392
+ return;
3393
+ }
3379
3394
  const reqs = narrowBuddyReqs(arg);
3380
3395
  if (reqs === null) {
3381
3396
  this.deps.logger?.warn({ raw: truncRaw(JSON.stringify(arg)) }, "ob11: onBuddyReqChange 未知参数形状");
3382
3397
  return;
3383
3398
  }
3384
- const ctx = await this.requestCtx(reqs.map((r) => r.friendUid).filter((uid) => uid !== ""));
3385
- for (const req of reqs) this.deps.broadcast(toOb11FriendRequestEvent(req, ctx));
3399
+ const fresh = filterBuddyReqs(reqs, this.baselineSec).filter((req) => this.dedup.claim(req));
3400
+ if (fresh.length < reqs.length) this.deps.logger?.debug({
3401
+ total: reqs.length,
3402
+ kept: fresh.length
3403
+ }, "ob11: 好友申请过滤(历史积压 / 已读 / 已处理 / 重复)");
3404
+ if (fresh.length === 0) return;
3405
+ const ctx = await this.requestCtx(fresh.map((r) => r.friendUid).filter((uid) => uid !== ""));
3406
+ for (const req of fresh) this.deps.broadcast(toOb11FriendRequestEvent(req, ctx));
3386
3407
  }
3387
3408
  /** request 翻译上下文(uid→uin 批量;失败退空 Map 不阻塞上报)。 */
3388
3409
  async requestCtx(uids) {
@@ -3406,14 +3427,12 @@ function collectGroupNotifyUids(notifies) {
3406
3427
  * 本模块只保留 OB11 侧内容:
3407
3428
  * - SysMsgNoticeKind:sysmsg 可映射的 OB11 notice 种类(event/notice.ts 既有类型)
3408
3429
  * - KIND_TABLE:(msgType, subType) → 规则(键 = 原生分发键)
3409
- * - OBSERVED_UNNAMED:已观测但未命名的键(不广播,防校准日志噪音)
3430
+ * - OBSERVED_UNNAMED_SYSMSG_KEYS:已观测但未命名的键(不广播,防校准日志噪音)
3410
3431
  * - recognizeSysMsg:绑定 OB11 表的识别入口
3411
3432
  *
3412
3433
  * 解码原语(decodeProtoTree / extractSysMsgEnvelope / narrowSysMsgBlobs 等)
3413
3434
  * 从 `shared/sysmsg.js` 导入使用。
3414
3435
  */
3415
- /** 群号判别(strings[0] 必须是数字串)。 */
3416
- const NUMERIC_RE = /^\d+$/;
3417
3436
  /**
3418
3437
  * (msgType, subType) → 规则表(键 = 原生分发键,design.md §7.1)。
3419
3438
  *
@@ -3442,15 +3461,9 @@ const KIND_TABLE = /* @__PURE__ */ new Map([["732:21", {
3442
3461
  };
3443
3462
  }
3444
3463
  }]]);
3445
- /** 已观测但未命名的 (msgType, subType)(语义未知,不广播)。 */
3446
- const OBSERVED_UNNAMED = /* @__PURE__ */ new Set([
3447
- "528:382",
3448
- "528:349",
3449
- "528:381"
3450
- ]);
3451
3464
  /** (msgType, subType) → 识别结果(绑定 OB11 表;table 参数供单测注入合成规则)。 */
3452
3465
  function recognizeOb11SysMsg(msgType, subType, table = KIND_TABLE) {
3453
- return recognizeSysMsg(msgType, subType, table, OBSERVED_UNNAMED);
3466
+ return recognizeSysMsg(msgType, subType, table, OBSERVED_UNNAMED_SYSMSG_KEYS);
3454
3467
  }
3455
3468
  // src/onebot11/inbound/sysmsg.ts
3456
3469
  /**
@@ -3502,6 +3515,10 @@ var Ob11InboundSysMsg = class {
3502
3515
  }
3503
3516
  };
3504
3517
  // src/onebot11/event-pipeline.ts
3518
+ /**
3519
+ * OB11 收链路订阅接线板:管理 unsubscribes 与 kernel 频道 → 领域处理器路由;
3520
+ * 域处理在 inbound/,异步回填在 enrichment.ts。
3521
+ */
3505
3522
  var Ob11EventPipeline = class {
3506
3523
  deps;
3507
3524
  essence;
@@ -3541,8 +3558,9 @@ var Ob11EventPipeline = class {
3541
3558
  /** 订阅 kernel 事件(消息 + 群 + 好友 + 好友缓存,幂等;路由到 inbound/)。 */
3542
3559
  subscribe() {
3543
3560
  if (this.unsubscribes.length > 0) return;
3561
+ this.request.markStartup();
3544
3562
  const { msgChannel, groupChannel, friendChannel, buddyCacheEvents } = this.deps;
3545
- this.unsubscribes.push(subscribeRawMessages(msgChannel, (msg) => this.message.handleRawMessage(msg)), msgChannel.on("Msg/onRecvOfflineFileMsg", (a) => this.fileNotice.offlineFile(a)), msgChannel.on("Msg/onRecvSysMsg", (a) => this.sysMsg.handleRawArg(a)), msgChannel.on("Msg/onRecvOnlineFileMsg", (a) => this.fileNotice.onlineFile(a)));
3563
+ this.unsubscribes.push(subscribeRawMessages(msgChannel, (msg) => this.message.handleRawMessage(msg), { logger: this.deps.logger }), msgChannel.on("Msg/onRecvOfflineFileMsg", (a) => this.fileNotice.offlineFile(a)), msgChannel.on("Msg/onRecvSysMsg", (a) => this.sysMsg.handleRawArg(a)), msgChannel.on("Msg/onRecvOnlineFileMsg", (a) => this.fileNotice.onlineFile(a)));
3546
3564
  if (groupChannel !== void 0) this.unsubscribes.push(groupChannel.on("Group/onGroupNotifiesUpdated", (doubt, notifies) => {
3547
3565
  this.request.groupNotifies(doubt, notifies).catch((err) => logEventFailure(this.deps.logger, "ob11: group request 翻译失败(整批丢弃)", err));
3548
3566
  }), groupChannel.on("Group/onGroupEssenceListChange", (a) => this.essence.change(a)));