@napuketto/adapter 0.2.1 → 0.3.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/gray-tip-8zPh4d9W.d.mts +1 -0
- package/dist/{raw-message-Bx18pIQS.mjs → gray-tip-B80z9KR4.mjs} +2 -12
- package/dist/gray-tip-B80z9KR4.mjs.map +1 -0
- package/dist/kurobot/index.d.mts +840 -0
- package/dist/kurobot/index.d.mts.map +1 -0
- package/dist/kurobot/index.mjs +998 -0
- package/dist/kurobot/index.mjs.map +1 -0
- package/dist/onebot11/index.d.mts +2 -2
- package/dist/onebot11/index.mjs +2 -1
- package/dist/onebot11/index.mjs.map +1 -1
- package/dist/raw-message-6KdlG8kR.mjs +13 -0
- package/dist/raw-message-6KdlG8kR.mjs.map +1 -0
- package/dist/satori/index.d.mts +2 -2
- package/dist/satori/index.mjs +2 -1
- package/dist/satori/index.mjs.map +1 -1
- package/package.json +9 -2
- package/dist/gray-tip-CcpfI1Og.d.mts +0 -1
- package/dist/raw-message-Bx18pIQS.mjs.map +0 -1
|
@@ -0,0 +1,840 @@
|
|
|
1
|
+
import { i as ProtocolConfig, n as BaseProtocolAdapter } from "../index-CDKj-jus.mjs";
|
|
2
|
+
import { CanonicalElement, MsgEventChannel, Peer, RawMessage } from "@napuketto/kernel";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/kurobot/config.d.ts
|
|
5
|
+
/** kurobot 配置 schema。 */
|
|
6
|
+
declare const kurobotConfigSchema: z.ZodObject<{
|
|
7
|
+
url: z.ZodURL;
|
|
8
|
+
token: z.ZodDefault<z.ZodString>;
|
|
9
|
+
client: z.ZodOptional<z.ZodString>;
|
|
10
|
+
commandPrefix: z.ZodDefault<z.ZodString>;
|
|
11
|
+
pingIntervalMs: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
chatTemplate: z.ZodDefault<z.ZodString>;
|
|
13
|
+
joinTemplate: z.ZodDefault<z.ZodString>;
|
|
14
|
+
leaveTemplate: z.ZodDefault<z.ZodString>;
|
|
15
|
+
deathTemplate: z.ZodDefault<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
/** kurobot 配置类型(由 schema 推导)。 */
|
|
18
|
+
type KurobotConfig = z.infer<typeof kurobotConfigSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* ConfigBase 必填的 defaults 形参兜底值(url 必填 → 无法 `parse({})`)。
|
|
21
|
+
* 装配走 seed 模式(段存在才装配,seed 已校验),defaults 不参与生效值;
|
|
22
|
+
* 仅在「无 seed 且配置文件缺失」的直连场景被落盘——端口 0 地址连接会失败退避,
|
|
23
|
+
* 不会静默假在线。
|
|
24
|
+
*/
|
|
25
|
+
declare function kurobotConfigDefaults(): KurobotConfig;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/kurobot/schema.d.ts
|
|
28
|
+
declare const PROTOCOL_NAME: "kurobridge-ws";
|
|
29
|
+
/** 语义化版本(主版本相同即兼容,ADR-026:0.2.x/0.3.0 服务端均接受 0.3.1 hello)。 */
|
|
30
|
+
declare const PROTOCOL_VERSION: "0.4.0";
|
|
31
|
+
/** WS 子协议(握手期校验,服务端 handleProtocols 不带即拒连)。 */
|
|
32
|
+
declare const WS_SUBPROTOCOL: "kurobridge-ws.v1";
|
|
33
|
+
/** 协议版本兼容判定(镜像 meta.ts 同名函数):主版本号相同即兼容。 */
|
|
34
|
+
declare function isProtocolVersionCompatible(peerVersion: string, serverVersion: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 通用线格式帧(两段式解析的第一段):只约束帧骨架(type 受 snake_case、
|
|
37
|
+
* id 存在时须 UUID、body 任意),供收帧侧「先取 type、再分发到具体 schema」。
|
|
38
|
+
*/
|
|
39
|
+
declare const wireFrameSchema: z.ZodObject<{
|
|
40
|
+
header: z.ZodObject<{
|
|
41
|
+
type: z.ZodString;
|
|
42
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
body: z.ZodUnknown;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
/** 出帧:扁平消息 → 线格式 JSON 文本(单行,可直接走 WS 文本帧) */
|
|
47
|
+
declare function encodeFrame(message: {
|
|
48
|
+
type: string;
|
|
49
|
+
body: unknown;
|
|
50
|
+
id?: string;
|
|
51
|
+
}): string;
|
|
52
|
+
/** 请求-响应的命令结果体(ok 分支可选 `output`:命令输出行;与 query/命令链共用)。 */
|
|
53
|
+
declare const commandResultBodySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
54
|
+
ok: z.ZodLiteral<true>;
|
|
55
|
+
output: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
ok: z.ZodLiteral<false>;
|
|
58
|
+
error: z.ZodString;
|
|
59
|
+
}, z.core.$strip>]>;
|
|
60
|
+
type CommandResultBody = z.infer<typeof commandResultBodySchema>;
|
|
61
|
+
declare const helloBodySchema: z.ZodObject<{
|
|
62
|
+
peerId: z.ZodString;
|
|
63
|
+
platform: z.ZodString;
|
|
64
|
+
version: z.ZodString;
|
|
65
|
+
protocolVersion: z.ZodString;
|
|
66
|
+
token: z.ZodOptional<z.ZodString>;
|
|
67
|
+
client: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
/** 对端注册(请求,服务端必须回同 id 的 hello_ack)。 */
|
|
70
|
+
declare const helloFrame: z.ZodPipe<z.ZodObject<{
|
|
71
|
+
header: z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<"hello">;
|
|
73
|
+
id: z.ZodUUID;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
body: z.ZodObject<{
|
|
76
|
+
peerId: z.ZodString;
|
|
77
|
+
platform: z.ZodString;
|
|
78
|
+
version: z.ZodString;
|
|
79
|
+
protocolVersion: z.ZodString;
|
|
80
|
+
token: z.ZodOptional<z.ZodString>;
|
|
81
|
+
client: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
84
|
+
type: "hello";
|
|
85
|
+
id: string;
|
|
86
|
+
body: {
|
|
87
|
+
peerId: string;
|
|
88
|
+
platform: string;
|
|
89
|
+
version: string;
|
|
90
|
+
protocolVersion: string;
|
|
91
|
+
token?: string | undefined;
|
|
92
|
+
client?: string | undefined;
|
|
93
|
+
};
|
|
94
|
+
}, {
|
|
95
|
+
header: {
|
|
96
|
+
type: "hello";
|
|
97
|
+
id: string;
|
|
98
|
+
};
|
|
99
|
+
body: {
|
|
100
|
+
peerId: string;
|
|
101
|
+
platform: string;
|
|
102
|
+
version: string;
|
|
103
|
+
protocolVersion: string;
|
|
104
|
+
token?: string | undefined;
|
|
105
|
+
client?: string | undefined;
|
|
106
|
+
};
|
|
107
|
+
}>>;
|
|
108
|
+
type HelloBody = z.infer<typeof helloBodySchema>;
|
|
109
|
+
/** 心跳请求(应用层帧——服务端空闲检测只认应用层入帧,WS 层 ping 无效)。 */
|
|
110
|
+
declare const pingFrame: z.ZodPipe<z.ZodObject<{
|
|
111
|
+
header: z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"ping">;
|
|
113
|
+
id: z.ZodUUID;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
body: z.ZodObject<{
|
|
116
|
+
timestamp: z.ZodNumber;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
119
|
+
type: "ping";
|
|
120
|
+
id: string;
|
|
121
|
+
body: {
|
|
122
|
+
timestamp: number;
|
|
123
|
+
};
|
|
124
|
+
}, {
|
|
125
|
+
header: {
|
|
126
|
+
type: "ping";
|
|
127
|
+
id: string;
|
|
128
|
+
};
|
|
129
|
+
body: {
|
|
130
|
+
timestamp: number;
|
|
131
|
+
};
|
|
132
|
+
}>>;
|
|
133
|
+
declare const platformChatBodySchema: z.ZodObject<{
|
|
134
|
+
channel: z.ZodString;
|
|
135
|
+
sender: z.ZodString;
|
|
136
|
+
content: z.ZodString;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
/** 平台 → 游戏聊天(事件;服务端按绑定表过滤未绑定频道)。 */
|
|
139
|
+
declare const platformChatFrame: z.ZodPipe<z.ZodObject<{
|
|
140
|
+
header: z.ZodObject<{
|
|
141
|
+
type: z.ZodLiteral<"chat">;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
body: z.ZodObject<{
|
|
144
|
+
channel: z.ZodString;
|
|
145
|
+
sender: z.ZodString;
|
|
146
|
+
content: z.ZodString;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
149
|
+
type: "chat";
|
|
150
|
+
body: {
|
|
151
|
+
channel: string;
|
|
152
|
+
sender: string;
|
|
153
|
+
content: string;
|
|
154
|
+
};
|
|
155
|
+
}, {
|
|
156
|
+
header: {
|
|
157
|
+
type: "chat";
|
|
158
|
+
};
|
|
159
|
+
body: {
|
|
160
|
+
channel: string;
|
|
161
|
+
sender: string;
|
|
162
|
+
content: string;
|
|
163
|
+
};
|
|
164
|
+
}>>;
|
|
165
|
+
type PlatformChatBody = z.infer<typeof platformChatBodySchema>;
|
|
166
|
+
declare const commandBodySchema: z.ZodObject<{
|
|
167
|
+
command: z.ZodString;
|
|
168
|
+
source: z.ZodObject<{
|
|
169
|
+
channel: z.ZodString;
|
|
170
|
+
userId: z.ZodString;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
/** 群指令 → 执行游戏命令(请求;响应为同 id command_result)。 */
|
|
174
|
+
declare const commandFrame: z.ZodPipe<z.ZodObject<{
|
|
175
|
+
header: z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"command">;
|
|
177
|
+
id: z.ZodUUID;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
body: z.ZodObject<{
|
|
180
|
+
command: z.ZodString;
|
|
181
|
+
source: z.ZodObject<{
|
|
182
|
+
channel: z.ZodString;
|
|
183
|
+
userId: z.ZodString;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
187
|
+
type: "command";
|
|
188
|
+
id: string;
|
|
189
|
+
body: {
|
|
190
|
+
command: string;
|
|
191
|
+
source: {
|
|
192
|
+
channel: string;
|
|
193
|
+
userId: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
}, {
|
|
197
|
+
header: {
|
|
198
|
+
type: "command";
|
|
199
|
+
id: string;
|
|
200
|
+
};
|
|
201
|
+
body: {
|
|
202
|
+
command: string;
|
|
203
|
+
source: {
|
|
204
|
+
channel: string;
|
|
205
|
+
userId: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
}>>;
|
|
209
|
+
type CommandBody = z.infer<typeof commandBodySchema>;
|
|
210
|
+
type CommandFrame = z.infer<typeof commandFrame>;
|
|
211
|
+
/** 状态/绑定查询(请求;响应为同 id query_result)。 */
|
|
212
|
+
declare const queryFrame: z.ZodPipe<z.ZodObject<{
|
|
213
|
+
header: z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"query">;
|
|
215
|
+
id: z.ZodUUID;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
body: z.ZodObject<{
|
|
218
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"status">, z.ZodLiteral<"bindings">]>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
221
|
+
type: "query";
|
|
222
|
+
id: string;
|
|
223
|
+
body: {
|
|
224
|
+
kind: "bindings" | "status";
|
|
225
|
+
};
|
|
226
|
+
}, {
|
|
227
|
+
header: {
|
|
228
|
+
type: "query";
|
|
229
|
+
id: string;
|
|
230
|
+
};
|
|
231
|
+
body: {
|
|
232
|
+
kind: "bindings" | "status";
|
|
233
|
+
};
|
|
234
|
+
}>>;
|
|
235
|
+
declare const helloAckOkBodySchema: z.ZodObject<{
|
|
236
|
+
ok: z.ZodLiteral<true>;
|
|
237
|
+
serverId: z.ZodString;
|
|
238
|
+
version: z.ZodString;
|
|
239
|
+
protocolVersion: z.ZodString;
|
|
240
|
+
channelBindings: z.ZodArray<z.ZodString>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
declare const helloAckErrorBodySchema: z.ZodObject<{
|
|
243
|
+
ok: z.ZodLiteral<false>;
|
|
244
|
+
reason: z.ZodString;
|
|
245
|
+
}, z.core.$strip>;
|
|
246
|
+
/** 握手结果(响应,同 id)。 */
|
|
247
|
+
declare const helloAckFrame: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
248
|
+
header: z.ZodObject<{
|
|
249
|
+
type: z.ZodLiteral<"hello_ack">;
|
|
250
|
+
id: z.ZodUUID;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
body: z.ZodObject<{
|
|
253
|
+
ok: z.ZodLiteral<true>;
|
|
254
|
+
serverId: z.ZodString;
|
|
255
|
+
version: z.ZodString;
|
|
256
|
+
protocolVersion: z.ZodString;
|
|
257
|
+
channelBindings: z.ZodArray<z.ZodString>;
|
|
258
|
+
}, z.core.$strip>;
|
|
259
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
260
|
+
type: "hello_ack";
|
|
261
|
+
id: string;
|
|
262
|
+
body: {
|
|
263
|
+
ok: true;
|
|
264
|
+
serverId: string;
|
|
265
|
+
version: string;
|
|
266
|
+
protocolVersion: string;
|
|
267
|
+
channelBindings: string[];
|
|
268
|
+
};
|
|
269
|
+
}, {
|
|
270
|
+
header: {
|
|
271
|
+
type: "hello_ack";
|
|
272
|
+
id: string;
|
|
273
|
+
};
|
|
274
|
+
body: {
|
|
275
|
+
ok: true;
|
|
276
|
+
serverId: string;
|
|
277
|
+
version: string;
|
|
278
|
+
protocolVersion: string;
|
|
279
|
+
channelBindings: string[];
|
|
280
|
+
};
|
|
281
|
+
}>>, z.ZodPipe<z.ZodObject<{
|
|
282
|
+
header: z.ZodObject<{
|
|
283
|
+
type: z.ZodLiteral<"hello_ack">;
|
|
284
|
+
id: z.ZodUUID;
|
|
285
|
+
}, z.core.$strip>;
|
|
286
|
+
body: z.ZodObject<{
|
|
287
|
+
ok: z.ZodLiteral<false>;
|
|
288
|
+
reason: z.ZodString;
|
|
289
|
+
}, z.core.$strip>;
|
|
290
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
291
|
+
type: "hello_ack";
|
|
292
|
+
id: string;
|
|
293
|
+
body: {
|
|
294
|
+
ok: false;
|
|
295
|
+
reason: string;
|
|
296
|
+
};
|
|
297
|
+
}, {
|
|
298
|
+
header: {
|
|
299
|
+
type: "hello_ack";
|
|
300
|
+
id: string;
|
|
301
|
+
};
|
|
302
|
+
body: {
|
|
303
|
+
ok: false;
|
|
304
|
+
reason: string;
|
|
305
|
+
};
|
|
306
|
+
}>>]>;
|
|
307
|
+
type HelloAckOkBody = z.infer<typeof helloAckOkBodySchema>;
|
|
308
|
+
type HelloAckErrorBody = z.infer<typeof helloAckErrorBodySchema>;
|
|
309
|
+
type HelloAckBody = HelloAckOkBody | HelloAckErrorBody;
|
|
310
|
+
declare const pongBodySchema: z.ZodObject<{
|
|
311
|
+
timestamp: z.ZodNumber;
|
|
312
|
+
}, z.core.$strip>;
|
|
313
|
+
/** 心跳响应(不需要处理:收不到就等服务端 1001 关闭走重连)。 */
|
|
314
|
+
declare const pongFrame: z.ZodPipe<z.ZodObject<{
|
|
315
|
+
header: z.ZodObject<{
|
|
316
|
+
type: z.ZodLiteral<"pong">;
|
|
317
|
+
id: z.ZodUUID;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
body: z.ZodObject<{
|
|
320
|
+
timestamp: z.ZodNumber;
|
|
321
|
+
}, z.core.$strip>;
|
|
322
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
323
|
+
type: "pong";
|
|
324
|
+
id: string;
|
|
325
|
+
body: {
|
|
326
|
+
timestamp: number;
|
|
327
|
+
};
|
|
328
|
+
}, {
|
|
329
|
+
header: {
|
|
330
|
+
type: "pong";
|
|
331
|
+
id: string;
|
|
332
|
+
};
|
|
333
|
+
body: {
|
|
334
|
+
timestamp: number;
|
|
335
|
+
};
|
|
336
|
+
}>>;
|
|
337
|
+
type PongBody = z.infer<typeof pongBodySchema>;
|
|
338
|
+
declare const gameChatBodySchema: z.ZodObject<{
|
|
339
|
+
channel: z.ZodString;
|
|
340
|
+
playerName: z.ZodString;
|
|
341
|
+
content: z.ZodString;
|
|
342
|
+
}, z.core.$strip>;
|
|
343
|
+
/** 游戏 → 平台聊天(事件)。 */
|
|
344
|
+
declare const gameChatFrame: z.ZodPipe<z.ZodObject<{
|
|
345
|
+
header: z.ZodObject<{
|
|
346
|
+
type: z.ZodLiteral<"chat">;
|
|
347
|
+
}, z.core.$strict>;
|
|
348
|
+
body: z.ZodObject<{
|
|
349
|
+
channel: z.ZodString;
|
|
350
|
+
playerName: z.ZodString;
|
|
351
|
+
content: z.ZodString;
|
|
352
|
+
}, z.core.$strip>;
|
|
353
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
354
|
+
type: "chat";
|
|
355
|
+
body: {
|
|
356
|
+
channel: string;
|
|
357
|
+
playerName: string;
|
|
358
|
+
content: string;
|
|
359
|
+
};
|
|
360
|
+
}, {
|
|
361
|
+
header: {
|
|
362
|
+
type: "chat";
|
|
363
|
+
};
|
|
364
|
+
body: {
|
|
365
|
+
channel: string;
|
|
366
|
+
playerName: string;
|
|
367
|
+
content: string;
|
|
368
|
+
};
|
|
369
|
+
}>>;
|
|
370
|
+
type GameChatBody = z.infer<typeof gameChatBodySchema>;
|
|
371
|
+
declare const joinBodySchema: z.ZodObject<{
|
|
372
|
+
channel: z.ZodString;
|
|
373
|
+
playerName: z.ZodString;
|
|
374
|
+
}, z.core.$strip>;
|
|
375
|
+
/** 玩家进服(事件,按绑定频道 fan-out)。 */
|
|
376
|
+
declare const joinFrame: z.ZodPipe<z.ZodObject<{
|
|
377
|
+
header: z.ZodObject<{
|
|
378
|
+
type: z.ZodLiteral<"join">;
|
|
379
|
+
}, z.core.$strict>;
|
|
380
|
+
body: z.ZodObject<{
|
|
381
|
+
channel: z.ZodString;
|
|
382
|
+
playerName: z.ZodString;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
385
|
+
type: "join";
|
|
386
|
+
body: {
|
|
387
|
+
channel: string;
|
|
388
|
+
playerName: string;
|
|
389
|
+
};
|
|
390
|
+
}, {
|
|
391
|
+
header: {
|
|
392
|
+
type: "join";
|
|
393
|
+
};
|
|
394
|
+
body: {
|
|
395
|
+
channel: string;
|
|
396
|
+
playerName: string;
|
|
397
|
+
};
|
|
398
|
+
}>>;
|
|
399
|
+
type JoinBody = z.infer<typeof joinBodySchema>;
|
|
400
|
+
declare const leaveBodySchema: z.ZodObject<{
|
|
401
|
+
channel: z.ZodString;
|
|
402
|
+
playerName: z.ZodString;
|
|
403
|
+
}, z.core.$strip>;
|
|
404
|
+
/** 玩家退服(事件,按绑定频道 fan-out)。 */
|
|
405
|
+
declare const leaveFrame: z.ZodPipe<z.ZodObject<{
|
|
406
|
+
header: z.ZodObject<{
|
|
407
|
+
type: z.ZodLiteral<"leave">;
|
|
408
|
+
}, z.core.$strict>;
|
|
409
|
+
body: z.ZodObject<{
|
|
410
|
+
channel: z.ZodString;
|
|
411
|
+
playerName: z.ZodString;
|
|
412
|
+
}, z.core.$strip>;
|
|
413
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
414
|
+
type: "leave";
|
|
415
|
+
body: {
|
|
416
|
+
channel: string;
|
|
417
|
+
playerName: string;
|
|
418
|
+
};
|
|
419
|
+
}, {
|
|
420
|
+
header: {
|
|
421
|
+
type: "leave";
|
|
422
|
+
};
|
|
423
|
+
body: {
|
|
424
|
+
channel: string;
|
|
425
|
+
playerName: string;
|
|
426
|
+
};
|
|
427
|
+
}>>;
|
|
428
|
+
type LeaveBody = z.infer<typeof leaveBodySchema>;
|
|
429
|
+
declare const statusBodySchema: z.ZodObject<{
|
|
430
|
+
tps: z.ZodNumber;
|
|
431
|
+
onlinePlayers: z.ZodNumber;
|
|
432
|
+
uptimeSeconds: z.ZodNumber;
|
|
433
|
+
}, z.core.$strip>;
|
|
434
|
+
/** 服务器状态(事件;无 channel——全服状态而非频道消息)。 */
|
|
435
|
+
declare const statusFrame: z.ZodPipe<z.ZodObject<{
|
|
436
|
+
header: z.ZodObject<{
|
|
437
|
+
type: z.ZodLiteral<"status">;
|
|
438
|
+
}, z.core.$strict>;
|
|
439
|
+
body: z.ZodObject<{
|
|
440
|
+
tps: z.ZodNumber;
|
|
441
|
+
onlinePlayers: z.ZodNumber;
|
|
442
|
+
uptimeSeconds: z.ZodNumber;
|
|
443
|
+
}, z.core.$strip>;
|
|
444
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
445
|
+
type: "status";
|
|
446
|
+
body: {
|
|
447
|
+
tps: number;
|
|
448
|
+
onlinePlayers: number;
|
|
449
|
+
uptimeSeconds: number;
|
|
450
|
+
};
|
|
451
|
+
}, {
|
|
452
|
+
header: {
|
|
453
|
+
type: "status";
|
|
454
|
+
};
|
|
455
|
+
body: {
|
|
456
|
+
tps: number;
|
|
457
|
+
onlinePlayers: number;
|
|
458
|
+
uptimeSeconds: number;
|
|
459
|
+
};
|
|
460
|
+
}>>;
|
|
461
|
+
type StatusBody = z.infer<typeof statusBodySchema>;
|
|
462
|
+
declare const bindingsUpdatedBodySchema: z.ZodObject<{
|
|
463
|
+
channelBindings: z.ZodArray<z.ZodString>;
|
|
464
|
+
}, z.core.$strip>;
|
|
465
|
+
/** 绑定表变更推送(事件)。 */
|
|
466
|
+
declare const bindingsUpdatedFrame: z.ZodPipe<z.ZodObject<{
|
|
467
|
+
header: z.ZodObject<{
|
|
468
|
+
type: z.ZodLiteral<"bindings_updated">;
|
|
469
|
+
}, z.core.$strict>;
|
|
470
|
+
body: z.ZodObject<{
|
|
471
|
+
channelBindings: z.ZodArray<z.ZodString>;
|
|
472
|
+
}, z.core.$strip>;
|
|
473
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
474
|
+
type: "bindings_updated";
|
|
475
|
+
body: {
|
|
476
|
+
channelBindings: string[];
|
|
477
|
+
};
|
|
478
|
+
}, {
|
|
479
|
+
header: {
|
|
480
|
+
type: "bindings_updated";
|
|
481
|
+
};
|
|
482
|
+
body: {
|
|
483
|
+
channelBindings: string[];
|
|
484
|
+
};
|
|
485
|
+
}>>;
|
|
486
|
+
type BindingsUpdatedBody = z.infer<typeof bindingsUpdatedBodySchema>;
|
|
487
|
+
/** 群指令的执行结果(响应,同 id)。 */
|
|
488
|
+
declare const commandResultFrame: z.ZodPipe<z.ZodObject<{
|
|
489
|
+
header: z.ZodObject<{
|
|
490
|
+
type: z.ZodLiteral<"command_result">;
|
|
491
|
+
id: z.ZodUUID;
|
|
492
|
+
}, z.core.$strip>;
|
|
493
|
+
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
494
|
+
ok: z.ZodLiteral<true>;
|
|
495
|
+
output: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
496
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
497
|
+
ok: z.ZodLiteral<false>;
|
|
498
|
+
error: z.ZodString;
|
|
499
|
+
}, z.core.$strip>]>;
|
|
500
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
501
|
+
type: "command_result";
|
|
502
|
+
id: string;
|
|
503
|
+
body: {
|
|
504
|
+
ok: true;
|
|
505
|
+
output?: string[] | undefined;
|
|
506
|
+
} | {
|
|
507
|
+
ok: false;
|
|
508
|
+
error: string;
|
|
509
|
+
};
|
|
510
|
+
}, {
|
|
511
|
+
header: {
|
|
512
|
+
type: "command_result";
|
|
513
|
+
id: string;
|
|
514
|
+
};
|
|
515
|
+
body: {
|
|
516
|
+
ok: true;
|
|
517
|
+
output?: string[] | undefined;
|
|
518
|
+
} | {
|
|
519
|
+
ok: false;
|
|
520
|
+
error: string;
|
|
521
|
+
};
|
|
522
|
+
}>>;
|
|
523
|
+
declare const queryResultBodySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
524
|
+
ok: z.ZodLiteral<true>;
|
|
525
|
+
data: z.ZodUnknown;
|
|
526
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
527
|
+
ok: z.ZodLiteral<false>;
|
|
528
|
+
error: z.ZodString;
|
|
529
|
+
}, z.core.$strip>]>;
|
|
530
|
+
/** 查询结果(响应,同 id)。 */
|
|
531
|
+
declare const queryResultFrame: z.ZodPipe<z.ZodObject<{
|
|
532
|
+
header: z.ZodObject<{
|
|
533
|
+
type: z.ZodLiteral<"query_result">;
|
|
534
|
+
id: z.ZodUUID;
|
|
535
|
+
}, z.core.$strip>;
|
|
536
|
+
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
537
|
+
ok: z.ZodLiteral<true>;
|
|
538
|
+
data: z.ZodUnknown;
|
|
539
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
540
|
+
ok: z.ZodLiteral<false>;
|
|
541
|
+
error: z.ZodString;
|
|
542
|
+
}, z.core.$strip>]>;
|
|
543
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
544
|
+
type: "query_result";
|
|
545
|
+
id: string;
|
|
546
|
+
body: {
|
|
547
|
+
ok: true;
|
|
548
|
+
data: unknown;
|
|
549
|
+
} | {
|
|
550
|
+
ok: false;
|
|
551
|
+
error: string;
|
|
552
|
+
};
|
|
553
|
+
}, {
|
|
554
|
+
header: {
|
|
555
|
+
type: "query_result";
|
|
556
|
+
id: string;
|
|
557
|
+
};
|
|
558
|
+
body: {
|
|
559
|
+
ok: true;
|
|
560
|
+
data: unknown;
|
|
561
|
+
} | {
|
|
562
|
+
ok: false;
|
|
563
|
+
error: string;
|
|
564
|
+
};
|
|
565
|
+
}>>;
|
|
566
|
+
type QueryResultBody = z.infer<typeof queryResultBodySchema>;
|
|
567
|
+
declare const deathBodySchema: z.ZodObject<{
|
|
568
|
+
channel: z.ZodString;
|
|
569
|
+
player: z.ZodString;
|
|
570
|
+
message: z.ZodString;
|
|
571
|
+
}, z.core.$strip>;
|
|
572
|
+
/** 玩家死亡(事件,按绑定频道 fan-out 对齐 join/leave)。 */
|
|
573
|
+
declare const deathFrame: z.ZodPipe<z.ZodObject<{
|
|
574
|
+
header: z.ZodObject<{
|
|
575
|
+
type: z.ZodLiteral<"death">;
|
|
576
|
+
}, z.core.$strict>;
|
|
577
|
+
body: z.ZodObject<{
|
|
578
|
+
channel: z.ZodString;
|
|
579
|
+
player: z.ZodString;
|
|
580
|
+
message: z.ZodString;
|
|
581
|
+
}, z.core.$strip>;
|
|
582
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
583
|
+
type: "death";
|
|
584
|
+
body: {
|
|
585
|
+
channel: string;
|
|
586
|
+
player: string;
|
|
587
|
+
message: string;
|
|
588
|
+
};
|
|
589
|
+
}, {
|
|
590
|
+
header: {
|
|
591
|
+
type: "death";
|
|
592
|
+
};
|
|
593
|
+
body: {
|
|
594
|
+
channel: string;
|
|
595
|
+
player: string;
|
|
596
|
+
message: string;
|
|
597
|
+
};
|
|
598
|
+
}>>;
|
|
599
|
+
type DeathBody = z.infer<typeof deathBodySchema>;
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/kurobot/connection.d.ts
|
|
602
|
+
/** 连接层日志最小面(装配方传 pino 实例;缺省静默)。 */
|
|
603
|
+
interface KurobotLogger {
|
|
604
|
+
debug(obj: unknown, msg: string): void;
|
|
605
|
+
info(obj: unknown, msg: string): void;
|
|
606
|
+
warn(obj: unknown, msg: string): void;
|
|
607
|
+
error(obj: unknown, msg: string): void;
|
|
608
|
+
}
|
|
609
|
+
/** 服务端 → 对端的已知业务帧(扁平消息;hello_ack 由连接层内部消费不经此回调)。 */
|
|
610
|
+
type ServerEventMessage = {
|
|
611
|
+
type: "pong";
|
|
612
|
+
id: string;
|
|
613
|
+
body: PongBody;
|
|
614
|
+
} | {
|
|
615
|
+
type: "chat";
|
|
616
|
+
body: GameChatBody;
|
|
617
|
+
} | {
|
|
618
|
+
type: "join";
|
|
619
|
+
body: JoinBody;
|
|
620
|
+
} | {
|
|
621
|
+
type: "leave";
|
|
622
|
+
body: LeaveBody;
|
|
623
|
+
} | {
|
|
624
|
+
type: "death";
|
|
625
|
+
body: DeathBody;
|
|
626
|
+
} | {
|
|
627
|
+
type: "status";
|
|
628
|
+
body: StatusBody;
|
|
629
|
+
} | {
|
|
630
|
+
type: "bindings_updated";
|
|
631
|
+
body: BindingsUpdatedBody;
|
|
632
|
+
} | {
|
|
633
|
+
type: "command_result";
|
|
634
|
+
id: string;
|
|
635
|
+
body: CommandResultBody;
|
|
636
|
+
} | {
|
|
637
|
+
type: "query_result";
|
|
638
|
+
id: string;
|
|
639
|
+
body: QueryResultBody;
|
|
640
|
+
};
|
|
641
|
+
/** 连接终止原因(onEnded 只在永久停止时触发一次;用户 stop() 不触发)。 */
|
|
642
|
+
interface ConnectionEndedReason {
|
|
643
|
+
/** true = 不可恢复(版本不符 / token 错 / hello_ack 拒绝)。 */
|
|
644
|
+
permanent: boolean;
|
|
645
|
+
/** WS close code(可得时)。 */
|
|
646
|
+
code?: number;
|
|
647
|
+
/** 人读描述。 */
|
|
648
|
+
detail: string;
|
|
649
|
+
}
|
|
650
|
+
/** hello body(protocolVersion 固定 0.3.1;peerId/platform/version/client 由适配器解析)。 */
|
|
651
|
+
interface KurobotHello {
|
|
652
|
+
peerId: string;
|
|
653
|
+
platform: string;
|
|
654
|
+
version: string;
|
|
655
|
+
protocolVersion: string;
|
|
656
|
+
token?: string;
|
|
657
|
+
client?: string;
|
|
658
|
+
}
|
|
659
|
+
/** 连接层参数(重连节奏等可注入测试快值;生产用缺省)。 */
|
|
660
|
+
interface KurobotConnectionOptions {
|
|
661
|
+
/** KuroBot 服务端完整地址(ws:// / wss://)。 */
|
|
662
|
+
url: string;
|
|
663
|
+
hello: KurobotHello;
|
|
664
|
+
/** 应用层心跳间隔毫秒(须显著小于服务端 30s 空闲阈值;0 = 关闭)。 */
|
|
665
|
+
pingIntervalMs: number;
|
|
666
|
+
/** 建立(hello → ack)超时毫秒。 */
|
|
667
|
+
helloTimeoutMs: number;
|
|
668
|
+
/** 重连退避基数毫秒(指数 2^attempt)。 */
|
|
669
|
+
retryBaseDelayMs: number;
|
|
670
|
+
/** 重连退避上限毫秒。 */
|
|
671
|
+
retryMaxDelayMs: number;
|
|
672
|
+
/** 握手成功(ack ok,含绑定快照)。 */
|
|
673
|
+
onEstablished: (ack: HelloAckOkBody) => void;
|
|
674
|
+
/** 服务端业务帧(hello_ack 内部消费不回调;pong 透传由消费方忽略)。 */
|
|
675
|
+
onFrame: (msg: ServerEventMessage) => void;
|
|
676
|
+
/** 连接永久停止(1002/1008/hello_ack 拒绝);用户 stop() 不触发。 */
|
|
677
|
+
onEnded: (reason: ConnectionEndedReason) => void;
|
|
678
|
+
/** 日志(缺省静默)。 */
|
|
679
|
+
logger?: KurobotLogger;
|
|
680
|
+
}
|
|
681
|
+
/** kurobridge-ws 客户端连接(子协议 + hello + 应用层 ping + 感知 close code 的指数退避)。 */
|
|
682
|
+
declare class KurobotConnection {
|
|
683
|
+
private readonly opts;
|
|
684
|
+
private readonly log;
|
|
685
|
+
private state;
|
|
686
|
+
private ws;
|
|
687
|
+
/** 用户主动 stop(其后一切 close 都不再重连、不上报 onEnded)。 */
|
|
688
|
+
private userStopped;
|
|
689
|
+
/** 已判定永久拒绝(版本/token),不再重连。 */
|
|
690
|
+
private rejected;
|
|
691
|
+
private pendingHelloId;
|
|
692
|
+
private helloTimer;
|
|
693
|
+
private pingTimer;
|
|
694
|
+
private retryTimer;
|
|
695
|
+
/** 连续失败计数(established 成功后清零)。 */
|
|
696
|
+
private attempt;
|
|
697
|
+
constructor(opts: KurobotConnectionOptions);
|
|
698
|
+
/** 当前是否已建立(ack ok)。 */
|
|
699
|
+
isEstablished(): boolean;
|
|
700
|
+
/** 启动:发起首次连接(异步,结果经回调上报;重复调用幂等)。 */
|
|
701
|
+
start(): void;
|
|
702
|
+
/** 停止:关闭连接、清定时器、不再重连(幂等;不触发 onEnded)。 */
|
|
703
|
+
stop(): void;
|
|
704
|
+
/** 发送出站帧(chat/command/query 等扁平消息);未 established 丢弃 + debug。 */
|
|
705
|
+
send(message: {
|
|
706
|
+
type: string;
|
|
707
|
+
body: unknown;
|
|
708
|
+
id?: string;
|
|
709
|
+
}): boolean;
|
|
710
|
+
/** 发起一次连接。 */
|
|
711
|
+
private connect;
|
|
712
|
+
/** 连接建立:立即发 hello(每次连接都重发——服务端按连接会话握手)。 */
|
|
713
|
+
private onOpen;
|
|
714
|
+
/** 收到文本帧:两段式解析(wire 取 type → 分发具体 schema)+ 未知帧容忍。 */
|
|
715
|
+
private onText;
|
|
716
|
+
/** 已知 type 的具体 schema 校验(未知 type 走容忍;body 非法 warn 丢弃)。 */
|
|
717
|
+
private parseServerFrame;
|
|
718
|
+
/** 未知帧容忍(对齐 ADR-026 服务端策略):事件帧忽略;请求帧回 `<type>_result` 失败回执;`_result` 结尾不回执(防乒乓)。 */
|
|
719
|
+
private handleUnknownFrame;
|
|
720
|
+
/** hello_ack 处理:ok → 建立;ok:false → 永久停止(版本/鉴权问题不可自愈)。 */
|
|
721
|
+
private handleHelloAck;
|
|
722
|
+
/** 应用层心跳:每 pingIntervalMs 发 ping 帧(服务端任何入帧重置 30s 空闲计时)。 */
|
|
723
|
+
private startPing;
|
|
724
|
+
private stopPing;
|
|
725
|
+
private clearTimers;
|
|
726
|
+
/** 永久拒绝:关闭连接,不再重连,上报 onEnded。 */
|
|
727
|
+
private reject;
|
|
728
|
+
/** close:区分用户停止 / 永久拒绝(1002/1008)/ 可重连断开。 */
|
|
729
|
+
private onClose;
|
|
730
|
+
/** 指数退避重连:base * 2^attempt 封顶 retryMaxDelayMs;established 成功清零。 */
|
|
731
|
+
private scheduleRetry;
|
|
732
|
+
}
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region src/kurobot/adapter.d.ts
|
|
735
|
+
/** 发群消息最小面(kernel MsgApi.sendMessage 的结构子集,便于测试桩替换)。 */
|
|
736
|
+
interface KurobotMsgApi {
|
|
737
|
+
sendMessage(target: Peer, elements: CanonicalElement[]): Promise<{
|
|
738
|
+
msgId: string;
|
|
739
|
+
}>;
|
|
740
|
+
}
|
|
741
|
+
/** 适配器构造参数。 */
|
|
742
|
+
interface KurobotAdapterOptions {
|
|
743
|
+
/** 协议配置(zod 校验 + seed 装配)。 */
|
|
744
|
+
config: ProtocolConfig<KurobotConfig>;
|
|
745
|
+
/** kernel 消息事件通道(QQ 消息收链路入口)。 */
|
|
746
|
+
msgChannel: MsgEventChannel;
|
|
747
|
+
/** kernel 消息 API(MC → QQ 群文本发送)。 */
|
|
748
|
+
msgApi: KurobotMsgApi;
|
|
749
|
+
/** 当前登录账号(自消息过滤 + hello peerId)。 */
|
|
750
|
+
self: {
|
|
751
|
+
uin: string;
|
|
752
|
+
nickname: string;
|
|
753
|
+
};
|
|
754
|
+
/** 日志(缺省静默)。 */
|
|
755
|
+
logger?: KurobotLoggerAlias;
|
|
756
|
+
}
|
|
757
|
+
/** 适配器日志面(复用连接层最小面)。 */
|
|
758
|
+
type KurobotLoggerAlias = KurobotConnectionOptions["logger"];
|
|
759
|
+
/** kurobot 协议适配器。 */
|
|
760
|
+
declare class NapukettoKurobotAdapter extends BaseProtocolAdapter<KurobotConfig> {
|
|
761
|
+
readonly protocol = "kurobot";
|
|
762
|
+
private readonly msgChannel;
|
|
763
|
+
private readonly msgApi;
|
|
764
|
+
private readonly selfUin;
|
|
765
|
+
private readonly log;
|
|
766
|
+
private connection;
|
|
767
|
+
private unsubscribe;
|
|
768
|
+
/** 当前生效配置(收链路取 commandPrefix 等;onStart/onReload 刷新)。 */
|
|
769
|
+
private currentConfig;
|
|
770
|
+
/** 出站绑定集(hello_ack 快照 + bindings_updated 全量替换;空集 = 全部不发)。 */
|
|
771
|
+
private bindings;
|
|
772
|
+
/** command 请求 UUID → 回发群号(command_result 帧无 channel,靠 id 关联)。 */
|
|
773
|
+
private pendingCommands;
|
|
774
|
+
/** query 请求 UUID → 查询类别。 */
|
|
775
|
+
private pendingQueries;
|
|
776
|
+
/** 最近一帧 status 快照(仅缓存不发群,M-04 决策同构)。 */
|
|
777
|
+
private lastStatus;
|
|
778
|
+
constructor(opts: KurobotAdapterOptions);
|
|
779
|
+
/** 最近一帧 status 快照(仅缓存;无帧时 null)。 */
|
|
780
|
+
getLastStatus(): StatusBody | null;
|
|
781
|
+
/** 连接是否已建立(hello_ack ok 后为 true)。 */
|
|
782
|
+
isConnected(): boolean;
|
|
783
|
+
/** 发起 query 请求(status/bindings)。MVP 未接 QQ 触发面——预留能力(见 design.md §8)。 */
|
|
784
|
+
query(kind: "status" | "bindings"): boolean;
|
|
785
|
+
/** 启动:建连接(异步握手,日志可见)+ 订阅 kernel 消息。 */
|
|
786
|
+
private startKurobot;
|
|
787
|
+
/** 配置热更新:停旧连接/退订 → 按新配置重建(对齐 satori reloadTransports)。 */
|
|
788
|
+
private reloadKurobot;
|
|
789
|
+
/** 停止:退订 + 关连接 + 清 pending 表。 */
|
|
790
|
+
private stopAll;
|
|
791
|
+
/** 握手成功:绑定集整体替换为服务端快照 + 清上一连接的 pending 表。 */
|
|
792
|
+
private onEstablished;
|
|
793
|
+
/** 连接永久停止(1002/1008/hello_ack 拒绝):清 pending(绑定集留给下次握手覆盖)。 */
|
|
794
|
+
private onEnded;
|
|
795
|
+
/** 服务端帧分发(渲染回群 / 缓存 / 绑定集维护 / 命令结果关联回发)。 */
|
|
796
|
+
private onServerFrame;
|
|
797
|
+
/** query_result 处理:bindings 刷新绑定集(防御性收窄);status 缓存。 */
|
|
798
|
+
private onQueryResult;
|
|
799
|
+
/** kernel 群消息 → kurobot 出站(仅群聊 + 自消息过滤 + 命令分流 + 绑定过滤)。 */
|
|
800
|
+
private handleIncomingMessage;
|
|
801
|
+
/** 发 chat 事件帧(无 id)。 */
|
|
802
|
+
private sendChat;
|
|
803
|
+
/** 发 command 请求帧(登记 pending 表供 command_result 关联)。 */
|
|
804
|
+
private sendCommand;
|
|
805
|
+
/** 群文本发送(失败 error 日志不抛出——不影响连接与收链路)。 */
|
|
806
|
+
private sendToGroup;
|
|
807
|
+
/** 当前生效配置(收链路保证已 start)。 */
|
|
808
|
+
private requireConfig;
|
|
809
|
+
/** 订阅 kernel 消息事件(幂等)。 */
|
|
810
|
+
private subscribe;
|
|
811
|
+
/** 退订(幂等)。 */
|
|
812
|
+
private unsubscribeAll;
|
|
813
|
+
}
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region src/kurobot/translate.d.ts
|
|
816
|
+
/** 发往 QQ 文本的总长上限(超出截断追加 …(截断);任务书对 command_result 规定,统一套用)。 */
|
|
817
|
+
declare const MAX_GROUP_TEXT_LENGTH = 1500;
|
|
818
|
+
/** 超长截断(按 UTF-16 码元计,超限部分丢弃)。 */
|
|
819
|
+
declare function truncateForGroup(text: string): string;
|
|
820
|
+
/** QQ 群消息发送者显示名:sendMemberName ?? sendNickName(双空兜底 senderUin,schema min(1))。 */
|
|
821
|
+
declare function resolveSenderName(msg: RawMessage): string;
|
|
822
|
+
/** canonical 元素序列 → 降级文本(text 原文、@、图片/表情/回复占位;空白返回 null = 不发)。 */
|
|
823
|
+
declare function degradeElements(elements: CanonicalElement[]): string | null;
|
|
824
|
+
/** RawMessage → 降级文本(便捷封装;null = 空消息不发)。 */
|
|
825
|
+
declare function degradeMessage(msg: RawMessage): string | null;
|
|
826
|
+
/** 渲染模板变量(player 必有;content = 聊天内容;message = 死亡消息)。 */
|
|
827
|
+
interface TemplateVars {
|
|
828
|
+
player: string;
|
|
829
|
+
content?: string;
|
|
830
|
+
message?: string;
|
|
831
|
+
}
|
|
832
|
+
/** 渲染模板:替换 {player}/{content}/{message} 占位符(未知占位符原样保留)。 */
|
|
833
|
+
declare function renderTemplate(template: string, vars: TemplateVars): string;
|
|
834
|
+
/** death 事件 → 群文本(message 空串时以「死亡了」代入:Bukkit deathMessage null 兜底)。 */
|
|
835
|
+
declare function renderDeathText(template: string, player: string, message: string): string;
|
|
836
|
+
/** command_result body → 群文本(ok 合并 output;error → 命令失败:{error})。 */
|
|
837
|
+
declare function renderCommandResult(body: CommandResultBody): string;
|
|
838
|
+
//#endregion
|
|
839
|
+
export { type BindingsUpdatedBody, type CommandBody, type CommandFrame, type CommandResultBody, type ConnectionEndedReason, type DeathBody, type GameChatBody, type HelloAckBody, type HelloBody, type JoinBody, type KurobotAdapterOptions, type KurobotConfig, KurobotConnection, type KurobotConnectionOptions, type KurobotHello, type KurobotLogger, type KurobotMsgApi, type LeaveBody, MAX_GROUP_TEXT_LENGTH, NapukettoKurobotAdapter, PROTOCOL_NAME, PROTOCOL_VERSION, type PlatformChatBody, type QueryResultBody, type ServerEventMessage, type StatusBody, WS_SUBPROTOCOL, bindingsUpdatedFrame, commandFrame, commandResultFrame, deathFrame, degradeElements, degradeMessage, encodeFrame, gameChatFrame, helloAckFrame, helloFrame, isProtocolVersionCompatible, joinFrame, kurobotConfigDefaults, kurobotConfigSchema, leaveFrame, pingFrame, platformChatFrame, pongFrame, queryFrame, queryResultFrame, renderCommandResult, renderDeathText, renderTemplate, resolveSenderName, statusFrame, truncateForGroup, wireFrameSchema };
|
|
840
|
+
//# sourceMappingURL=index.d.mts.map
|