@im-more/dsh-kook 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/cordis.patch.yml +12 -0
- package/lib/index.js +2380 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +53 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +138 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +46 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +52 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/decode.d.ts +88 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +564 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +46 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +159 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +17 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +24 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +15 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/kmarkdown.d.ts +76 -0
- package/lib/types/kmarkdown.d.ts.map +1 -0
- package/lib/types/kmarkdown.js +201 -0
- package/lib/types/kmarkdown.js.map +1 -0
- package/lib/types/modes/kmarkdown.d.ts +17 -0
- package/lib/types/modes/kmarkdown.d.ts.map +1 -0
- package/lib/types/modes/kmarkdown.js +166 -0
- package/lib/types/modes/kmarkdown.js.map +1 -0
- package/lib/types/modes/shared.d.ts +192 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +371 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/request.d.ts +53 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +147 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/send.d.ts +57 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +141 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/types.d.ts +807 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/types.js +168 -0
- package/lib/types/types.js.map +1 -0
- package/lib/types/webhook.d.ts +35 -0
- package/lib/types/webhook.d.ts.map +1 -0
- package/lib/types/webhook.js +132 -0
- package/lib/types/webhook.js.map +1 -0
- package/lib/types/ws.d.ts +54 -0
- package/lib/types/ws.d.ts.map +1 -0
- package/lib/types/ws.js +358 -0
- package/lib/types/ws.js.map +1 -0
- package/package.json +61 -3
- package/src/bot.ts +217 -0
- package/src/config.ts +84 -0
- package/src/decode.ts +660 -0
- package/src/errors.ts +188 -0
- package/src/identity.ts +32 -0
- package/src/index.ts +80 -0
- package/src/kmarkdown.ts +246 -0
- package/src/modes/kmarkdown.ts +204 -0
- package/src/modes/shared.ts +498 -0
- package/src/request.ts +196 -0
- package/src/send.ts +216 -0
- package/src/types.ts +764 -0
- package/src/webhook.ts +170 -0
- package/src/ws.ts +431 -0
- package/README.md +0 -3
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Draft model of the single `kmarkdown` mode: the node stream, the text/card buffers, the documented card budgets, and
|
|
3
|
+
* the exact request body of one platform message.
|
|
4
|
+
*
|
|
5
|
+
* One logical message is either kmarkdown (`type: 9`) or card JSON (`type: 10`), exactly as the upstream encoder
|
|
6
|
+
* flushes: text alone stays a `type: 9` message, and the first element that needs a card module (media, a button, a
|
|
7
|
+
* divider) turns the whole message into a card.
|
|
8
|
+
*/
|
|
9
|
+
import { isPhrasingContainer } from '@deepseek-ai/satori-element';
|
|
10
|
+
import { inlineKMarkdown, splitKMarkdown } from "../kmarkdown.js";
|
|
11
|
+
/** KOOK's documented bounds; nothing else is a limit. */
|
|
12
|
+
export const KOOK_LIMITS = {
|
|
13
|
+
/** `content` of one message ("请不要超过 8000 字符"). */
|
|
14
|
+
textChars: 8_000,
|
|
15
|
+
/** kmarkdown text of one section/context module. */
|
|
16
|
+
sectionChars: 5_000,
|
|
17
|
+
/** Modules of one card. */
|
|
18
|
+
cardModules: 50,
|
|
19
|
+
/** Buttons of one `action-group`. */
|
|
20
|
+
buttonsPerRow: 4,
|
|
21
|
+
/** Images of one `image-group`. */
|
|
22
|
+
imagesPerGroup: 9,
|
|
23
|
+
/** `page_size` of `/guild/user-list`. */
|
|
24
|
+
membersPageSize: 50,
|
|
25
|
+
};
|
|
26
|
+
/** A paragraph break node. */
|
|
27
|
+
export const BREAK = { type: 'break' };
|
|
28
|
+
/**
|
|
29
|
+
* One text node holding already encoded kmarkdown.
|
|
30
|
+
* @param text - kmarkdown text.
|
|
31
|
+
* @returns the node.
|
|
32
|
+
*/
|
|
33
|
+
export function textNode(text) {
|
|
34
|
+
return { type: 'text', text };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Group items into runs of at most `size`.
|
|
38
|
+
* @param items - the items, in order.
|
|
39
|
+
* @param size - maximum run length.
|
|
40
|
+
* @returns the runs, in order.
|
|
41
|
+
*/
|
|
42
|
+
export function chunk(items, size) {
|
|
43
|
+
const runs = [];
|
|
44
|
+
for (let start = 0; start < items.length; start += size) {
|
|
45
|
+
runs.push(items.slice(start, start + size));
|
|
46
|
+
}
|
|
47
|
+
return runs;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The card `image-group` runs of an image list (1–9 images each; DSH has no album element yet, so only a future
|
|
51
|
+
* caller uses this).
|
|
52
|
+
* @param images - the images, in order.
|
|
53
|
+
* @returns the groups, in order.
|
|
54
|
+
*/
|
|
55
|
+
export function groupImages(images) {
|
|
56
|
+
return chunk(images, KOOK_LIMITS.imagesPerGroup);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The platform colour of a button theme.
|
|
60
|
+
* @param theme - the element's theme, when it declared one.
|
|
61
|
+
* @returns the KOOK button colour.
|
|
62
|
+
*/
|
|
63
|
+
export function themeOf(theme) {
|
|
64
|
+
switch (theme) {
|
|
65
|
+
case 'info':
|
|
66
|
+
case 'success':
|
|
67
|
+
case 'warning':
|
|
68
|
+
case 'danger':
|
|
69
|
+
return theme;
|
|
70
|
+
default:
|
|
71
|
+
return 'primary';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The name of an outbound attachment: the declared name, else the last path segment of the source. */
|
|
75
|
+
export function fileName(name, src) {
|
|
76
|
+
if (name !== undefined && name !== '')
|
|
77
|
+
return name;
|
|
78
|
+
try {
|
|
79
|
+
const segment = new URL(src).pathname.split('/').pop();
|
|
80
|
+
if (segment !== undefined && segment !== '')
|
|
81
|
+
return decodeURIComponent(segment);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
// Not a URL: the source itself is the best name available.
|
|
85
|
+
error;
|
|
86
|
+
if (src !== '' && !src.includes('/'))
|
|
87
|
+
return src;
|
|
88
|
+
}
|
|
89
|
+
return 'file';
|
|
90
|
+
}
|
|
91
|
+
/** The kmarkdown text of a node list (a button label, a link label). */
|
|
92
|
+
export function textOf(nodes) {
|
|
93
|
+
return inlineKMarkdown(nodes.filter((node) => node.type === 'text'));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Wrap every text run of a node list with one kmarkdown construct.
|
|
97
|
+
*
|
|
98
|
+
* Each contiguous text run is wrapped on its own, so a media node between two runs never leaves a marker open across
|
|
99
|
+
* the card module boundary. Nested marks compose (`<b><i>x</i></b>` → `***x***`), as the upstream encoder emits.
|
|
100
|
+
*
|
|
101
|
+
* @param nodes - rendered children.
|
|
102
|
+
* @param open - opening marker.
|
|
103
|
+
* @param close - closing marker, `open` when symmetric.
|
|
104
|
+
* @returns the children with their text runs wrapped.
|
|
105
|
+
*/
|
|
106
|
+
export function withMark(nodes, open, close = open) {
|
|
107
|
+
const out = [];
|
|
108
|
+
let run = [];
|
|
109
|
+
const flush = () => {
|
|
110
|
+
if (run.length === 0)
|
|
111
|
+
return;
|
|
112
|
+
out.push(textNode(open + run.join('') + close));
|
|
113
|
+
run = [];
|
|
114
|
+
};
|
|
115
|
+
for (const node of nodes) {
|
|
116
|
+
if (node.type === 'text') {
|
|
117
|
+
run.push(node.text);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
flush();
|
|
121
|
+
out.push(node);
|
|
122
|
+
}
|
|
123
|
+
flush();
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Prefix every line of a node list with the quote marker.
|
|
128
|
+
* @param nodes - rendered children.
|
|
129
|
+
* @returns the children with `> ` at the start of every line.
|
|
130
|
+
*/
|
|
131
|
+
export function quoteLines(nodes) {
|
|
132
|
+
const out = [];
|
|
133
|
+
let atLineStart = true;
|
|
134
|
+
for (const node of nodes) {
|
|
135
|
+
if (node.type === 'break') {
|
|
136
|
+
// A paragraph boundary starts a line; the next text node of a nested quote gets its own marker.
|
|
137
|
+
atLineStart = true;
|
|
138
|
+
out.push(node);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (node.type !== 'text') {
|
|
142
|
+
out.push(node);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
let text = '';
|
|
146
|
+
for (const char of node.text) {
|
|
147
|
+
if (atLineStart && char !== '\n')
|
|
148
|
+
text += '> ';
|
|
149
|
+
text += char;
|
|
150
|
+
atLineStart = char === '\n';
|
|
151
|
+
}
|
|
152
|
+
out.push(textNode(text));
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The media node of one attachment element, reporting a phrasing-position attachment as `moved`.
|
|
158
|
+
* @param el - one of `img`/`audio`/`video`/`file`.
|
|
159
|
+
* @param ctx - render context of the mode.
|
|
160
|
+
* @returns the node.
|
|
161
|
+
*/
|
|
162
|
+
export function mediaNode(el, ctx) {
|
|
163
|
+
const parent = ctx.ancestors[ctx.ancestors.length - 1];
|
|
164
|
+
if (parent !== undefined && isPhrasingContainer(parent.type)) {
|
|
165
|
+
ctx.report.moved.push({
|
|
166
|
+
tag: el.type,
|
|
167
|
+
reason: 'kook-media-split',
|
|
168
|
+
path: ctx.stableId(el),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
switch (el.type) {
|
|
172
|
+
case 'img':
|
|
173
|
+
return { type: 'image', ref: ctx.resource('image', el.attrs.src, {}) };
|
|
174
|
+
case 'audio':
|
|
175
|
+
return {
|
|
176
|
+
type: 'media',
|
|
177
|
+
kind: 'audio',
|
|
178
|
+
ref: ctx.resource('audio', el.attrs.src, el.attrs.name === undefined ? {} : { name: el.attrs.name }),
|
|
179
|
+
title: fileName(el.attrs.name, el.attrs.src),
|
|
180
|
+
};
|
|
181
|
+
case 'video':
|
|
182
|
+
return {
|
|
183
|
+
type: 'media',
|
|
184
|
+
kind: 'video',
|
|
185
|
+
ref: ctx.resource('video', el.attrs.src, el.attrs.name === undefined ? {} : { name: el.attrs.name }),
|
|
186
|
+
title: fileName(el.attrs.name, el.attrs.src),
|
|
187
|
+
};
|
|
188
|
+
case 'file':
|
|
189
|
+
return {
|
|
190
|
+
type: 'media',
|
|
191
|
+
kind: 'file',
|
|
192
|
+
ref: ctx.resource('file', el.attrs.src, el.attrs.name === undefined ? {} : { name: el.attrs.name }),
|
|
193
|
+
title: fileName(el.attrs.name, el.attrs.src),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Fold the rendered node stream into platform messages.
|
|
199
|
+
*
|
|
200
|
+
* Text accumulates in one buffer; the first media, button or divider element turns the message into a card and every
|
|
201
|
+
* text run becomes a `section`. A card holds at most 50 modules, a section at most 5,000 visible characters, and a
|
|
202
|
+
* kmarkdown message at most 8,000: the buffer is cut at those bounds and each extra platform message is reported as a
|
|
203
|
+
* split. The result is never empty.
|
|
204
|
+
*
|
|
205
|
+
* @param nodes - rendered nodes in document order.
|
|
206
|
+
* @param ctx - render context, for the split and moved report.
|
|
207
|
+
* @returns one draft per platform message.
|
|
208
|
+
*/
|
|
209
|
+
export function assembleDraft(nodes, ctx) {
|
|
210
|
+
const drafts = [];
|
|
211
|
+
let text = '';
|
|
212
|
+
let modules = [];
|
|
213
|
+
let card = false;
|
|
214
|
+
const flushCard = () => {
|
|
215
|
+
if (modules.length === 0)
|
|
216
|
+
return;
|
|
217
|
+
drafts.push({ kind: 'card', modules });
|
|
218
|
+
modules = [];
|
|
219
|
+
};
|
|
220
|
+
const pushModule = (module) => {
|
|
221
|
+
card = true;
|
|
222
|
+
modules.push(module);
|
|
223
|
+
// A card accepts at most 50 modules; the next one starts another message, so a card never exceeds its budget.
|
|
224
|
+
if (modules.length >= KOOK_LIMITS.cardModules)
|
|
225
|
+
flushCard();
|
|
226
|
+
};
|
|
227
|
+
const flushText = () => {
|
|
228
|
+
const content = text.trim();
|
|
229
|
+
text = '';
|
|
230
|
+
if (content === '')
|
|
231
|
+
return;
|
|
232
|
+
for (const section of splitKMarkdown(content, KOOK_LIMITS.sectionChars)) {
|
|
233
|
+
pushModule({ type: 'section', content: section });
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const lineBreak = () => {
|
|
237
|
+
if (text === '')
|
|
238
|
+
return;
|
|
239
|
+
if (text.endsWith('\n'))
|
|
240
|
+
return;
|
|
241
|
+
text += '\n';
|
|
242
|
+
};
|
|
243
|
+
for (const node of nodes) {
|
|
244
|
+
switch (node.type) {
|
|
245
|
+
case 'text':
|
|
246
|
+
text += node.text;
|
|
247
|
+
break;
|
|
248
|
+
case 'break':
|
|
249
|
+
lineBreak();
|
|
250
|
+
break;
|
|
251
|
+
case 'divider':
|
|
252
|
+
flushText();
|
|
253
|
+
pushModule({ type: 'divider' });
|
|
254
|
+
break;
|
|
255
|
+
case 'image':
|
|
256
|
+
flushText();
|
|
257
|
+
pushModule({ type: 'container', image: { ref: node.ref } });
|
|
258
|
+
break;
|
|
259
|
+
case 'media':
|
|
260
|
+
flushText();
|
|
261
|
+
pushModule({
|
|
262
|
+
type: 'media',
|
|
263
|
+
kind: node.kind,
|
|
264
|
+
ref: node.ref,
|
|
265
|
+
title: node.title,
|
|
266
|
+
});
|
|
267
|
+
break;
|
|
268
|
+
case 'buttons':
|
|
269
|
+
flushText();
|
|
270
|
+
pushModule({ type: 'buttons', buttons: node.buttons });
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (card) {
|
|
275
|
+
flushText();
|
|
276
|
+
flushCard();
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
const content = text.trim();
|
|
280
|
+
if (content !== '') {
|
|
281
|
+
for (const part of splitKMarkdown(content, KOOK_LIMITS.textChars)) {
|
|
282
|
+
drafts.push({ kind: 'text', content: part });
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (drafts.length === 0)
|
|
287
|
+
drafts.push({ kind: 'text', content: '\u2060' });
|
|
288
|
+
ctx.report.split += drafts.length - 1;
|
|
289
|
+
return drafts;
|
|
290
|
+
}
|
|
291
|
+
/** The resource key `prepare` resolved for one media source. */
|
|
292
|
+
function resolvedKey(prepared, ref) {
|
|
293
|
+
const resolved = prepared.resolved.get(ref);
|
|
294
|
+
if (resolved === undefined) {
|
|
295
|
+
throw new Error('kook: the media was not prepared before serialize');
|
|
296
|
+
}
|
|
297
|
+
return resolved.key;
|
|
298
|
+
}
|
|
299
|
+
/** One image as a card element. */
|
|
300
|
+
function imageOf(prepared, image) {
|
|
301
|
+
return { type: 'image', src: resolvedKey(prepared, image.ref) };
|
|
302
|
+
}
|
|
303
|
+
/** One button as a card element. */
|
|
304
|
+
function buttonOf(button) {
|
|
305
|
+
return {
|
|
306
|
+
type: 'button',
|
|
307
|
+
theme: button.theme,
|
|
308
|
+
value: button.value,
|
|
309
|
+
click: button.click,
|
|
310
|
+
text: { type: 'kmarkdown', content: button.text },
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/** One draft module as the wire module(s) it produces. */
|
|
314
|
+
function modulesOf(prepared, module) {
|
|
315
|
+
switch (module.type) {
|
|
316
|
+
case 'section':
|
|
317
|
+
return [
|
|
318
|
+
{
|
|
319
|
+
type: 'section',
|
|
320
|
+
text: { type: 'kmarkdown', content: module.content },
|
|
321
|
+
},
|
|
322
|
+
];
|
|
323
|
+
case 'container':
|
|
324
|
+
return [
|
|
325
|
+
{ type: 'container', elements: [imageOf(prepared, module.image)] },
|
|
326
|
+
];
|
|
327
|
+
case 'image-group':
|
|
328
|
+
return groupImages(module.images).map((images) => ({
|
|
329
|
+
type: 'image-group',
|
|
330
|
+
elements: images.map((image) => imageOf(prepared, image)),
|
|
331
|
+
}));
|
|
332
|
+
case 'buttons':
|
|
333
|
+
return chunk(module.buttons, KOOK_LIMITS.buttonsPerRow).map((buttons) => ({
|
|
334
|
+
type: 'action-group',
|
|
335
|
+
elements: buttons.map(buttonOf),
|
|
336
|
+
}));
|
|
337
|
+
case 'divider':
|
|
338
|
+
return [{ type: 'divider' }];
|
|
339
|
+
case 'media':
|
|
340
|
+
return [
|
|
341
|
+
{
|
|
342
|
+
type: module.kind,
|
|
343
|
+
src: resolvedKey(prepared, module.ref),
|
|
344
|
+
title: module.title,
|
|
345
|
+
},
|
|
346
|
+
];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Build the exact request body of one draft.
|
|
351
|
+
*
|
|
352
|
+
* Only the first platform message answers the quoted one; `SerializeContext.quote` reaches every part, so the adapter
|
|
353
|
+
* picks the one that carries it.
|
|
354
|
+
*
|
|
355
|
+
* @param prepared - the draft with every resource resolved.
|
|
356
|
+
* @param ctx - serialize context (part index and quote).
|
|
357
|
+
* @returns the request body.
|
|
358
|
+
*/
|
|
359
|
+
export function serializeDraft(prepared, ctx) {
|
|
360
|
+
const quote = ctx.index === 0 ? ctx.quote : undefined;
|
|
361
|
+
const common = quote === undefined ? {} : { quote };
|
|
362
|
+
if (prepared.draft.kind === 'text') {
|
|
363
|
+
return { kind: 'text', type: 9, content: prepared.draft.content, ...common };
|
|
364
|
+
}
|
|
365
|
+
const card = {
|
|
366
|
+
type: 'card',
|
|
367
|
+
modules: prepared.draft.modules.flatMap((module) => modulesOf(prepared, module)),
|
|
368
|
+
};
|
|
369
|
+
return { kind: 'card', type: 10, content: JSON.stringify([card]), ...common };
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/modes/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEjE,yDAAyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,kDAAkD;IAClD,SAAS,EAAE,KAAK;IAChB,oDAAoD;IACpD,YAAY,EAAE,KAAK;IACnB,2BAA2B;IAC3B,WAAW,EAAE,EAAE;IACf,qCAAqC;IACrC,aAAa,EAAE,CAAC;IAChB,mCAAmC;IACnC,cAAc,EAAE,CAAC;IACjB,yCAAyC;IACzC,eAAe,EAAE,EAAE;CACX,CAAA;AAmEV,8BAA8B;AAC9B,MAAM,CAAC,MAAM,KAAK,GAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAI,KAAmB,EAAE,IAAY;IACxD,MAAM,IAAI,GAAU,EAAE,CAAA;IACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;QACxD,IAA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,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IACrD,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAA;IACnD,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,MAAM,EAAE,CAAA;IAC9E,CAAC;IACD,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CACjD,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAC5B;KACF,CAAA;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAA;AAC/E,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KOOK API transport: one request path for every v3 endpoint, the `{ code, message, data }` envelope and its error
|
|
3
|
+
* classification input, and the rate-limit headers.
|
|
4
|
+
*
|
|
5
|
+
* The typed method surface lives on `Internal` (`types.ts`); this module owns the wire mechanics so the migrated
|
|
6
|
+
* client and the adapter's own calls cannot diverge.
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
+
/** Endpoints and credentials shared by every KOOK API request of one bot. */
|
|
10
|
+
export interface KookRequest {
|
|
11
|
+
readonly ctx: Context;
|
|
12
|
+
/** API root without a trailing slash. */
|
|
13
|
+
readonly baseUrl: string;
|
|
14
|
+
/** Bot token, sent as `Authorization: Bot <token>`. */
|
|
15
|
+
readonly token: string;
|
|
16
|
+
}
|
|
17
|
+
/** The KOOK response envelope: `code === 0` means the call succeeded and `data` carries its answer. */
|
|
18
|
+
export interface KookEnvelope<T = unknown> {
|
|
19
|
+
code?: number;
|
|
20
|
+
message?: string;
|
|
21
|
+
data?: T;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build the request endpoints for one bot.
|
|
25
|
+
* @param ctx - context whose `http` service performs requests.
|
|
26
|
+
* @param apiBaseUrl - API root (`https://www.kookapp.cn/api/v3`).
|
|
27
|
+
* @param token - bot token.
|
|
28
|
+
* @returns the shared request endpoints.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createKookRequest(ctx: Context, apiBaseUrl: string, token: string): KookRequest;
|
|
31
|
+
/**
|
|
32
|
+
* Delay a rate-limited answer asked for, in milliseconds.
|
|
33
|
+
*
|
|
34
|
+
* KOOK documents `X-Rate-Limit-Reset` (seconds) and says nothing about `Retry-After`; both are read, the standard
|
|
35
|
+
* header first, because an undocumented one is only useful while it is present.
|
|
36
|
+
*
|
|
37
|
+
* @param response - the answer.
|
|
38
|
+
* @returns the delay in milliseconds, or undefined when neither header is present or readable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function retryAfterOf(response: Response): number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Call one KOOK API endpoint and return its envelope's `data`.
|
|
43
|
+
*
|
|
44
|
+
* @param request - endpoints for this bot.
|
|
45
|
+
* @param method - HTTP method (`GET`, `POST`, `DELETE`).
|
|
46
|
+
* @param path - endpoint below the API root (`/message/create`).
|
|
47
|
+
* @param payload - query parameters of `GET`/`DELETE`, else the request body (JSON or a multipart form).
|
|
48
|
+
* @param signal - cancellation.
|
|
49
|
+
* @returns the endpoint's `data` field.
|
|
50
|
+
* @throws KookApiError for a transport failure, a non-2xx answer or a non-zero business code.
|
|
51
|
+
*/
|
|
52
|
+
export declare function invoke<T = unknown>(request: KookRequest, method: string, path: string, payload?: object, signal?: AbortSignal): Promise<T>;
|
|
53
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IACrB,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,uGAAuG;AACvG,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,CAAC,CAAA;CACT;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,WAAW,CAEb;AAiCD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAYnE;AAqBD;;;;;;;;;;GAUG;AACH,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EACtC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,CAAC,CA8DZ"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KOOK API transport: one request path for every v3 endpoint, the `{ code, message, data }` envelope and its error
|
|
3
|
+
* classification input, and the rate-limit headers.
|
|
4
|
+
*
|
|
5
|
+
* The typed method surface lives on `Internal` (`types.ts`); this module owns the wire mechanics so the migrated
|
|
6
|
+
* client and the adapter's own calls cannot diverge.
|
|
7
|
+
*/
|
|
8
|
+
import { KookApiError } from "./errors.js";
|
|
9
|
+
/**
|
|
10
|
+
* Build the request endpoints for one bot.
|
|
11
|
+
* @param ctx - context whose `http` service performs requests.
|
|
12
|
+
* @param apiBaseUrl - API root (`https://www.kookapp.cn/api/v3`).
|
|
13
|
+
* @param token - bot token.
|
|
14
|
+
* @returns the shared request endpoints.
|
|
15
|
+
*/
|
|
16
|
+
export function createKookRequest(ctx, apiBaseUrl, token) {
|
|
17
|
+
return { ctx, baseUrl: apiBaseUrl.replace(/\/+$/, ''), token };
|
|
18
|
+
}
|
|
19
|
+
/** Whether a caught value is the abort error of a cancelled request. */
|
|
20
|
+
function isAbortError(error) {
|
|
21
|
+
return ((error instanceof Error || error instanceof DOMException) &&
|
|
22
|
+
error.name === 'AbortError');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Deliver the cancellation of a request: the signal's reason when it aborted, else the error `ctx.http` produced.
|
|
26
|
+
* @param cause - the value `ctx.http` rejected with.
|
|
27
|
+
* @param signal - the cancellation signal handed to the request.
|
|
28
|
+
* @returns the error to rethrow.
|
|
29
|
+
*/
|
|
30
|
+
function cancellation(cause, signal) {
|
|
31
|
+
return signal?.aborted === true ? signal.reason : cause;
|
|
32
|
+
}
|
|
33
|
+
/** Whether a failed request was cancelled, by its signal or by the error the transport produced. */
|
|
34
|
+
function isCancellation(cause, signal) {
|
|
35
|
+
if (signal?.aborted === true)
|
|
36
|
+
return true;
|
|
37
|
+
if (isAbortError(cause))
|
|
38
|
+
return true;
|
|
39
|
+
return signal?.reason !== undefined && cause === signal.reason;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Delay a rate-limited answer asked for, in milliseconds.
|
|
43
|
+
*
|
|
44
|
+
* KOOK documents `X-Rate-Limit-Reset` (seconds) and says nothing about `Retry-After`; both are read, the standard
|
|
45
|
+
* header first, because an undocumented one is only useful while it is present.
|
|
46
|
+
*
|
|
47
|
+
* @param response - the answer.
|
|
48
|
+
* @returns the delay in milliseconds, or undefined when neither header is present or readable.
|
|
49
|
+
*/
|
|
50
|
+
export function retryAfterOf(response) {
|
|
51
|
+
const standard = response.headers.get('retry-after');
|
|
52
|
+
if (standard !== null) {
|
|
53
|
+
const seconds = Number(standard);
|
|
54
|
+
if (Number.isFinite(seconds) && seconds >= 0)
|
|
55
|
+
return seconds * 1_000;
|
|
56
|
+
}
|
|
57
|
+
const reset = response.headers.get('x-rate-limit-reset');
|
|
58
|
+
if (reset !== null) {
|
|
59
|
+
const seconds = Number(reset);
|
|
60
|
+
if (Number.isFinite(seconds) && seconds >= 0)
|
|
61
|
+
return seconds * 1_000;
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
/** Read a JSON answer; an unreadable body is reported as absence rather than a parse error. */
|
|
66
|
+
async function jsonOf(response) {
|
|
67
|
+
let body;
|
|
68
|
+
try {
|
|
69
|
+
body = await response.json();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
// The answer carried no JSON (a proxy error page, a compressed body): the caller reports the status instead.
|
|
73
|
+
error;
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
if (typeof body !== 'object' || body === null)
|
|
77
|
+
return undefined;
|
|
78
|
+
return body;
|
|
79
|
+
}
|
|
80
|
+
/** The URL of one request. */
|
|
81
|
+
function urlOf(request, path) {
|
|
82
|
+
return `${request.baseUrl}${path.startsWith('/') ? path : `/${path}`}`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Call one KOOK API endpoint and return its envelope's `data`.
|
|
86
|
+
*
|
|
87
|
+
* @param request - endpoints for this bot.
|
|
88
|
+
* @param method - HTTP method (`GET`, `POST`, `DELETE`).
|
|
89
|
+
* @param path - endpoint below the API root (`/message/create`).
|
|
90
|
+
* @param payload - query parameters of `GET`/`DELETE`, else the request body (JSON or a multipart form).
|
|
91
|
+
* @param signal - cancellation.
|
|
92
|
+
* @returns the endpoint's `data` field.
|
|
93
|
+
* @throws KookApiError for a transport failure, a non-2xx answer or a non-zero business code.
|
|
94
|
+
*/
|
|
95
|
+
export async function invoke(request, method, path, payload, signal) {
|
|
96
|
+
const config = {
|
|
97
|
+
method,
|
|
98
|
+
headers: { authorization: `Bot ${request.token}` },
|
|
99
|
+
};
|
|
100
|
+
if (method === 'GET' || method === 'DELETE')
|
|
101
|
+
config.params = payload ?? {};
|
|
102
|
+
else
|
|
103
|
+
config.data = payload ?? {};
|
|
104
|
+
if (signal !== undefined)
|
|
105
|
+
config.signal = signal;
|
|
106
|
+
let response;
|
|
107
|
+
try {
|
|
108
|
+
response = await request.ctx.http(urlOf(request, path), config);
|
|
109
|
+
}
|
|
110
|
+
catch (cause) {
|
|
111
|
+
if (isCancellation(cause, signal))
|
|
112
|
+
throw cancellation(cause, signal);
|
|
113
|
+
throw new KookApiError(`kook ${method} ${path} request failed`, { cause });
|
|
114
|
+
}
|
|
115
|
+
const status = response.status;
|
|
116
|
+
const retryAfterMs = retryAfterOf(response);
|
|
117
|
+
const body = await jsonOf(response);
|
|
118
|
+
if (body === undefined) {
|
|
119
|
+
// Reading the body fails when the answer is cut short by cancellation; that is still a cancellation.
|
|
120
|
+
if (signal?.aborted === true)
|
|
121
|
+
throw signal.reason;
|
|
122
|
+
throw new KookApiError(`kook ${method} ${path} answered ${status} without a JSON envelope`, { status, ...(retryAfterMs === undefined ? {} : { retryAfterMs }) });
|
|
123
|
+
}
|
|
124
|
+
if (status === 429) {
|
|
125
|
+
throw new KookApiError(`kook ${method} ${path} was rate limited`, {
|
|
126
|
+
status,
|
|
127
|
+
...(typeof body.code === 'number' ? { code: body.code } : {}),
|
|
128
|
+
...(retryAfterMs === undefined ? {} : { retryAfterMs }),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (body.code !== 0) {
|
|
132
|
+
throw new KookApiError(`kook ${method} ${path} failed: ${body.message ?? 'the answer carries no success code'}`, {
|
|
133
|
+
status,
|
|
134
|
+
...(typeof body.code === 'number' ? { code: body.code } : {}),
|
|
135
|
+
...(retryAfterMs === undefined ? {} : { retryAfterMs }),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (status >= 400) {
|
|
139
|
+
throw new KookApiError(`kook ${method} ${path} answered ${status} with a success envelope`, {
|
|
140
|
+
status,
|
|
141
|
+
code: body.code,
|
|
142
|
+
...(retryAfterMs === undefined ? {} : { retryAfterMs }),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return body.data;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAkB1C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAY,EACZ,UAAkB,EAClB,KAAa;IAEb,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAA;AAChE,CAAC;AAED,wEAAwE;AACxE,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,CACL,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,YAAY,YAAY,CAAC;QACzD,KAAK,CAAC,IAAI,KAAK,YAAY,CAC5B,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CACnB,KAAc,EACd,MAA+B;IAE/B,OAAO,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA;AACzD,CAAC;AAED,oGAAoG;AACpG,SAAS,cAAc,CACrB,KAAc,EACd,MAA+B;IAE/B,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CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;SACxD,CACF,CAAA;IACH,CAAC;IACD,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAClB,MAAM,IAAI,YAAY,CACpB,QAAQ,MAAM,IAAI,IAAI,aAAa,MAAM,0BAA0B,EACnE;YACE,MAAM;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;SACxD,CACF,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAC,IAAS,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound hooks: the send pipeline's payload, deletion, member reads and message reads.
|
|
3
|
+
*
|
|
4
|
+
* A channel message goes to `/message/create` (or `/message/view`, `/message/delete`); a direct one goes to the
|
|
5
|
+
* upstream adapter's `/user-chat/*` routes. The two are told apart exactly as upstream tells them apart: a channel id
|
|
6
|
+
* is 16–19 digits and a direct chat code is 32 hexadecimal characters, so the longer id is the direct chat.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChatRef, InboundMessage, MembersPage, MessageHandle, SendContext, SentPart, Target } from '@deepseek-ai/cordis-plugin-im-core';
|
|
9
|
+
import type { KookBot } from './bot.ts';
|
|
10
|
+
import type { KookPayload } from './modes/shared.ts';
|
|
11
|
+
import type { KookRequest } from './request.ts';
|
|
12
|
+
/** Whether a chat id names a direct chat: a `chat_code` (32 hex characters) is longer than a channel id. */
|
|
13
|
+
export declare function isDirectChannel(chatId: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Send one serialized payload.
|
|
16
|
+
*
|
|
17
|
+
* @param request - endpoints for this bot.
|
|
18
|
+
* @param payload - the serialized draft (`type: 9` text or `type: 10` card).
|
|
19
|
+
* @param target - the chat the payload goes to.
|
|
20
|
+
* @param _ctx - part index and quote, already applied by `serialize`.
|
|
21
|
+
* @returns the published part.
|
|
22
|
+
*/
|
|
23
|
+
export declare function sendPayload(request: KookRequest, payload: KookPayload, target: Target, _ctx: SendContext): Promise<SentPart>;
|
|
24
|
+
/**
|
|
25
|
+
* Recall one published part.
|
|
26
|
+
* @param request - endpoints for this bot.
|
|
27
|
+
* @param part - the part to recall.
|
|
28
|
+
* @param handle - the message the part belongs to, which names the chat.
|
|
29
|
+
*/
|
|
30
|
+
export declare function deletePart(request: KookRequest, part: SentPart, handle: MessageHandle): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* List the members of a chat.
|
|
33
|
+
*
|
|
34
|
+
* A group chat pages `/guild/user-list`; the guild id comes from `/channel/view` because the chat only knows its
|
|
35
|
+
* channel. A direct chat has exactly one member, which `/user-chat/view` reports.
|
|
36
|
+
*
|
|
37
|
+
* @param request - endpoints for this bot.
|
|
38
|
+
* @param chat - the chat the caller asked about.
|
|
39
|
+
* @param cursor - page number of the previous page's `next`.
|
|
40
|
+
* @param limit - page size the platform should use (at most 50).
|
|
41
|
+
* @returns one page of members.
|
|
42
|
+
*/
|
|
43
|
+
export declare function members(request: KookRequest, chat: ChatRef, cursor?: string, limit?: number): Promise<MembersPage>;
|
|
44
|
+
/**
|
|
45
|
+
* Read one message by id.
|
|
46
|
+
*
|
|
47
|
+
* The read answer names the channel but not its type, so the requested chat is what the decoded message reports; the
|
|
48
|
+
* host verifies that its id matches the chat it asked about.
|
|
49
|
+
*
|
|
50
|
+
* @param request - endpoints for this bot.
|
|
51
|
+
* @param bot - the adapter, needed to decode the answer.
|
|
52
|
+
* @param chat - the chat the caller asked about.
|
|
53
|
+
* @param id - platform message id.
|
|
54
|
+
* @returns the decoded message.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getMessage(request: KookRequest, bot: KookBot, chat: ChatRef, id: string): Promise<InboundMessage>;
|
|
57
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/send.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,EAEP,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAIvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAS/C,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvD;AAmCD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,QAAQ,CAAC,CAuBnB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC,CAOf;AAQD;;;;;;;;;;;GAWG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CA+BtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,CAAC,CAYzB"}
|