@napuketto/loader 0.0.14 → 0.0.17

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 CHANGED
@@ -1,4 +1,345 @@
1
+ import { z } from "zod";
1
2
  import { StdioOptions, spawn } from "node:child_process";
3
+ //#region src/host/ipc/ipc-types.d.ts
4
+ /** IPC 协议版本(解码校验)。 */
5
+ declare const IPC_VERSION = 1;
6
+ /** 引导阶段(status 消息)。 */
7
+ declare const IpcBootPhaseSchema: z.ZodEnum<{
8
+ booting: "booting";
9
+ dlopening: "dlopening";
10
+ failed: "failed";
11
+ logging: "logging";
12
+ ready: "ready";
13
+ sessioning: "sessioning";
14
+ }>;
15
+ /** 结构化日志级别(pino level)。 */
16
+ declare const IpcLogLevelSchema: z.ZodEnum<{
17
+ debug: "debug";
18
+ error: "error";
19
+ fatal: "fatal";
20
+ info: "info";
21
+ trace: "trace";
22
+ warn: "warn";
23
+ }>;
24
+ /** status 消息 payload。 */
25
+ declare const IpcStatusPayloadSchema: z.ZodObject<{
26
+ phase: z.ZodEnum<{
27
+ booting: "booting";
28
+ dlopening: "dlopening";
29
+ failed: "failed";
30
+ logging: "logging";
31
+ ready: "ready";
32
+ sessioning: "sessioning";
33
+ }>;
34
+ message: z.ZodOptional<z.ZodString>;
35
+ error: z.ZodOptional<z.ZodObject<{
36
+ code: z.ZodString;
37
+ message: z.ZodString;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>;
40
+ /** login 消息 payload。 */
41
+ declare const IpcLoginPayloadSchema: z.ZodObject<{
42
+ state: z.ZodEnum<{
43
+ failed: "failed";
44
+ idle: "idle";
45
+ logged_in: "logged_in";
46
+ scanned: "scanned";
47
+ waiting_scan: "waiting_scan";
48
+ }>;
49
+ selfInfo: z.ZodOptional<z.ZodObject<{
50
+ uin: z.ZodString;
51
+ uid: z.ZodString;
52
+ nick: z.ZodString;
53
+ }, z.core.$strip>>;
54
+ message: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>;
56
+ /** event 消息 payload(kernel 事件通道形状,翻译层按 service/name 断言具体类型)。 */
57
+ declare const IpcEventPayloadSchema: z.ZodObject<{
58
+ service: z.ZodString;
59
+ name: z.ZodString;
60
+ args: z.ZodArray<z.ZodUnknown>;
61
+ }, z.core.$strip>;
62
+ /** log 消息 payload。 */
63
+ declare const IpcLogPayloadSchema: z.ZodObject<{
64
+ level: z.ZodEnum<{
65
+ debug: "debug";
66
+ error: "error";
67
+ fatal: "fatal";
68
+ info: "info";
69
+ trace: "trace";
70
+ warn: "warn";
71
+ }>;
72
+ message: z.ZodString;
73
+ }, z.core.$strip>;
74
+ /** 动作响应 payload(result 消息)。 */
75
+ declare const IpcResultPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
76
+ ok: z.ZodLiteral<true>;
77
+ value: z.ZodOptional<z.ZodUnknown>;
78
+ }, z.core.$strip>, z.ZodObject<{
79
+ ok: z.ZodLiteral<false>;
80
+ error: z.ZodObject<{
81
+ code: z.ZodString;
82
+ message: z.ZodString;
83
+ }, z.core.$strip>;
84
+ }, z.core.$strip>]>;
85
+ /** 动作请求 payload(action 消息)。 */
86
+ declare const IpcActionPayloadSchema: z.ZodObject<{
87
+ action: z.ZodString;
88
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
89
+ }, z.core.$strip>;
90
+ /** 控制指令 payload(control 消息,父→子)。 */
91
+ declare const IpcControlPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
92
+ command: z.ZodLiteral<"stop">;
93
+ }, z.core.$strip>, z.ZodObject<{
94
+ command: z.ZodLiteral<"restart">;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ command: z.ZodLiteral<"login">;
97
+ uin: z.ZodOptional<z.ZodString>;
98
+ qr: z.ZodOptional<z.ZodBoolean>;
99
+ }, z.core.$strip>]>;
100
+ declare const IpcStatusMessageSchema: z.ZodObject<{
101
+ v: z.ZodLiteral<1>;
102
+ type: z.ZodLiteral<"status">;
103
+ payload: z.ZodObject<{
104
+ phase: z.ZodEnum<{
105
+ booting: "booting";
106
+ dlopening: "dlopening";
107
+ failed: "failed";
108
+ logging: "logging";
109
+ ready: "ready";
110
+ sessioning: "sessioning";
111
+ }>;
112
+ message: z.ZodOptional<z.ZodString>;
113
+ error: z.ZodOptional<z.ZodObject<{
114
+ code: z.ZodString;
115
+ message: z.ZodString;
116
+ }, z.core.$strip>>;
117
+ }, z.core.$strip>;
118
+ }, z.core.$strip>;
119
+ declare const IpcLoginMessageSchema: z.ZodObject<{
120
+ v: z.ZodLiteral<1>;
121
+ type: z.ZodLiteral<"login">;
122
+ payload: z.ZodObject<{
123
+ state: z.ZodEnum<{
124
+ failed: "failed";
125
+ idle: "idle";
126
+ logged_in: "logged_in";
127
+ scanned: "scanned";
128
+ waiting_scan: "waiting_scan";
129
+ }>;
130
+ selfInfo: z.ZodOptional<z.ZodObject<{
131
+ uin: z.ZodString;
132
+ uid: z.ZodString;
133
+ nick: z.ZodString;
134
+ }, z.core.$strip>>;
135
+ message: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strip>;
137
+ }, z.core.$strip>;
138
+ declare const IpcQrMessageSchema: z.ZodObject<{
139
+ v: z.ZodLiteral<1>;
140
+ type: z.ZodLiteral<"qr">;
141
+ payload: z.ZodObject<{
142
+ pngBase64: z.ZodString;
143
+ qrcodeUrl: z.ZodString;
144
+ }, z.core.$strip>;
145
+ }, z.core.$strip>;
146
+ declare const IpcEventMessageSchema: z.ZodObject<{
147
+ v: z.ZodLiteral<1>;
148
+ type: z.ZodLiteral<"event">;
149
+ payload: z.ZodObject<{
150
+ service: z.ZodString;
151
+ name: z.ZodString;
152
+ args: z.ZodArray<z.ZodUnknown>;
153
+ }, z.core.$strip>;
154
+ }, z.core.$strip>;
155
+ declare const IpcResultMessageSchema: z.ZodObject<{
156
+ v: z.ZodLiteral<1>;
157
+ type: z.ZodLiteral<"result">;
158
+ id: z.ZodNumber;
159
+ payload: z.ZodUnion<readonly [z.ZodObject<{
160
+ ok: z.ZodLiteral<true>;
161
+ value: z.ZodOptional<z.ZodUnknown>;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ ok: z.ZodLiteral<false>;
164
+ error: z.ZodObject<{
165
+ code: z.ZodString;
166
+ message: z.ZodString;
167
+ }, z.core.$strip>;
168
+ }, z.core.$strip>]>;
169
+ }, z.core.$strip>;
170
+ declare const IpcLogMessageSchema: z.ZodObject<{
171
+ v: z.ZodLiteral<1>;
172
+ type: z.ZodLiteral<"log">;
173
+ payload: z.ZodObject<{
174
+ level: z.ZodEnum<{
175
+ debug: "debug";
176
+ error: "error";
177
+ fatal: "fatal";
178
+ info: "info";
179
+ trace: "trace";
180
+ warn: "warn";
181
+ }>;
182
+ message: z.ZodString;
183
+ }, z.core.$strip>;
184
+ }, z.core.$strip>;
185
+ declare const IpcPingMessageSchema: z.ZodObject<{
186
+ v: z.ZodLiteral<1>;
187
+ type: z.ZodLiteral<"ping">;
188
+ }, z.core.$strip>;
189
+ declare const IpcPongMessageSchema: z.ZodObject<{
190
+ v: z.ZodLiteral<1>;
191
+ type: z.ZodLiteral<"pong">;
192
+ }, z.core.$strip>;
193
+ declare const IpcActionMessageSchema: z.ZodObject<{
194
+ v: z.ZodLiteral<1>;
195
+ type: z.ZodLiteral<"action">;
196
+ id: z.ZodNumber;
197
+ payload: z.ZodObject<{
198
+ action: z.ZodString;
199
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
200
+ }, z.core.$strip>;
201
+ }, z.core.$strip>;
202
+ declare const IpcControlMessageSchema: z.ZodObject<{
203
+ v: z.ZodLiteral<1>;
204
+ type: z.ZodLiteral<"control">;
205
+ payload: z.ZodUnion<readonly [z.ZodObject<{
206
+ command: z.ZodLiteral<"stop">;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ command: z.ZodLiteral<"restart">;
209
+ }, z.core.$strip>, z.ZodObject<{
210
+ command: z.ZodLiteral<"login">;
211
+ uin: z.ZodOptional<z.ZodString>;
212
+ qr: z.ZodOptional<z.ZodBoolean>;
213
+ }, z.core.$strip>]>;
214
+ }, z.core.$strip>;
215
+ /** IPC 消息判别联合(协议边界,运行时经 safeParse 校验)。 */
216
+ declare const IpcMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
217
+ v: z.ZodLiteral<1>;
218
+ type: z.ZodLiteral<"status">;
219
+ payload: z.ZodObject<{
220
+ phase: z.ZodEnum<{
221
+ booting: "booting";
222
+ dlopening: "dlopening";
223
+ failed: "failed";
224
+ logging: "logging";
225
+ ready: "ready";
226
+ sessioning: "sessioning";
227
+ }>;
228
+ message: z.ZodOptional<z.ZodString>;
229
+ error: z.ZodOptional<z.ZodObject<{
230
+ code: z.ZodString;
231
+ message: z.ZodString;
232
+ }, z.core.$strip>>;
233
+ }, z.core.$strip>;
234
+ }, z.core.$strip>, z.ZodObject<{
235
+ v: z.ZodLiteral<1>;
236
+ type: z.ZodLiteral<"login">;
237
+ payload: z.ZodObject<{
238
+ state: z.ZodEnum<{
239
+ failed: "failed";
240
+ idle: "idle";
241
+ logged_in: "logged_in";
242
+ scanned: "scanned";
243
+ waiting_scan: "waiting_scan";
244
+ }>;
245
+ selfInfo: z.ZodOptional<z.ZodObject<{
246
+ uin: z.ZodString;
247
+ uid: z.ZodString;
248
+ nick: z.ZodString;
249
+ }, z.core.$strip>>;
250
+ message: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strip>;
252
+ }, z.core.$strip>, z.ZodObject<{
253
+ v: z.ZodLiteral<1>;
254
+ type: z.ZodLiteral<"qr">;
255
+ payload: z.ZodObject<{
256
+ pngBase64: z.ZodString;
257
+ qrcodeUrl: z.ZodString;
258
+ }, z.core.$strip>;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ v: z.ZodLiteral<1>;
261
+ type: z.ZodLiteral<"event">;
262
+ payload: z.ZodObject<{
263
+ service: z.ZodString;
264
+ name: z.ZodString;
265
+ args: z.ZodArray<z.ZodUnknown>;
266
+ }, z.core.$strip>;
267
+ }, z.core.$strip>, z.ZodObject<{
268
+ v: z.ZodLiteral<1>;
269
+ type: z.ZodLiteral<"result">;
270
+ id: z.ZodNumber;
271
+ payload: z.ZodUnion<readonly [z.ZodObject<{
272
+ ok: z.ZodLiteral<true>;
273
+ value: z.ZodOptional<z.ZodUnknown>;
274
+ }, z.core.$strip>, z.ZodObject<{
275
+ ok: z.ZodLiteral<false>;
276
+ error: z.ZodObject<{
277
+ code: z.ZodString;
278
+ message: z.ZodString;
279
+ }, z.core.$strip>;
280
+ }, z.core.$strip>]>;
281
+ }, z.core.$strip>, z.ZodObject<{
282
+ v: z.ZodLiteral<1>;
283
+ type: z.ZodLiteral<"log">;
284
+ payload: z.ZodObject<{
285
+ level: z.ZodEnum<{
286
+ debug: "debug";
287
+ error: "error";
288
+ fatal: "fatal";
289
+ info: "info";
290
+ trace: "trace";
291
+ warn: "warn";
292
+ }>;
293
+ message: z.ZodString;
294
+ }, z.core.$strip>;
295
+ }, z.core.$strip>, z.ZodObject<{
296
+ v: z.ZodLiteral<1>;
297
+ type: z.ZodLiteral<"ping">;
298
+ }, z.core.$strip>, z.ZodObject<{
299
+ v: z.ZodLiteral<1>;
300
+ type: z.ZodLiteral<"pong">;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ v: z.ZodLiteral<1>;
303
+ type: z.ZodLiteral<"action">;
304
+ id: z.ZodNumber;
305
+ payload: z.ZodObject<{
306
+ action: z.ZodString;
307
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
308
+ }, z.core.$strip>;
309
+ }, z.core.$strip>, z.ZodObject<{
310
+ v: z.ZodLiteral<1>;
311
+ type: z.ZodLiteral<"control">;
312
+ payload: z.ZodUnion<readonly [z.ZodObject<{
313
+ command: z.ZodLiteral<"stop">;
314
+ }, z.core.$strip>, z.ZodObject<{
315
+ command: z.ZodLiteral<"restart">;
316
+ }, z.core.$strip>, z.ZodObject<{
317
+ command: z.ZodLiteral<"login">;
318
+ uin: z.ZodOptional<z.ZodString>;
319
+ qr: z.ZodOptional<z.ZodBoolean>;
320
+ }, z.core.$strip>]>;
321
+ }, z.core.$strip>], "type">;
322
+ type IpcBootPhase = z.infer<typeof IpcBootPhaseSchema>;
323
+ type IpcLogLevel = z.infer<typeof IpcLogLevelSchema>;
324
+ type IpcStatusPayload = z.infer<typeof IpcStatusPayloadSchema>;
325
+ type IpcLoginPayload = z.infer<typeof IpcLoginPayloadSchema>;
326
+ type IpcEventPayload = z.infer<typeof IpcEventPayloadSchema>;
327
+ type IpcLogPayload = z.infer<typeof IpcLogPayloadSchema>;
328
+ type IpcResultPayload = z.infer<typeof IpcResultPayloadSchema>;
329
+ type IpcActionPayload = z.infer<typeof IpcActionPayloadSchema>;
330
+ type IpcControlPayload = z.infer<typeof IpcControlPayloadSchema>;
331
+ type IpcStatusMessage = z.infer<typeof IpcStatusMessageSchema>;
332
+ type IpcLoginMessage = z.infer<typeof IpcLoginMessageSchema>;
333
+ type IpcQrMessage = z.infer<typeof IpcQrMessageSchema>;
334
+ type IpcEventMessage = z.infer<typeof IpcEventMessageSchema>;
335
+ type IpcResultMessage = z.infer<typeof IpcResultMessageSchema>;
336
+ type IpcLogMessage = z.infer<typeof IpcLogMessageSchema>;
337
+ type IpcPingMessage = z.infer<typeof IpcPingMessageSchema>;
338
+ type IpcPongMessage = z.infer<typeof IpcPongMessageSchema>;
339
+ type IpcActionMessage = z.infer<typeof IpcActionMessageSchema>;
340
+ type IpcControlMessage = z.infer<typeof IpcControlMessageSchema>;
341
+ type IpcMessage = z.infer<typeof IpcMessageSchema>;
342
+ //#endregion
2
343
  //#region src/instance-lock.d.ts
3
344
  /**
4
345
  * instance-lock.ts:单实例锁(2026-08-07 根治「多实例抢数据目录锁挂起」)
@@ -294,7 +635,7 @@ interface QqReleaseEntry {
294
635
  url: string;
295
636
  /** sha256(十六进制小写);空串 = 尚未校验(首次录入时 CI 计算后填入)。 */
296
637
  sha256: string;
297
- /** appid(预知信息,运行时仍从 major.node 解析)。 */
638
+ /** appid(预知信息,运行时仍从 major.node 解析;0 = 尚未解析/待运行时补)。 */
298
639
  appid: number;
299
640
  /** 来源标记(official = 官方)。 */
300
641
  source: string;
@@ -382,5 +723,5 @@ declare function buildSpawnCommand(options: {
382
723
  selfHostPath: string;
383
724
  }): SpawnCommand;
384
725
  //#endregion
385
- export { DownloadError, type DownloadOptions, type DownloadResult, ENV, type ExtractOptions, INSTANCE_LOCK_FILE, type InstanceLockCheck, type InstanceLockInfo, type LaunchOptions, type LaunchResult, QQ_FILES_DIR_NAME, type QqFileSource, type QqInstallInfo, type QqReleaseEntry, QqReleasesError, type QqReleasesFile, type ResolveQqFilesOptions, type SevenZipResult, type SpawnCommand, WIN_NODE_DIR_NAME, type WinNodeInfo, acquireInstanceLock, buildSpawnCommand, checkInstanceLock, clearCacheVersion, defaultStubDir, downloadFile, ensureLinuxSevenZip, ensureQqFiles, ensureWinNode, extractInstaller, extractWrapperFiles, findSevenZip, isLinux, latestRelease, launchSelfHost, linuxSevenZipUrl, loadQqReleases, locateQqPath, nodeZipUrl, registerLockCleanup, releaseInstanceLock, resolveDownloadUrl, resolveQqFiles, resolveQqInstall, toWinePath, wineBinary };
726
+ export { DownloadError, type DownloadOptions, type DownloadResult, ENV, type ExtractOptions, INSTANCE_LOCK_FILE, IPC_VERSION, type InstanceLockCheck, type InstanceLockInfo, type IpcActionMessage, type IpcActionPayload, IpcActionPayloadSchema, type IpcBootPhase, IpcBootPhaseSchema, type IpcControlMessage, type IpcControlPayload, IpcControlPayloadSchema, type IpcEventMessage, type IpcEventPayload, IpcEventPayloadSchema, type IpcLogLevel, IpcLogLevelSchema, type IpcLogMessage, type IpcLogPayload, IpcLogPayloadSchema, type IpcLoginMessage, type IpcLoginPayload, IpcLoginPayloadSchema, type IpcMessage, IpcMessageSchema, type IpcPingMessage, type IpcPongMessage, type IpcQrMessage, type IpcResultMessage, type IpcResultPayload, IpcResultPayloadSchema, type IpcStatusMessage, type IpcStatusPayload, IpcStatusPayloadSchema, type LaunchOptions, type LaunchResult, QQ_FILES_DIR_NAME, type QqFileSource, type QqInstallInfo, type QqReleaseEntry, QqReleasesError, type QqReleasesFile, type ResolveQqFilesOptions, type SevenZipResult, type SpawnCommand, WIN_NODE_DIR_NAME, type WinNodeInfo, acquireInstanceLock, buildSpawnCommand, checkInstanceLock, clearCacheVersion, defaultStubDir, downloadFile, ensureLinuxSevenZip, ensureQqFiles, ensureWinNode, extractInstaller, extractWrapperFiles, findSevenZip, isLinux, latestRelease, launchSelfHost, linuxSevenZipUrl, loadQqReleases, locateQqPath, nodeZipUrl, registerLockCleanup, releaseInstanceLock, resolveDownloadUrl, resolveQqFiles, resolveQqInstall, toWinePath, wineBinary };
386
727
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/instance-lock.ts","../src/locate-qq.ts","../src/launcher.ts","../src/qq-download.ts","../src/qq-extract.ts","../src/qq-releases.ts","../src/win-node.ts","../src/wine.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;cA2Ba;;UAGI;;EAEb;;EAEA;;EAEA;;;UAIa;;EAEb;;EAEA;;EAEA;;;;;;;iBAQY,kBAAkB,kBAAkB;;;;;iBA+BpC,oBAAoB,iBAAiB;;;;;iBA4BrC,oBAAoB;;iBAapB,oBAAoB;;;;cC1GvB;;KAmFD;;UAGK;;EAEb;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;;UAIK;;EAEb;;EAEA;;EAEA;;EAEA;;EAEA;;;iBAIY;;iBAwCA,iBAAiB,kBAAkB;;;;;;iBAa7B,eAAe,UAAS,wBAA6B,QAAQ;;;;;iBA0DnE;;;;;;;;;;;iBAiBM,oBAClB;EAAW;IACZ;EAAU;EAAa;;;;;;iBA+CJ,cAClB;;EAEI;;EAEA;IAEL,QAAQ;;;UCvSM;;EAEb,IAAI;;EAEJ;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;EAQA;;;;;;EAMA,QAAQ;;UAGK;;EAEb,OAAO,kBAAkB;;EAEzB;;;;;;;;;;;;;iBAckB,eAAe,SAAS,gBAAgB,QAAQ;;;;;iBA0FtD;;cA4CH;WACT;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;UCzNa;;EAEb;;EAEA;;EAEA;;EAEA;;;UAIa;;EAEb;;EAEA;;;cAIS,sBAAsB;EAC/B,YAAY;;;;;;iBA8CM,aAAa,SAAS,kBAAkB,QAAQ;;;;UCrDrD;;EAEb;;EAEA;;;UAIa;;EAEb;;EAEA;;EAEA;;EAEA;;;;;;;iBAQY,gBAAgB;;iBAwBV,iBAClB,uBACA,iBACA,wBACD;;;;;;iBA+BmB,oBAClB,sBACA,iBACA,oBACD,QAAQ;;iBAkDW,kBAAkB,mBAAmB,kBAAkB;;;;UC5J5D;;EAEb;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIa;EACb;EACA,OAAO;;;cAIE,wBAAwB;EACjC,YAAY;;;iBAYA,kBAAkB;;iBAoBlB,cAAc,UAAU,iBAAiB;;;;;iBAYzC,mBAAmB,SAAS;;;;cC1D/B;;UAGI;;EAEb;;EAEA;;;iBAIY,WAAW;;;;;iBAQL,cAClB;;EAEI;;EAEA;;EAEA;IAEL,QAAQ;;;;;;;;;;;;;;;iBCrCK,WAAW;;iBAiBX;;iBAoBA;;UAKC;;EAEb;;EAEA;;;iBAIY,kBAAkB;;EAE9B,WAAW,OAAO;;EAElB;;EAEA;;EAEA;IACA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/host/ipc/ipc-types.ts","../src/instance-lock.ts","../src/locate-qq.ts","../src/launcher.ts","../src/qq-download.ts","../src/qq-extract.ts","../src/qq-releases.ts","../src/win-node.ts","../src/wine.ts"],"mappings":";;;;cAaa;;cAGA,oBAAkB,EAAA;;;;;;;;;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;EAEb;;EAEA;;EAEA;;EAEA;;;UAIa;;EAEb;;EAEA;;;cAIS,sBAAsB;EAC/B,YAAY;;;;;;iBA8CM,aAAa,SAAS,kBAAkB,QAAQ;;;;UCrDrD;;EAEb;;EAEA;;;UAIa;;EAEb;;EAEA;;EAEA;;EAEA;;;;;;;iBAQY,gBAAgB;;iBAwBV,iBAClB,uBACA,iBACA,wBACD;;;;;;iBA+BmB,oBAClB,sBACA,iBACA,oBACD,QAAQ;;iBAkDW,kBAAkB,mBAAmB,kBAAkB;;;;UCtJ5D;;EAEb;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIa;EACb;EACA,OAAO;;;cAIE,wBAAwB;EACjC,YAAY;;;iBAYA,kBAAkB;;iBAoBlB,cAAc,UAAU,iBAAiB;;;;;iBAYzC,mBAAmB,SAAS;;;;cChE/B;;UAGI;;EAEb;;EAEA;;;iBAIY,WAAW;;;;;iBAQL,cAClB;;EAEI;;EAEA;;EAEA;IAEL,QAAQ;;;;;;;;;;;;;;;iBCrCK,WAAW;;iBAiBX;;iBAoBA;;UAKC;;EAEb;;EAEA;;;iBAIY,kBAAkB;;EAE9B,WAAW,OAAO;;EAElB;;EAEA;;EAEA;IACA"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { z } from "zod";
1
2
  import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
2
3
  import { dirname, join, resolve } from "node:path";
3
4
  import process$1 from "node:process";
@@ -6,6 +7,171 @@ import { fileURLToPath } from "node:url";
6
7
  import { chmod, copyFile, mkdir, readdir, rm } from "node:fs/promises";
7
8
  import { createHash } from "node:crypto";
8
9
  import { get } from "node:https";
10
+ //#region src/host/ipc/ipc-types.ts
11
+ /**
12
+ * ipc-types.ts:IPC 协议消息(koishi 插件 ↔ self-host 子进程,单一来源)。
13
+ *
14
+ * 协议契约(koishi 插件 design.md §5.6):`{ v, type, id?, payload }` JSON 行。
15
+ * 用 zod v4 定义单一 schema,两侧(loader host + koishi 插件)import 同一份:
16
+ * 类型经 z.infer 派生、运行时经 safeParse 校验,消除「两份手写 types.ts」漂移。
17
+ *
18
+ * 领域字段(LoginState / SelfInfo / QrCodeData)与 kernel 同名类型结构等价,
19
+ * 在协议边界内联为 zod schema(kernel 不依赖 zod,故不在 kernel 定义)。
20
+ */
21
+ /** IPC 协议版本(解码校验)。 */
22
+ const IPC_VERSION = 1;
23
+ /** 引导阶段(status 消息)。 */
24
+ const IpcBootPhaseSchema = z.enum([
25
+ "booting",
26
+ "dlopening",
27
+ "logging",
28
+ "sessioning",
29
+ "ready",
30
+ "failed"
31
+ ]);
32
+ /** 结构化日志级别(pino level)。 */
33
+ const IpcLogLevelSchema = z.enum([
34
+ "trace",
35
+ "debug",
36
+ "info",
37
+ "warn",
38
+ "error",
39
+ "fatal"
40
+ ]);
41
+ /** 登录状态(与 kernel LoginState 结构等价)。 */
42
+ const LoginStateSchema = z.enum([
43
+ "idle",
44
+ "waiting_scan",
45
+ "scanned",
46
+ "logged_in",
47
+ "failed"
48
+ ]);
49
+ /** selfInfo(与 kernel SelfInfo 结构等价)。 */
50
+ const SelfInfoSchema = z.object({
51
+ uin: z.string(),
52
+ uid: z.string(),
53
+ nick: z.string()
54
+ });
55
+ /** status 消息 payload。 */
56
+ const IpcStatusPayloadSchema = z.object({
57
+ phase: IpcBootPhaseSchema,
58
+ message: z.string().optional(),
59
+ error: z.object({
60
+ code: z.string(),
61
+ message: z.string()
62
+ }).optional()
63
+ });
64
+ /** login 消息 payload。 */
65
+ const IpcLoginPayloadSchema = z.object({
66
+ state: LoginStateSchema,
67
+ selfInfo: SelfInfoSchema.optional(),
68
+ /** 失败原因(state=failed 时;如「登录超时,请刷新页面重试」)。 */
69
+ message: z.string().optional()
70
+ });
71
+ /** event 消息 payload(kernel 事件通道形状,翻译层按 service/name 断言具体类型)。 */
72
+ const IpcEventPayloadSchema = z.object({
73
+ service: z.string(),
74
+ name: z.string(),
75
+ args: z.array(z.unknown())
76
+ });
77
+ /** log 消息 payload。 */
78
+ const IpcLogPayloadSchema = z.object({
79
+ level: IpcLogLevelSchema,
80
+ message: z.string()
81
+ });
82
+ /** 动作响应 payload(result 消息)。 */
83
+ const IpcResultPayloadSchema = z.union([z.object({
84
+ ok: z.literal(true),
85
+ value: z.unknown().optional()
86
+ }), z.object({
87
+ ok: z.literal(false),
88
+ error: z.object({
89
+ code: z.string(),
90
+ message: z.string()
91
+ })
92
+ })]);
93
+ /** 动作请求 payload(action 消息)。 */
94
+ const IpcActionPayloadSchema = z.object({
95
+ action: z.string(),
96
+ params: z.record(z.string(), z.unknown()).optional()
97
+ });
98
+ /** 控制指令 payload(control 消息,父→子)。 */
99
+ const IpcControlPayloadSchema = z.union([
100
+ z.object({ command: z.literal("stop") }),
101
+ z.object({ command: z.literal("restart") }),
102
+ z.object({
103
+ command: z.literal("login"),
104
+ uin: z.string().optional(),
105
+ qr: z.boolean().optional()
106
+ })
107
+ ]);
108
+ const IpcStatusMessageSchema = z.object({
109
+ v: z.literal(1),
110
+ type: z.literal("status"),
111
+ payload: IpcStatusPayloadSchema
112
+ });
113
+ const IpcLoginMessageSchema = z.object({
114
+ v: z.literal(1),
115
+ type: z.literal("login"),
116
+ payload: IpcLoginPayloadSchema
117
+ });
118
+ const IpcQrMessageSchema = z.object({
119
+ v: z.literal(1),
120
+ type: z.literal("qr"),
121
+ payload: z.object({
122
+ pngBase64: z.string(),
123
+ qrcodeUrl: z.string()
124
+ })
125
+ });
126
+ const IpcEventMessageSchema = z.object({
127
+ v: z.literal(1),
128
+ type: z.literal("event"),
129
+ payload: IpcEventPayloadSchema
130
+ });
131
+ const IpcResultMessageSchema = z.object({
132
+ v: z.literal(1),
133
+ type: z.literal("result"),
134
+ id: z.number(),
135
+ payload: IpcResultPayloadSchema
136
+ });
137
+ const IpcLogMessageSchema = z.object({
138
+ v: z.literal(1),
139
+ type: z.literal("log"),
140
+ payload: IpcLogPayloadSchema
141
+ });
142
+ const IpcPingMessageSchema = z.object({
143
+ v: z.literal(1),
144
+ type: z.literal("ping")
145
+ });
146
+ const IpcPongMessageSchema = z.object({
147
+ v: z.literal(1),
148
+ type: z.literal("pong")
149
+ });
150
+ const IpcActionMessageSchema = z.object({
151
+ v: z.literal(1),
152
+ type: z.literal("action"),
153
+ id: z.number(),
154
+ payload: IpcActionPayloadSchema
155
+ });
156
+ const IpcControlMessageSchema = z.object({
157
+ v: z.literal(1),
158
+ type: z.literal("control"),
159
+ payload: IpcControlPayloadSchema
160
+ });
161
+ /** IPC 消息判别联合(协议边界,运行时经 safeParse 校验)。 */
162
+ const IpcMessageSchema = z.discriminatedUnion("type", [
163
+ IpcStatusMessageSchema,
164
+ IpcLoginMessageSchema,
165
+ IpcQrMessageSchema,
166
+ IpcEventMessageSchema,
167
+ IpcResultMessageSchema,
168
+ IpcLogMessageSchema,
169
+ IpcPingMessageSchema,
170
+ IpcPongMessageSchema,
171
+ IpcActionMessageSchema,
172
+ IpcControlMessageSchema
173
+ ]);
174
+ //#endregion
9
175
  //#region src/instance-lock.ts
10
176
  /**
11
177
  * instance-lock.ts:单实例锁(2026-08-07 根治「多实例抢数据目录锁挂起」)
@@ -611,8 +777,14 @@ const ENV = {
611
777
  * qq-releases.ts:版本清单读取(P1)。
612
778
  *
613
779
  * 运行时从包根 qq-releases.json 读取(发布时 files 含它,安装后位于
614
- * node_modules/@napuketto/loader/qq-releases.json)。清单由 CI/社区 PR 维护
615
- * (设计文档 §2.2)。NAPUTO_QQ_URL 可运行时覆盖下载地址。
780
+ * node_modules/@napuketto/loader/qq-releases.json)。
781
+ *
782
+ * 维护机制(真实存在,非「声称」):清单由 CI 自动维护——
783
+ * .github/workflows/update-qq-releases.yml(每日 cron + 手动触发)调用
784
+ * scripts/qq-releases/update-qq-releases.ts(纯 Node,与本地共用),抓取 QQ 官方下载配置
785
+ * 解析最新版 + 下载安装包计算 sha256 + 解析安装包内部版本目录后更新本清单
786
+ * (保留历史条目、known 按版本递增)。社区 PR 仍可手动补充。NAPUTO_QQ_URL
787
+ * 可运行时覆盖下载地址(用户拿到新链接时用)。
616
788
  */
617
789
  /** 清单解析失败。 */
618
790
  var QqReleasesError = class extends Error {
@@ -882,6 +1054,6 @@ async function ensureQqFiles(options = {}) {
882
1054
  }
883
1055
  }
884
1056
  //#endregion
885
- export { DownloadError, ENV, INSTANCE_LOCK_FILE, QQ_FILES_DIR_NAME, QqReleasesError, WIN_NODE_DIR_NAME, acquireInstanceLock, buildSpawnCommand, checkInstanceLock, clearCacheVersion, defaultStubDir, downloadFile, ensureLinuxSevenZip, ensureQqFiles, ensureWinNode, extractInstaller, extractWrapperFiles, findSevenZip, isLinux, latestRelease, launchSelfHost, linuxSevenZipUrl, loadQqReleases, locateQqPath, nodeZipUrl, registerLockCleanup, releaseInstanceLock, resolveDownloadUrl, resolveQqFiles, resolveQqInstall, toWinePath, wineBinary };
1057
+ export { DownloadError, ENV, INSTANCE_LOCK_FILE, IPC_VERSION, IpcActionPayloadSchema, IpcBootPhaseSchema, IpcControlPayloadSchema, IpcEventPayloadSchema, IpcLogLevelSchema, IpcLogPayloadSchema, IpcLoginPayloadSchema, IpcMessageSchema, IpcResultPayloadSchema, IpcStatusPayloadSchema, QQ_FILES_DIR_NAME, QqReleasesError, WIN_NODE_DIR_NAME, acquireInstanceLock, buildSpawnCommand, checkInstanceLock, clearCacheVersion, defaultStubDir, downloadFile, ensureLinuxSevenZip, ensureQqFiles, ensureWinNode, extractInstaller, extractWrapperFiles, findSevenZip, isLinux, latestRelease, launchSelfHost, linuxSevenZipUrl, loadQqReleases, locateQqPath, nodeZipUrl, registerLockCleanup, releaseInstanceLock, resolveDownloadUrl, resolveQqFiles, resolveQqInstall, toWinePath, wineBinary };
886
1058
 
887
1059
  //# sourceMappingURL=index.mjs.map