@napuketto/adapter 0.5.0 → 0.7.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.
@@ -0,0 +1,43 @@
1
+ //#region src/core/uid-uin.ts
2
+ /**
3
+ * uid → uin 解析(OB11 / Milky 请求与通知翻译共用,P1 2026-10-30 收敛)
4
+ *
5
+ * uidToUin 批量映射由调用方取得后传入;映射缺省退化为 uid 数值(wrapper 部分回调
6
+ * 直接给 uin),非数字返回 0(调用方按 0 兜底展示)。
7
+ *
8
+ * request 事件翻译上下文与毫秒换算常量随本模块共享(OB11 / Milky request 同构)。
9
+ */
10
+ /** 毫秒 → 秒(Unix 时间戳换算)。 */
11
+ const MS_TO_SEC = 1e3;
12
+ /** uid → uin(映射命中取 uin,未命中退化 uid 数值,非数字返回 0)。 */
13
+ function resolveUin(uid, uidToUin) {
14
+ if (uid === void 0 || uid === "") return 0;
15
+ const uin = uidToUin.get(uid);
16
+ if (uin !== void 0) return Number(uin);
17
+ const n = Number(uid);
18
+ return Number.isFinite(n) ? n : 0;
19
+ }
20
+ //#endregion
21
+ //#region src/core/buddy-req.ts
22
+ /** BuddyReq 防御性收窄:仅接受字段形状可用的对象。 */
23
+ function isBuddyReqLike(value) {
24
+ if (typeof value !== "object" || value === null) return false;
25
+ const v = value;
26
+ return typeof v["reqTime"] === "string" && typeof v["friendUid"] === "string";
27
+ }
28
+ /**
29
+ * onBuddyReqChange 回调参数 → BuddyReq 列表(防御性收窄)。
30
+ * 已知候选形状:BuddyReq[] / { buddyReqs: BuddyReq[] };其余返回 null。
31
+ */
32
+ function narrowBuddyReqs(arg) {
33
+ if (Array.isArray(arg)) return arg.every(isBuddyReqLike) ? arg : null;
34
+ if (typeof arg === "object" && arg !== null) {
35
+ const reqs = arg["buddyReqs"];
36
+ if (Array.isArray(reqs) && reqs.every(isBuddyReqLike)) return reqs;
37
+ }
38
+ return null;
39
+ }
40
+ //#endregion
41
+ export { MS_TO_SEC as n, resolveUin as r, narrowBuddyReqs as t };
42
+
43
+ //# sourceMappingURL=buddy-req-Q7Q4bVuz.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buddy-req-Q7Q4bVuz.mjs","names":[],"sources":["../src/core/uid-uin.ts","../src/core/buddy-req.ts"],"sourcesContent":["/**\n * uid → uin 解析(OB11 / Milky 请求与通知翻译共用,P1 2026-10-30 收敛)\n *\n * uidToUin 批量映射由调用方取得后传入;映射缺省退化为 uid 数值(wrapper 部分回调\n * 直接给 uin),非数字返回 0(调用方按 0 兜底展示)。\n *\n * request 事件翻译上下文与毫秒换算常量随本模块共享(OB11 / Milky request 同构)。\n */\n\n/** 毫秒 → 秒(Unix 时间戳换算)。 */\nexport const MS_TO_SEC = 1000;\n\n/** request 事件翻译上下文(uid→uin 映射,调用方批量转换)。 */\nexport interface RequestTranslateContext {\n selfUin: string;\n uidToUin: Map<string, string>;\n}\n\n/** uid → uin(映射命中取 uin,未命中退化 uid 数值,非数字返回 0)。 */\nexport function resolveUin(uid: string | undefined, uidToUin: Map<string, string>): number {\n if (uid === undefined || uid === \"\") {\n return 0;\n }\n const uin = uidToUin.get(uid);\n if (uin !== undefined) {\n return Number(uin);\n }\n const n = Number(uid);\n return Number.isFinite(n) ? n : 0;\n}\n","/**\n * BuddyReq 防御收窄(OB11 / Milky 共用,P1 2026-10-30 从 onebot11 收敛)\n *\n * onBuddyReqChange 回调参数形状未经真实事件校准(wrapper 字符串证据仅有方法名),\n * 仅接受字段形状可用的对象;未知形状返回 null 由调用方打 raw 日志积累校准数据。\n */\nimport type { BuddyReq } from \"@napuketto/kernel\";\n\n/** BuddyReq 防御性收窄:仅接受字段形状可用的对象。 */\nexport function isBuddyReqLike(value: unknown): value is BuddyReq {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const v = value as Record<string, unknown>;\n return typeof v[\"reqTime\"] === \"string\" && typeof v[\"friendUid\"] === \"string\";\n}\n\n/**\n * onBuddyReqChange 回调参数 → BuddyReq 列表(防御性收窄)。\n * 已知候选形状:BuddyReq[] / { buddyReqs: BuddyReq[] };其余返回 null。\n */\nexport function narrowBuddyReqs(arg: unknown): BuddyReq[] | null {\n if (Array.isArray(arg)) {\n return arg.every(isBuddyReqLike) ? (arg as BuddyReq[]) : null;\n }\n if (typeof arg === \"object\" && arg !== null) {\n const reqs = (arg as Record<string, unknown>)[\"buddyReqs\"];\n if (Array.isArray(reqs) && reqs.every(isBuddyReqLike)) {\n return reqs as BuddyReq[];\n }\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,YAAY;;AASzB,SAAgB,WAAW,KAAyB,UAAuC;CACvF,IAAI,QAAQ,KAAA,KAAa,QAAQ,IAC7B,OAAO;CAEX,MAAM,MAAM,SAAS,IAAI,GAAG;CAC5B,IAAI,QAAQ,KAAA,GACR,OAAO,OAAO,GAAG;CAErB,MAAM,IAAI,OAAO,GAAG;CACpB,OAAO,OAAO,SAAS,CAAC,IAAI,IAAI;AACpC;;;;ACpBA,SAAgB,eAAe,OAAmC;CAC9D,IAAI,OAAO,UAAU,YAAY,UAAU,MACvC,OAAO;CAEX,MAAM,IAAI;CACV,OAAO,OAAO,EAAE,eAAe,YAAY,OAAO,EAAE,iBAAiB;AACzE;;;;;AAMA,SAAgB,gBAAgB,KAAiC;CAC7D,IAAI,MAAM,QAAQ,GAAG,GACjB,OAAO,IAAI,MAAM,cAAc,IAAK,MAAqB;CAE7D,IAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;EACzC,MAAM,OAAQ,IAAgC;EAC9C,IAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,MAAM,cAAc,GAChD,OAAO;CAEf;CACA,OAAO;AACX"}
@@ -0,0 +1,33 @@
1
+ //#region src/core/gray-tip.ts
2
+ /** 非空 uid 才加入集合。 */
3
+ function collectUids(uids, ...candidates) {
4
+ for (const uid of candidates) if (uid !== void 0 && uid !== "") uids.add(uid);
5
+ }
6
+ /** 收集 grayTip 涉及的 uid(批量 uidToUin 用)。 */
7
+ function collectGrayTipUids(msg) {
8
+ const uids = /* @__PURE__ */ new Set();
9
+ for (const el of msg.elements) {
10
+ const g = el.grayTipElement;
11
+ if (g === void 0) continue;
12
+ collectUids(uids, g.revokeElement?.operatorUid, g.aioOpGrayTipElement?.peerUid);
13
+ const grp = g.groupElement;
14
+ if (grp === void 0) continue;
15
+ collectUids(uids, grp.memberUid, grp.adminUid, grp.shutUp?.admin?.uid, grp.shutUp?.member?.uid);
16
+ }
17
+ return [...uids];
18
+ }
19
+ /**
20
+ * 第一条「已挂载但不可翻译」的 grayTip 元素(校准日志入口)。
21
+ * 与 OB11 / Milky notice 翻译共用:翻译函数返回 null 时用本函数定位元素打 raw
22
+ * 日志,两协议的日志口径一致(跳过 REVOKE——撤回翻译独立成事件)。
23
+ */
24
+ function firstUntranslatedGrayTip(msg) {
25
+ for (const el of msg.elements) {
26
+ const g = el.grayTipElement;
27
+ if (g !== void 0 && g.revokeElement === void 0) return g;
28
+ }
29
+ }
30
+ //#endregion
31
+ export { firstUntranslatedGrayTip as n, collectGrayTipUids as t };
32
+
33
+ //# sourceMappingURL=gray-tip-LwBee5mo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gray-tip-LwBee5mo.mjs","names":[],"sources":["../src/core/gray-tip.ts"],"sourcesContent":["/**\n * grayTip 元素工具(OB11 / Satori 共用,2026-08-08 克隆合并)\n *\n * grayTip(系统提示消息)涉及的操作者/成员 uid 需要批量 uid→uin 转换,\n * 两协议翻译层共用同一套收集逻辑。\n */\nimport type { GrayTipElement, RawMessage } from \"@napuketto/kernel\";\n\n/** 非空 uid 才加入集合。 */\nfunction collectUids(uids: Set<string>, ...candidates: Array<string | undefined>): void {\n for (const uid of candidates) {\n if (uid !== undefined && uid !== \"\") {\n uids.add(uid);\n }\n }\n}\n\n/** 收集 grayTip 涉及的 uid(批量 uidToUin 用)。 */\nexport function collectGrayTipUids(msg: RawMessage): string[] {\n const uids = new Set<string>();\n for (const el of msg.elements) {\n const g = el.grayTipElement;\n if (g === undefined) {\n continue;\n }\n collectUids(uids, g.revokeElement?.operatorUid, g.aioOpGrayTipElement?.peerUid);\n const grp = g.groupElement;\n if (grp === undefined) {\n continue;\n }\n collectUids(\n uids,\n grp.memberUid,\n grp.adminUid,\n grp.shutUp?.admin?.uid,\n grp.shutUp?.member?.uid,\n );\n }\n return [...uids];\n}\n\n/**\n * 第一条「已挂载但不可翻译」的 grayTip 元素(校准日志入口)。\n * 与 OB11 / Milky notice 翻译共用:翻译函数返回 null 时用本函数定位元素打 raw\n * 日志,两协议的日志口径一致(跳过 REVOKE——撤回翻译独立成事件)。\n */\nexport function firstUntranslatedGrayTip(msg: RawMessage): GrayTipElement | undefined {\n for (const el of msg.elements) {\n const g = el.grayTipElement;\n if (g !== undefined && g.revokeElement === undefined) {\n return g;\n }\n }\n return undefined;\n}\n"],"mappings":";;AASA,SAAS,YAAY,MAAmB,GAAG,YAA6C;CACpF,KAAK,MAAM,OAAO,YACd,IAAI,QAAQ,KAAA,KAAa,QAAQ,IAC7B,KAAK,IAAI,GAAG;AAGxB;;AAGA,SAAgB,mBAAmB,KAA2B;CAC1D,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,MAAM,IAAI,UAAU;EAC3B,MAAM,IAAI,GAAG;EACb,IAAI,MAAM,KAAA,GACN;EAEJ,YAAY,MAAM,EAAE,eAAe,aAAa,EAAE,qBAAqB,OAAO;EAC9E,MAAM,MAAM,EAAE;EACd,IAAI,QAAQ,KAAA,GACR;EAEJ,YACI,MACA,IAAI,WACJ,IAAI,UACJ,IAAI,QAAQ,OAAO,KACnB,IAAI,QAAQ,QAAQ,GACxB;CACJ;CACA,OAAO,CAAC,GAAG,IAAI;AACnB;;;;;;AAOA,SAAgB,yBAAyB,KAA6C;CAClF,KAAK,MAAM,MAAM,IAAI,UAAU;EAC3B,MAAM,IAAI,GAAG;EACb,IAAI,MAAM,KAAA,KAAa,EAAE,kBAAkB,KAAA,GACvC,OAAO;CAEf;AAEJ"}
@@ -1,13 +1,21 @@
1
1
  import { i as ProtocolConfig, n as BaseProtocolAdapter, s as ActionRegistry } from "../index-CDKj-jus.mjs";
2
- import { ChatType, FriendApi, GroupApi, GroupCache, KernelErrorCode, MsgApi, MsgEventChannel, Peer, ProfileApi, RawMessage } from "@napuketto/kernel";
2
+ import { BuddyEventChannel, ChatType, FriendApi, GroupApi, GroupCache, GroupEventChannel, GroupNotifyApi, KernelErrorCode, MsgApi, MsgEventChannel, Peer, ProfileApi, ProfileLikeApi, RawMessage, RichMediaApi, TicketApi, WebApi } from "@napuketto/kernel";
3
3
  import { ZodType, z } from "zod";
4
4
  import { EventBroadcaster, TransportAdapter } from "@napuketto/network";
5
5
  //#region src/milky/helper/seq-index.d.ts
6
+ /** 合并转发 resId → 定位信息(get_forwarded_messages 取 peer 用)。 */
7
+ interface ForwardEntry {
8
+ chatType: ChatType;
9
+ peerUid: string;
10
+ msgId: string;
11
+ }
6
12
  declare class MessageSeqIndex {
7
13
  /** `${chatType}:${peerUid}:${seq}` → msgId。 */
8
14
  private readonly seqToMsg;
9
15
  /** msgId → seq 元信息。 */
10
16
  private readonly msgToMeta;
17
+ /** 合并转发 resId → 定位信息(P1:get_forwarded_messages)。 */
18
+ private readonly forwards;
11
19
  /** 接收链路登记(一条消息双向写入;重复 msgId 覆盖)。 */
12
20
  record(msg: RawMessage): void;
13
21
  /** seq → msgId(反查;未登记返回 undefined)。 */
@@ -23,10 +31,62 @@ declare class MessageSeqIndex {
23
31
  }>;
24
32
  /** key 规则(chatType 数值 + peerUid + seq;peerUid 群聊=群号,C2C=uid)。 */
25
33
  private key;
34
+ /**
35
+ * 登记合并转发(接收链路:消息含 multiForwardMsgElement 时调用)。
36
+ * resId 是 Milky forward_id 的来源;同一 resId 重复覆盖。
37
+ */
38
+ recordForward(resId: string, entry: ForwardEntry): void;
39
+ /** resId → 转发定位(get_forwarded_messages;未登记返回 undefined)。 */
40
+ resolveForward(resId: string): ForwardEntry | undefined;
26
41
  /** FIFO 淘汰到容量上限内。 */
27
42
  private evict;
28
43
  }
29
44
  //#endregion
45
+ //#region src/milky/action/error-map.d.ts
46
+ /** KernelErrorCode → Milky retcode 映射表(-400/-403 规范语义,其余自定负数)。 */
47
+ type MilkyErrorCodeMap = Record<KernelErrorCode, number>;
48
+ //#endregion
49
+ //#region src/milky/action/base-action.d.ts
50
+ /** Milky 动作结果(retcode 为规范负数族;transport 原样组装信封)。 */
51
+ interface MilkyActionResult<T> {
52
+ status: "ok" | "failed";
53
+ retcode: number;
54
+ data: T | null;
55
+ message: string;
56
+ }
57
+ declare abstract class MilkyAction<TPayload, TReturn> {
58
+ abstract readonly name: string;
59
+ abstract readonly schema: ZodType<TPayload>;
60
+ protected abstract readonly errorCodeMap: MilkyErrorCodeMap;
61
+ protected abstract _handle(payload: TPayload): Promise<TReturn>;
62
+ /** 校验并执行(HTTP /api 入口;WS /event 不承载动作)。 */
63
+ handle(payload: unknown): Promise<MilkyActionResult<TReturn>>;
64
+ }
65
+ //#endregion
66
+ //#region src/milky/config.d.ts
67
+ /** Milky 配置 schema。 */
68
+ declare const milkyConfigSchema: z.ZodObject<{
69
+ enabled: z.ZodDefault<z.ZodBoolean>;
70
+ host: z.ZodDefault<z.ZodString>;
71
+ port: z.ZodDefault<z.ZodNumber>;
72
+ token: z.ZodDefault<z.ZodString>;
73
+ eventModes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
74
+ sse: "sse";
75
+ ws: "ws";
76
+ }>>>;
77
+ webhooks: z.ZodDefault<z.ZodArray<z.ZodString>>;
78
+ cacheDir: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strip>;
80
+ /** Milky 配置类型(由 schema 推导)。 */
81
+ type MilkyConfig = z.infer<typeof milkyConfigSchema>;
82
+ //#endregion
83
+ //#region src/milky/transport.d.ts
84
+ /** 校准 logger 最小面(webhook 失败 / 配置异常提示;缺省静默)。 */
85
+ interface MilkyLoggerLike {
86
+ warn(obj: unknown, msg?: string): void;
87
+ info(obj: unknown, msg?: string): void;
88
+ }
89
+ //#endregion
30
90
  //#region src/milky/api.d.ts
31
91
  /** MilkyApi 构造参数。 */
32
92
  interface MilkyApiOptions {
@@ -34,10 +94,17 @@ interface MilkyApiOptions {
34
94
  groupApi: GroupApi;
35
95
  friendApi: FriendApi;
36
96
  profileApi: ProfileApi;
37
- /** 登录身份(get_login_info / self_id 用)。 */
97
+ /** P1 扩面依赖(表态度 / 票据 / 精华列表 / 群通知 / 群文件)。 */
98
+ profileLikeApi: ProfileLikeApi;
99
+ ticketApi: TicketApi;
100
+ webApi: WebApi;
101
+ groupNotifyApi: GroupNotifyApi;
102
+ richMediaApi: RichMediaApi;
103
+ /** 登录身份(get_login_info / self_id / target_user_uid 用)。 */
38
104
  self: {
39
105
  uin: string;
40
106
  nickname: string;
107
+ uid?: string;
41
108
  };
42
109
  /** 群/成员缓存(群实体回填 / get_group_list;未装配时动作直查 api)。 */
43
110
  groupCache?: GroupCache;
@@ -47,27 +114,42 @@ interface MilkyApiOptions {
47
114
  implVersion: string;
48
115
  /** 发送媒体 http(s)/base64 URI 下载缓存目录(缺省 = 远程媒体发送不可用)。 */
49
116
  mediaDir?: string;
117
+ /** 动作层可观测出口(P2 批次一:forward 临时消息撤回失败 warn;缺省静默)。 */
118
+ logger?: MilkyLoggerLike;
50
119
  }
51
120
  declare class MilkyApi {
52
121
  readonly msgApi: MsgApi;
53
122
  readonly groupApi: GroupApi;
54
123
  readonly friendApi: FriendApi;
55
124
  readonly profileApi: ProfileApi;
125
+ readonly profileLikeApi: ProfileLikeApi;
126
+ readonly ticketApi: TicketApi;
127
+ readonly webApi: WebApi;
128
+ readonly groupNotifyApi: GroupNotifyApi;
129
+ readonly richMediaApi: RichMediaApi;
56
130
  readonly self: {
57
131
  uin: string;
58
132
  nickname: string;
133
+ uid?: string;
59
134
  };
60
135
  readonly groupCache: GroupCache | undefined;
61
136
  readonly qqVersion: string;
62
137
  readonly implVersion: string;
63
138
  readonly mediaDir: string | undefined;
139
+ /** 动作层可观测出口(缺省静默)。 */
140
+ readonly logger: MilkyLoggerLike | undefined;
64
141
  /** message_seq ↔ msgId 双向映射(接收链路 record,动作侧反查)。 */
65
142
  readonly seqIndex: MessageSeqIndex;
66
143
  constructor(opts: MilkyApiOptions, seqIndex: MessageSeqIndex);
67
- /** uin → uid(私聊目标 / at 段发送转换)。 */
144
+ /** uin → uid(私聊目标 / at 段发送转换 / 群管动作的 uid 入参)。 */
68
145
  uinToUid(uins: string[]): Promise<Map<string, string>>;
69
146
  /** uid → uin(事件路径 mention 转换)。 */
70
147
  uidToUin(uids: string[]): Promise<Map<string, string>>;
148
+ /**
149
+ * uin(数字)→ uid(群管动作入参转换);转换失败抛 INVALID_PARAM
150
+ * (Milky 入参 user_id 都是 uin,kernel 群管 API 要 uid)。
151
+ */
152
+ resolveUidFromUin(uin: number | string): Promise<string>;
71
153
  /**
72
154
  * message_scene + 数字 ID → NT Peer。
73
155
  * group = 群号直作 peerUid;friend/temp = uin → uid(失败退 uin 原样,交 QQ 端判断)。
@@ -85,57 +167,12 @@ declare class MilkyApi {
85
167
  }>;
86
168
  }
87
169
  //#endregion
88
- //#region src/milky/action/error-map.d.ts
89
- /** KernelErrorCode → Milky retcode 映射表(-400/-403 规范语义,其余自定负数)。 */
90
- type MilkyErrorCodeMap = Record<KernelErrorCode, number>;
91
- //#endregion
92
- //#region src/milky/action/base-action.d.ts
93
- /** Milky 动作结果(retcode 为规范负数族;transport 原样组装信封)。 */
94
- interface MilkyActionResult<T> {
95
- status: "ok" | "failed";
96
- retcode: number;
97
- data: T | null;
98
- message: string;
99
- }
100
- declare abstract class MilkyAction<TPayload, TReturn> {
101
- abstract readonly name: string;
102
- abstract readonly schema: ZodType<TPayload>;
103
- protected abstract readonly errorCodeMap: MilkyErrorCodeMap;
104
- protected abstract _handle(payload: TPayload): Promise<TReturn>;
105
- /** 校验并执行(HTTP /api 入口;WS /event 不承载动作)。 */
106
- handle(payload: unknown): Promise<MilkyActionResult<TReturn>>;
107
- }
108
- //#endregion
109
170
  //#region src/milky/action/index.d.ts
110
- /** Milky 动作注册表(P0 9 动作)。 */
171
+ /** Milky 动作注册表(P0+P1 49 动作)。 */
111
172
  declare function createMilkyActionRegistry(opts: {
112
173
  api: MilkyApi;
113
174
  }): ActionRegistry<MilkyAction<unknown, unknown>>;
114
175
  //#endregion
115
- //#region src/milky/config.d.ts
116
- /** Milky 配置 schema。 */
117
- declare const milkyConfigSchema: z.ZodObject<{
118
- enabled: z.ZodDefault<z.ZodBoolean>;
119
- host: z.ZodDefault<z.ZodString>;
120
- port: z.ZodDefault<z.ZodNumber>;
121
- token: z.ZodDefault<z.ZodString>;
122
- eventModes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
123
- sse: "sse";
124
- ws: "ws";
125
- }>>>;
126
- webhooks: z.ZodDefault<z.ZodArray<z.ZodString>>;
127
- cacheDir: z.ZodOptional<z.ZodString>;
128
- }, z.core.$strip>;
129
- /** Milky 配置类型(由 schema 推导)。 */
130
- type MilkyConfig = z.infer<typeof milkyConfigSchema>;
131
- //#endregion
132
- //#region src/milky/transport.d.ts
133
- /** 校准 logger 最小面(webhook 失败 / 配置异常提示;缺省静默)。 */
134
- interface MilkyLoggerLike {
135
- warn(obj: unknown, msg?: string): void;
136
- info(obj: unknown, msg?: string): void;
137
- }
138
- //#endregion
139
176
  //#region src/milky/adapter.d.ts
140
177
  /** 适配器构造参数(api 相关字段继承 MilkyApiOptions)。 */
141
178
  interface MilkyAdapterOptions extends MilkyApiOptions {
@@ -143,12 +180,18 @@ interface MilkyAdapterOptions extends MilkyApiOptions {
143
180
  broadcaster: EventBroadcaster;
144
181
  /** kernel 消息事件通道(收链路入口)。 */
145
182
  msgChannel: MsgEventChannel;
146
- /** 校准日志(webhook 失败 / 启停提示;IPC 模式传 loader pino 实例)。 */
183
+ /** kernel 群事件通道(P1:群请求/邀请推送;缺省不订阅)。 */
184
+ groupChannel?: GroupEventChannel;
185
+ /** kernel 好友事件通道(P1:好友申请推送;缺省不订阅)。 */
186
+ buddyChannel?: BuddyEventChannel;
187
+ /** 校准日志(webhook 失败 / 启停提示 / 未知事件形状;IPC 模式传 loader pino 实例)。 */
147
188
  logger?: MilkyLoggerLike;
148
189
  }
149
190
  declare class NapukettoMilkyAdapter extends BaseProtocolAdapter<MilkyConfig> {
150
191
  readonly protocol = "milky";
151
192
  private readonly msgChannel;
193
+ private readonly groupChannel;
194
+ private readonly buddyChannel;
152
195
  private readonly calibLogger;
153
196
  private readonly api;
154
197
  private readonly seqIndex;
@@ -163,13 +206,23 @@ declare class NapukettoMilkyAdapter extends BaseProtocolAdapter<MilkyConfig> {
163
206
  private reloadTransports;
164
207
  /** 停止:退订 + 关传输。 */
165
208
  private stopAll;
166
- /** 订阅 kernel 消息通道(幂等)。 */
209
+ /** 订阅 kernel 事件(消息 + 群通知 + 好友请求,幂等)。 */
167
210
  private subscribe;
168
211
  /** 退订(幂等)。 */
169
212
  private unsubscribeAll;
170
- /** 单条消息:seq 登记 → grayTip→recall / 普通→message_receive(自消息不上报)。 */
213
+ /** 单条消息:seq 登记 → grayTip→notice / 群文件上传 / message_receive(自消息不上报)。 */
171
214
  private handleIncoming;
172
- /** message_receive 组装:at uid→uin + reply 回填 + 群实体回填(全部 fail-soft)。 */
215
+ /** grayTip → notice 事件广播(REVOKE 走 message_recall,其余走 notice 翻译)。 */
216
+ private broadcastNotice;
217
+ /** notice 翻译上下文(uidToUin 缺省空 Map;logger 透传校准日志)。 */
218
+ private noticeCtx;
219
+ /** 群通知通道:入群请求 / 成员邀请 / 邀请自身(uid→uin 批量后翻译)。 */
220
+ private handleGroupNotifies;
221
+ /** 好友请求通道:Buddy/onBuddyReqChange(防御收窄,未知形状 raw 日志)。 */
222
+ private handleBuddyReqs;
223
+ /** request 翻译上下文(uid→uin 批量转换)。 */
224
+ private requestCtx;
225
+ /** message_receive 组装:at uid→uin + reply 回填 + 群实体回填 + 转发段(全部 fail-soft)。 */
173
226
  private buildMessageReceiveEvent;
174
227
  /** at uid → uin 批量转换(mention.user_id 用;失败 mention 段跳过)。 */
175
228
  private fillMentionUids;
@@ -177,10 +230,10 @@ declare class NapukettoMilkyAdapter extends BaseProtocolAdapter<MilkyConfig> {
177
230
  private fillReplyMeta;
178
231
  /** 群场景实体回填(GroupCache 缓存优先,失败最小实体兜底)。 */
179
232
  private fillGroupEntities;
180
- /** message_recall 组装(非撤回 grayTip 返回 null 静默)。 */
181
- private buildRecallEvent;
182
- /** 撤回操作者 uid → uin(未撤回/转换失败返回 undefined,operator_id 兜底 0)。 */
183
- private resolveOperatorUin;
233
+ /** 转发 resId → 定位登记(get_forwarded_messages 反查用)。 */
234
+ private recordForward;
235
+ /** uid 批量 → uin(空集/失败返回 undefined 语义:调用方用空 Map)。 */
236
+ private resolveUidToUin;
184
237
  }
185
238
  //#endregion
186
239
  export { type MilkyAdapterOptions, type MilkyConfig, NapukettoMilkyAdapter, milkyConfigSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/milky/helper/seq-index.ts","../../src/milky/api.ts","../../src/milky/action/error-map.ts","../../src/milky/action/base-action.ts","../../src/milky/action/index.ts","../../src/milky/config.ts","../../src/milky/transport.ts","../../src/milky/adapter.ts"],"mappings":";;;;;cAsBa;;mBAEQ;;mBAEA;;EAGjB,OAAO,KAAK;;EAeZ,aAAa,UAAU,UAAU,iBAAiB;;;;;EAQlD,iBACI,mBACD;IAAc;IAAoB;IAAkB;;;UAgB/C;;UAKA;;;;;UCxDK;EACb,QAAQ;EACR,UAAU;EACV,WAAW;EACX,YAAY;;EAEZ;IAAQ;IAAa;;;EAErB,aAAa;;EAEb;;EAEA;;EAEA;;cAGS;WACA,QAAQ;WACR,UAAU;WACV,WAAW;WACX,YAAY;WACZ;IAAQ;IAAa;;WACrB,YAAY;WACZ;WACA;WACA;;WAEA,UAAU;EAEnB,YAAY,MAAM,iBAAiB,UAAU;;EAc7C,SAAS,iBAAiB,QAAQ;;EAKlC,SAAS,iBAAiB,QAAQ;;;;;EAQ5B,YAAY,oCAAoC,aAAa,QAAQ;;;;;EAqBrE,kBACF,MAAM,MACN,aACA,UAAU,mBACX;;EAeG,kBACF,MAAM,MACN,gBACD;IAAU;IAAqB;;;;;;KC9G1B,oBAAoB,OAAO;;;;UCItB,kBAAkB;EAC/B;EACA;EACA,MAAM;EACN;;uBAYkB,YAAY,UAAU;oBACtB;oBACA,QAAQ,QAAQ;8BACN,cAAc;qBAEvB,QAAQ,SAAS,WAAW,QAAQ;;EAGjD,OAAO,mBAAmB,QAAQ,kBAAkB;;;;;iBCf9C,0BAA0B;EACtC,KAAK;IACL,eAAe;;;;cCfN,mBAAiB,EAAA;;;;;;;;;;;GAe5B,EAAA,KAAA;;KAGU,cAAc,EAAE,aAAa;;;;UCQxB;EACb,KAAK,cAAc;EACnB,KAAK,cAAc;;;;;UCRN,4BAA4B;EACzC,QAAQ,eAAe;EACvB,aAAa;;EAEb,YAAY;;EAEZ,SAAS;;cAGA,8BAA8B,oBAAoB;WAClD;mBAEQ;mBACA;mBACA;mBACA;;WAER,UAAU,kBAAkB;UAC7B;UACA;EAER,YAAY,MAAM;;UAkBJ;;UAuBA;;UAMA;;UASN;;UAYA;;UAQM;;UAmBA;;UAUA;;UAkBN;;UAWM;;UAaA;;UASN"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/milky/helper/seq-index.ts","../../src/milky/action/error-map.ts","../../src/milky/action/base-action.ts","../../src/milky/config.ts","../../src/milky/transport.ts","../../src/milky/api.ts","../../src/milky/action/index.ts","../../src/milky/adapter.ts"],"mappings":";;;;;;UAuBiB;EACb,UAAU;EACV;EACA;;cAGS;;mBAEQ;;mBAEA;;mBAEA;;EAGjB,OAAO,KAAK;;EAeZ,aAAa,UAAU,UAAU,iBAAiB;;;;;EAQlD,iBACI,mBACD;IAAc;IAAoB;IAAkB;;;UAgB/C;;;;;EAQR,cAAc,eAAe,OAAO;;EAepC,eAAe,gBAAgB;;UAKvB;;;;;KClGA,oBAAoB,OAAO;;;;UCItB,kBAAkB;EAC/B;EACA;EACA,MAAM;EACN;;uBAYkB,YAAY,UAAU;oBACtB;oBACA,QAAQ,QAAQ;8BACN,cAAc;qBAEvB,QAAQ,SAAS,WAAW,QAAQ;;EAGjD,OAAO,mBAAmB,QAAQ,kBAAkB;;;;;cC5BjD,mBAAiB,EAAA;;;;;;;;;;;GAe5B,EAAA,KAAA;;KAGU,cAAc,EAAE,aAAa;;;;UCQxB;EACb,KAAK,cAAc;EACnB,KAAK,cAAc;;;;;UCVN;EACb,QAAQ;EACR,UAAU;EACV,WAAW;EACX,YAAY;;EAEZ,gBAAgB;EAChB,WAAW;EACX,QAAQ;EACR,gBAAgB;EAChB,cAAc;;EAEd;IAAQ;IAAa;IAAkB;;;EAEvC,aAAa;;EAEb;;EAEA;;EAEA;;EAEA,SAAS;;cAGA;WACA,QAAQ;WACR,UAAU;WACV,WAAW;WACX,YAAY;WACZ,gBAAgB;WAChB,WAAW;WACX,QAAQ;WACR,gBAAgB;WAChB,cAAc;WACd;IAAQ;IAAa;IAAkB;;WACvC,YAAY;WACZ;WACA;WACA;;WAEA,QAAQ;;WAER,UAAU;EAEnB,YAAY,MAAM,iBAAiB,UAAU;;EAoB7C,SAAS,iBAAiB,QAAQ;;EAKlC,SAAS,iBAAiB,QAAQ;;;;;EAQ5B,kBAAkB,uBAAuB;;;;;EAiBzC,YAAY,oCAAoC,aAAa,QAAQ;;;;;EAqBrE,kBACF,MAAM,MACN,aACA,UAAU,mBACX;;EAeG,kBACF,MAAM,MACN,gBACD;IAAU;IAAqB;;;;;;iBC/FtB,0BAA0B;EACtC,KAAK;IACL,eAAe;;;;UCzBF,4BAA4B;EACzC,QAAQ,eAAe;EACvB,aAAa;;EAEb,YAAY;;EAEZ,eAAe;;EAEf,eAAe;;EAEf,SAAS;;cAGA,8BAA8B,oBAAoB;WAClD;mBAEQ;mBACA;mBACA;mBACA;mBACA;mBACA;;WAER,UAAU,kBAAkB;UAC7B;UACA;EAER,YAAY,MAAM;;UAoBJ;;UAuBA;;UAMA;;UASN;;UA4BA;;UAQM;;UAuBA;;UAeN;;UASM;;UAWN;;UAkBM;;UASA;;UAgBA;;UAkBN;;UAWM;;UAaN;;UAcA"}