@bili-agent-kit/core 0.1.0 → 0.2.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/dist/index.d.mts CHANGED
@@ -1,5 +1,145 @@
1
1
  import { z } from "zod";
2
2
  export declare const actionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ kind: z.ZodLiteral<"video.like">;
4
+ aid: z.ZodString;
5
+ enabled: z.ZodDefault<z.ZodBoolean>;
6
+ }, z.core.$strict>, z.ZodObject<{
7
+ kind: z.ZodLiteral<"video.coin">;
8
+ aid: z.ZodString;
9
+ count: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
10
+ like: z.ZodDefault<z.ZodBoolean>;
11
+ }, z.core.$strict>, z.ZodObject<{
12
+ kind: z.ZodLiteral<"video.triple">;
13
+ aid: z.ZodString;
14
+ }, z.core.$strict>, z.ZodObject<{
15
+ kind: z.ZodLiteral<"favorite.add">;
16
+ aid: z.ZodString;
17
+ folderId: z.ZodString;
18
+ }, z.core.$strict>, z.ZodObject<{
19
+ kind: z.ZodLiteral<"favorite.remove">;
20
+ aid: z.ZodString;
21
+ folderId: z.ZodString;
22
+ }, z.core.$strict>, z.ZodObject<{
23
+ kind: z.ZodLiteral<"user.follow">;
24
+ uid: z.ZodString;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"user.unfollow">;
27
+ uid: z.ZodString;
28
+ }, z.core.$strict>, z.ZodObject<{
29
+ kind: z.ZodLiteral<"comment.like">;
30
+ oid: z.ZodString;
31
+ rpid: z.ZodString;
32
+ enabled: z.ZodDefault<z.ZodBoolean>;
33
+ }, z.core.$strict>, z.ZodObject<{
34
+ kind: z.ZodLiteral<"video.danmaku">;
35
+ aid: z.ZodString;
36
+ cid: z.ZodString;
37
+ progressMs: z.ZodNumber;
38
+ text: z.ZodString;
39
+ color: z.ZodDefault<z.ZodNumber>;
40
+ mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>;
41
+ fontSize: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<18>, z.ZodLiteral<25>]>>;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ kind: z.ZodLiteral<"dynamic.create">;
44
+ uid: z.ZodString;
45
+ text: z.ZodString;
46
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
47
+ file: z.ZodString;
48
+ sha256: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strict>>>;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ kind: z.ZodLiteral<"dynamic.edit">;
52
+ dynamicId: z.ZodString;
53
+ text: z.ZodString;
54
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
55
+ file: z.ZodString;
56
+ sha256: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strict>>>;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ kind: z.ZodLiteral<"dynamic.delete">;
60
+ dynamicId: z.ZodString;
61
+ }, z.core.$strict>, z.ZodObject<{
62
+ kind: z.ZodLiteral<"open.video.publish">;
63
+ uid: z.ZodString;
64
+ video: z.ZodObject<{
65
+ file: z.ZodString;
66
+ sha256: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strict>;
68
+ cover: z.ZodOptional<z.ZodObject<{
69
+ file: z.ZodString;
70
+ sha256: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strict>>;
72
+ metadata: z.ZodObject<{
73
+ title: z.ZodString;
74
+ tid: z.ZodNumber;
75
+ tag: z.ZodString;
76
+ desc: z.ZodDefault<z.ZodString>;
77
+ copyright: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
78
+ source: z.ZodDefault<z.ZodString>;
79
+ no_reprint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
80
+ }, z.core.$strict>;
81
+ }, z.core.$strict>, z.ZodObject<{
82
+ kind: z.ZodLiteral<"open.video.edit">;
83
+ uid: z.ZodString;
84
+ resourceId: z.ZodString;
85
+ metadata: z.ZodObject<{
86
+ title: z.ZodString;
87
+ tid: z.ZodNumber;
88
+ cover: z.ZodString;
89
+ desc: z.ZodString;
90
+ no_reprint: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
91
+ }, z.core.$strict>;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ kind: z.ZodLiteral<"open.video.delete">;
94
+ uid: z.ZodString;
95
+ resourceId: z.ZodString;
96
+ }, z.core.$strict>, z.ZodObject<{
97
+ kind: z.ZodLiteral<"open.article.publish">;
98
+ uid: z.ZodString;
99
+ metadata: z.ZodObject<{
100
+ title: z.ZodString;
101
+ category: z.ZodNumber;
102
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
103
+ summary: z.ZodString;
104
+ content: z.ZodString;
105
+ banner_url: z.ZodString;
106
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
107
+ image_urls: z.ZodString;
108
+ tags: z.ZodString;
109
+ list_id: z.ZodNumber;
110
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
111
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
112
+ }, z.core.$strict>;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ kind: z.ZodLiteral<"open.article.edit">;
115
+ uid: z.ZodString;
116
+ articleId: z.ZodString;
117
+ metadata: z.ZodObject<{
118
+ title: z.ZodString;
119
+ category: z.ZodNumber;
120
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
121
+ summary: z.ZodString;
122
+ content: z.ZodString;
123
+ banner_url: z.ZodString;
124
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
125
+ image_urls: z.ZodString;
126
+ tags: z.ZodString;
127
+ list_id: z.ZodNumber;
128
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
129
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
130
+ }, z.core.$strict>;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ kind: z.ZodLiteral<"open.article.delete">;
133
+ uid: z.ZodString;
134
+ articleId: z.ZodString;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"open.article.image">;
137
+ uid: z.ZodString;
138
+ image: z.ZodObject<{
139
+ file: z.ZodString;
140
+ sha256: z.ZodOptional<z.ZodString>;
141
+ }, z.core.$strict>;
142
+ }, z.core.$strict>, z.ZodObject<{
3
143
  kind: z.ZodLiteral<"comment.add">;
4
144
  oid: z.ZodString;
5
145
  type: z.ZodDefault<z.ZodLiteral<1>>;
@@ -24,11 +164,13 @@ type WriteAction = z.infer<typeof actionSchema>;
24
164
  type WriteActionInput = z.input<typeof actionSchema>;
25
165
  export declare const policySchema: z.ZodObject<{
26
166
  writesEnabled: z.ZodDefault<z.ZodBoolean>;
167
+ allowedActions: z.ZodDefault<z.ZodArray<z.ZodString>>;
27
168
  allowedTargets: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
169
  trustedDmTargets: z.ZodDefault<z.ZodArray<z.ZodString>>;
29
170
  }, z.core.$strict>;
30
171
  type Policy = z.infer<typeof policySchema>;
31
172
  export declare const credentialSchema: z.ZodObject<{
173
+ refresh_token: z.ZodOptional<z.ZodString>;
32
174
  sessdata: z.ZodString;
33
175
  bili_jct: z.ZodString;
34
176
  buvid3: z.ZodOptional<z.ZodString>;
@@ -53,6 +195,146 @@ declare const draftSchema: z.ZodObject<{
53
195
  account: z.ZodString;
54
196
  digest: z.ZodString;
55
197
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
198
+ kind: z.ZodLiteral<"video.like">;
199
+ aid: z.ZodString;
200
+ enabled: z.ZodDefault<z.ZodBoolean>;
201
+ }, z.core.$strict>, z.ZodObject<{
202
+ kind: z.ZodLiteral<"video.coin">;
203
+ aid: z.ZodString;
204
+ count: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
205
+ like: z.ZodDefault<z.ZodBoolean>;
206
+ }, z.core.$strict>, z.ZodObject<{
207
+ kind: z.ZodLiteral<"video.triple">;
208
+ aid: z.ZodString;
209
+ }, z.core.$strict>, z.ZodObject<{
210
+ kind: z.ZodLiteral<"favorite.add">;
211
+ aid: z.ZodString;
212
+ folderId: z.ZodString;
213
+ }, z.core.$strict>, z.ZodObject<{
214
+ kind: z.ZodLiteral<"favorite.remove">;
215
+ aid: z.ZodString;
216
+ folderId: z.ZodString;
217
+ }, z.core.$strict>, z.ZodObject<{
218
+ kind: z.ZodLiteral<"user.follow">;
219
+ uid: z.ZodString;
220
+ }, z.core.$strict>, z.ZodObject<{
221
+ kind: z.ZodLiteral<"user.unfollow">;
222
+ uid: z.ZodString;
223
+ }, z.core.$strict>, z.ZodObject<{
224
+ kind: z.ZodLiteral<"comment.like">;
225
+ oid: z.ZodString;
226
+ rpid: z.ZodString;
227
+ enabled: z.ZodDefault<z.ZodBoolean>;
228
+ }, z.core.$strict>, z.ZodObject<{
229
+ kind: z.ZodLiteral<"video.danmaku">;
230
+ aid: z.ZodString;
231
+ cid: z.ZodString;
232
+ progressMs: z.ZodNumber;
233
+ text: z.ZodString;
234
+ color: z.ZodDefault<z.ZodNumber>;
235
+ mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>;
236
+ fontSize: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<18>, z.ZodLiteral<25>]>>;
237
+ }, z.core.$strict>, z.ZodObject<{
238
+ kind: z.ZodLiteral<"dynamic.create">;
239
+ uid: z.ZodString;
240
+ text: z.ZodString;
241
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
242
+ file: z.ZodString;
243
+ sha256: z.ZodOptional<z.ZodString>;
244
+ }, z.core.$strict>>>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ kind: z.ZodLiteral<"dynamic.edit">;
247
+ dynamicId: z.ZodString;
248
+ text: z.ZodString;
249
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
250
+ file: z.ZodString;
251
+ sha256: z.ZodOptional<z.ZodString>;
252
+ }, z.core.$strict>>>;
253
+ }, z.core.$strict>, z.ZodObject<{
254
+ kind: z.ZodLiteral<"dynamic.delete">;
255
+ dynamicId: z.ZodString;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ kind: z.ZodLiteral<"open.video.publish">;
258
+ uid: z.ZodString;
259
+ video: z.ZodObject<{
260
+ file: z.ZodString;
261
+ sha256: z.ZodOptional<z.ZodString>;
262
+ }, z.core.$strict>;
263
+ cover: z.ZodOptional<z.ZodObject<{
264
+ file: z.ZodString;
265
+ sha256: z.ZodOptional<z.ZodString>;
266
+ }, z.core.$strict>>;
267
+ metadata: z.ZodObject<{
268
+ title: z.ZodString;
269
+ tid: z.ZodNumber;
270
+ tag: z.ZodString;
271
+ desc: z.ZodDefault<z.ZodString>;
272
+ copyright: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
273
+ source: z.ZodDefault<z.ZodString>;
274
+ no_reprint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
275
+ }, z.core.$strict>;
276
+ }, z.core.$strict>, z.ZodObject<{
277
+ kind: z.ZodLiteral<"open.video.edit">;
278
+ uid: z.ZodString;
279
+ resourceId: z.ZodString;
280
+ metadata: z.ZodObject<{
281
+ title: z.ZodString;
282
+ tid: z.ZodNumber;
283
+ cover: z.ZodString;
284
+ desc: z.ZodString;
285
+ no_reprint: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
286
+ }, z.core.$strict>;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ kind: z.ZodLiteral<"open.video.delete">;
289
+ uid: z.ZodString;
290
+ resourceId: z.ZodString;
291
+ }, z.core.$strict>, z.ZodObject<{
292
+ kind: z.ZodLiteral<"open.article.publish">;
293
+ uid: z.ZodString;
294
+ metadata: z.ZodObject<{
295
+ title: z.ZodString;
296
+ category: z.ZodNumber;
297
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
298
+ summary: z.ZodString;
299
+ content: z.ZodString;
300
+ banner_url: z.ZodString;
301
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
302
+ image_urls: z.ZodString;
303
+ tags: z.ZodString;
304
+ list_id: z.ZodNumber;
305
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
306
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
307
+ }, z.core.$strict>;
308
+ }, z.core.$strict>, z.ZodObject<{
309
+ kind: z.ZodLiteral<"open.article.edit">;
310
+ uid: z.ZodString;
311
+ articleId: z.ZodString;
312
+ metadata: z.ZodObject<{
313
+ title: z.ZodString;
314
+ category: z.ZodNumber;
315
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
316
+ summary: z.ZodString;
317
+ content: z.ZodString;
318
+ banner_url: z.ZodString;
319
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
320
+ image_urls: z.ZodString;
321
+ tags: z.ZodString;
322
+ list_id: z.ZodNumber;
323
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
324
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
325
+ }, z.core.$strict>;
326
+ }, z.core.$strict>, z.ZodObject<{
327
+ kind: z.ZodLiteral<"open.article.delete">;
328
+ uid: z.ZodString;
329
+ articleId: z.ZodString;
330
+ }, z.core.$strict>, z.ZodObject<{
331
+ kind: z.ZodLiteral<"open.article.image">;
332
+ uid: z.ZodString;
333
+ image: z.ZodObject<{
334
+ file: z.ZodString;
335
+ sha256: z.ZodOptional<z.ZodString>;
336
+ }, z.core.$strict>;
337
+ }, z.core.$strict>, z.ZodObject<{
56
338
  kind: z.ZodLiteral<"comment.add">;
57
339
  oid: z.ZodString;
58
340
  type: z.ZodDefault<z.ZodLiteral<1>>;
@@ -89,10 +371,18 @@ declare const draftSchema: z.ZodObject<{
89
371
  at: z.ZodNumber;
90
372
  }, z.core.$strip>>;
91
373
  result: z.ZodOptional<z.ZodUnknown>;
374
+ steps: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
375
+ status: z.ZodEnum<{
376
+ done: "done";
377
+ failed: "failed";
378
+ pending: "pending";
379
+ }>;
380
+ result: z.ZodOptional<z.ZodUnknown>;
381
+ }, z.core.$strip>>>;
92
382
  }, z.core.$strip>;
93
383
  type Draft = z.infer<typeof draftSchema>;
94
384
  declare const stateSchema: z.ZodObject<{
95
- version: z.ZodLiteral<1>;
385
+ version: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>, z.ZodTransform<2, 1 | 2>>;
96
386
  identities: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
97
387
  sequence: z.ZodNumber;
98
388
  drafts: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -101,6 +391,146 @@ declare const stateSchema: z.ZodObject<{
101
391
  account: z.ZodString;
102
392
  digest: z.ZodString;
103
393
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
394
+ kind: z.ZodLiteral<"video.like">;
395
+ aid: z.ZodString;
396
+ enabled: z.ZodDefault<z.ZodBoolean>;
397
+ }, z.core.$strict>, z.ZodObject<{
398
+ kind: z.ZodLiteral<"video.coin">;
399
+ aid: z.ZodString;
400
+ count: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
401
+ like: z.ZodDefault<z.ZodBoolean>;
402
+ }, z.core.$strict>, z.ZodObject<{
403
+ kind: z.ZodLiteral<"video.triple">;
404
+ aid: z.ZodString;
405
+ }, z.core.$strict>, z.ZodObject<{
406
+ kind: z.ZodLiteral<"favorite.add">;
407
+ aid: z.ZodString;
408
+ folderId: z.ZodString;
409
+ }, z.core.$strict>, z.ZodObject<{
410
+ kind: z.ZodLiteral<"favorite.remove">;
411
+ aid: z.ZodString;
412
+ folderId: z.ZodString;
413
+ }, z.core.$strict>, z.ZodObject<{
414
+ kind: z.ZodLiteral<"user.follow">;
415
+ uid: z.ZodString;
416
+ }, z.core.$strict>, z.ZodObject<{
417
+ kind: z.ZodLiteral<"user.unfollow">;
418
+ uid: z.ZodString;
419
+ }, z.core.$strict>, z.ZodObject<{
420
+ kind: z.ZodLiteral<"comment.like">;
421
+ oid: z.ZodString;
422
+ rpid: z.ZodString;
423
+ enabled: z.ZodDefault<z.ZodBoolean>;
424
+ }, z.core.$strict>, z.ZodObject<{
425
+ kind: z.ZodLiteral<"video.danmaku">;
426
+ aid: z.ZodString;
427
+ cid: z.ZodString;
428
+ progressMs: z.ZodNumber;
429
+ text: z.ZodString;
430
+ color: z.ZodDefault<z.ZodNumber>;
431
+ mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>;
432
+ fontSize: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<18>, z.ZodLiteral<25>]>>;
433
+ }, z.core.$strict>, z.ZodObject<{
434
+ kind: z.ZodLiteral<"dynamic.create">;
435
+ uid: z.ZodString;
436
+ text: z.ZodString;
437
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
438
+ file: z.ZodString;
439
+ sha256: z.ZodOptional<z.ZodString>;
440
+ }, z.core.$strict>>>;
441
+ }, z.core.$strict>, z.ZodObject<{
442
+ kind: z.ZodLiteral<"dynamic.edit">;
443
+ dynamicId: z.ZodString;
444
+ text: z.ZodString;
445
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
446
+ file: z.ZodString;
447
+ sha256: z.ZodOptional<z.ZodString>;
448
+ }, z.core.$strict>>>;
449
+ }, z.core.$strict>, z.ZodObject<{
450
+ kind: z.ZodLiteral<"dynamic.delete">;
451
+ dynamicId: z.ZodString;
452
+ }, z.core.$strict>, z.ZodObject<{
453
+ kind: z.ZodLiteral<"open.video.publish">;
454
+ uid: z.ZodString;
455
+ video: z.ZodObject<{
456
+ file: z.ZodString;
457
+ sha256: z.ZodOptional<z.ZodString>;
458
+ }, z.core.$strict>;
459
+ cover: z.ZodOptional<z.ZodObject<{
460
+ file: z.ZodString;
461
+ sha256: z.ZodOptional<z.ZodString>;
462
+ }, z.core.$strict>>;
463
+ metadata: z.ZodObject<{
464
+ title: z.ZodString;
465
+ tid: z.ZodNumber;
466
+ tag: z.ZodString;
467
+ desc: z.ZodDefault<z.ZodString>;
468
+ copyright: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
469
+ source: z.ZodDefault<z.ZodString>;
470
+ no_reprint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
471
+ }, z.core.$strict>;
472
+ }, z.core.$strict>, z.ZodObject<{
473
+ kind: z.ZodLiteral<"open.video.edit">;
474
+ uid: z.ZodString;
475
+ resourceId: z.ZodString;
476
+ metadata: z.ZodObject<{
477
+ title: z.ZodString;
478
+ tid: z.ZodNumber;
479
+ cover: z.ZodString;
480
+ desc: z.ZodString;
481
+ no_reprint: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
482
+ }, z.core.$strict>;
483
+ }, z.core.$strict>, z.ZodObject<{
484
+ kind: z.ZodLiteral<"open.video.delete">;
485
+ uid: z.ZodString;
486
+ resourceId: z.ZodString;
487
+ }, z.core.$strict>, z.ZodObject<{
488
+ kind: z.ZodLiteral<"open.article.publish">;
489
+ uid: z.ZodString;
490
+ metadata: z.ZodObject<{
491
+ title: z.ZodString;
492
+ category: z.ZodNumber;
493
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
494
+ summary: z.ZodString;
495
+ content: z.ZodString;
496
+ banner_url: z.ZodString;
497
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
498
+ image_urls: z.ZodString;
499
+ tags: z.ZodString;
500
+ list_id: z.ZodNumber;
501
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
502
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
503
+ }, z.core.$strict>;
504
+ }, z.core.$strict>, z.ZodObject<{
505
+ kind: z.ZodLiteral<"open.article.edit">;
506
+ uid: z.ZodString;
507
+ articleId: z.ZodString;
508
+ metadata: z.ZodObject<{
509
+ title: z.ZodString;
510
+ category: z.ZodNumber;
511
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
512
+ summary: z.ZodString;
513
+ content: z.ZodString;
514
+ banner_url: z.ZodString;
515
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
516
+ image_urls: z.ZodString;
517
+ tags: z.ZodString;
518
+ list_id: z.ZodNumber;
519
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
520
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
521
+ }, z.core.$strict>;
522
+ }, z.core.$strict>, z.ZodObject<{
523
+ kind: z.ZodLiteral<"open.article.delete">;
524
+ uid: z.ZodString;
525
+ articleId: z.ZodString;
526
+ }, z.core.$strict>, z.ZodObject<{
527
+ kind: z.ZodLiteral<"open.article.image">;
528
+ uid: z.ZodString;
529
+ image: z.ZodObject<{
530
+ file: z.ZodString;
531
+ sha256: z.ZodOptional<z.ZodString>;
532
+ }, z.core.$strict>;
533
+ }, z.core.$strict>, z.ZodObject<{
104
534
  kind: z.ZodLiteral<"comment.add">;
105
535
  oid: z.ZodString;
106
536
  type: z.ZodDefault<z.ZodLiteral<1>>;
@@ -137,6 +567,14 @@ declare const stateSchema: z.ZodObject<{
137
567
  at: z.ZodNumber;
138
568
  }, z.core.$strip>>;
139
569
  result: z.ZodOptional<z.ZodUnknown>;
570
+ steps: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
571
+ status: z.ZodEnum<{
572
+ done: "done";
573
+ failed: "failed";
574
+ pending: "pending";
575
+ }>;
576
+ result: z.ZodOptional<z.ZodUnknown>;
577
+ }, z.core.$strip>>>;
140
578
  }, z.core.$strip>>;
141
579
  cursors: z.ZodRecord<z.ZodString, z.ZodObject<{
142
580
  revision: z.ZodNumber;
@@ -153,6 +591,22 @@ declare const stateSchema: z.ZodObject<{
153
591
  }, z.core.$strip>;
154
592
  }, z.core.$strip>>;
155
593
  }, z.core.$strip>>;
594
+ events: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
595
+ revision: z.ZodNumber;
596
+ since: z.ZodDefault<z.ZodNumber>;
597
+ seen: z.ZodArray<z.ZodString>;
598
+ pending: z.ZodArray<z.ZodObject<{
599
+ receipt: z.ZodString;
600
+ message: z.ZodObject<{
601
+ ts: z.ZodNumber;
602
+ sender: z.ZodString;
603
+ text: z.ZodString;
604
+ key: z.ZodString;
605
+ seq: z.ZodNullable<z.ZodString>;
606
+ data: z.ZodUnknown;
607
+ }, z.core.$strip>;
608
+ }, z.core.$strip>>;
609
+ }, z.core.$strip>>>;
156
610
  deviceId: z.ZodString;
157
611
  traffic: z.ZodObject<{
158
612
  lastDispatch: z.ZodNumber;
@@ -171,6 +625,7 @@ declare const stateSchema: z.ZodObject<{
171
625
  writeHour: z.ZodNumber;
172
626
  writeDay: z.ZodNumber;
173
627
  lastWrite: z.ZodNumber;
628
+ lastWriteGroup: z.ZodOptional<z.ZodString>;
174
629
  }, z.core.$strip>>;
175
630
  }, z.core.$strip>;
176
631
  }, z.core.$strip>;
@@ -201,7 +656,11 @@ declare class Traffic {
201
656
  readonly clock: Clock;
202
657
  readonly fetcher: typeof fetch;
203
658
  constructor(store: StateStore, clock: Clock, fetcher: typeof fetch);
204
- request(url: URL, init: RequestInit, account: string, authenticated: boolean, cdn?: boolean): Promise<unknown>;
659
+ request(url: URL, init: RequestInit, account: string, authenticated: boolean, cdn?: boolean, bodyOptions?: {
660
+ format?: "bytes" | "text" | "location";
661
+ limit?: number;
662
+ writeGroup?: string;
663
+ }): Promise<unknown>;
205
664
  }
206
665
  declare const videoSchema: z.ZodObject<{
207
666
  bvid: z.ZodString;
@@ -301,7 +760,8 @@ declare class BiliClient {
301
760
  session(required?: boolean): Promise<Session>;
302
761
  get(path: string, params?: Record<string, string | number>, signed?: boolean, origin?: string, session?: Session): Promise<unknown>;
303
762
  headers(session: Session, origin?: string): Record<string, string>;
304
- post(path: string, fields: Record<string, string>, origin: string, session: Session): Promise<unknown>;
763
+ post(path: string, fields: Record<string, string>, origin: string, session: Session, writeGroup?: string): Promise<unknown>;
764
+ postBody(path: string, body: FormData | Record<string, unknown>, session: Session, writeGroup: string, signed?: boolean): Promise<unknown>;
305
765
  video(input: {
306
766
  bvid: string;
307
767
  }): Promise<Video>;
@@ -331,9 +791,165 @@ declare class BiliClient {
331
791
  roomId: string;
332
792
  }): Promise<LiveHistory>;
333
793
  }
794
+ declare const openActionSchema: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
795
+ kind: z.ZodLiteral<"open.video.publish">;
796
+ uid: z.ZodString;
797
+ video: z.ZodObject<{
798
+ file: z.ZodString;
799
+ sha256: z.ZodOptional<z.ZodString>;
800
+ }, z.core.$strict>;
801
+ cover: z.ZodOptional<z.ZodObject<{
802
+ file: z.ZodString;
803
+ sha256: z.ZodOptional<z.ZodString>;
804
+ }, z.core.$strict>>;
805
+ metadata: z.ZodObject<{
806
+ title: z.ZodString;
807
+ tid: z.ZodNumber;
808
+ tag: z.ZodString;
809
+ desc: z.ZodDefault<z.ZodString>;
810
+ copyright: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
811
+ source: z.ZodDefault<z.ZodString>;
812
+ no_reprint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
813
+ }, z.core.$strict>;
814
+ }, z.core.$strict>, z.ZodObject<{
815
+ kind: z.ZodLiteral<"open.video.edit">;
816
+ uid: z.ZodString;
817
+ resourceId: z.ZodString;
818
+ metadata: z.ZodObject<{
819
+ title: z.ZodString;
820
+ tid: z.ZodNumber;
821
+ cover: z.ZodString;
822
+ desc: z.ZodString;
823
+ no_reprint: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
824
+ }, z.core.$strict>;
825
+ }, z.core.$strict>, z.ZodObject<{
826
+ kind: z.ZodLiteral<"open.video.delete">;
827
+ uid: z.ZodString;
828
+ resourceId: z.ZodString;
829
+ }, z.core.$strict>, z.ZodObject<{
830
+ kind: z.ZodLiteral<"open.article.publish">;
831
+ uid: z.ZodString;
832
+ metadata: z.ZodObject<{
833
+ title: z.ZodString;
834
+ category: z.ZodNumber;
835
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
836
+ summary: z.ZodString;
837
+ content: z.ZodString;
838
+ banner_url: z.ZodString;
839
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
840
+ image_urls: z.ZodString;
841
+ tags: z.ZodString;
842
+ list_id: z.ZodNumber;
843
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
844
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
845
+ }, z.core.$strict>;
846
+ }, z.core.$strict>, z.ZodObject<{
847
+ kind: z.ZodLiteral<"open.article.edit">;
848
+ uid: z.ZodString;
849
+ articleId: z.ZodString;
850
+ metadata: z.ZodObject<{
851
+ title: z.ZodString;
852
+ category: z.ZodNumber;
853
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
854
+ summary: z.ZodString;
855
+ content: z.ZodString;
856
+ banner_url: z.ZodString;
857
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
858
+ image_urls: z.ZodString;
859
+ tags: z.ZodString;
860
+ list_id: z.ZodNumber;
861
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
862
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
863
+ }, z.core.$strict>;
864
+ }, z.core.$strict>, z.ZodObject<{
865
+ kind: z.ZodLiteral<"open.article.delete">;
866
+ uid: z.ZodString;
867
+ articleId: z.ZodString;
868
+ }, z.core.$strict>, z.ZodObject<{
869
+ kind: z.ZodLiteral<"open.article.image">;
870
+ uid: z.ZodString;
871
+ image: z.ZodObject<{
872
+ file: z.ZodString;
873
+ sha256: z.ZodOptional<z.ZodString>;
874
+ }, z.core.$strict>;
875
+ }, z.core.$strict>], "kind">;
876
+ type OpenAction = z.output<typeof openActionSchema>;
877
+ type Step = (name: string, run: () => Promise<unknown>) => Promise<unknown>;
878
+ export declare const openCredentialSchema: z.ZodObject<{
879
+ clientId: z.ZodString;
880
+ appSecret: z.ZodString;
881
+ accessToken: z.ZodString;
882
+ uid: z.ZodString;
883
+ scopes: z.ZodArray<z.ZodString>;
884
+ expiresAt: z.ZodOptional<z.ZodNumber>;
885
+ }, z.core.$strict>;
886
+ type OpenCredentials = z.output<typeof openCredentialSchema>;
887
+ interface OpenOptions {
888
+ credentials: () => Promise<OpenCredentials | undefined>;
889
+ maxUploadBytes?: number;
890
+ }
891
+ interface OpenSession extends Session {
892
+ authorization: OpenCredentials;
893
+ }
894
+ export declare const openInputs: {
895
+ readonly open_video_list: z.ZodObject<{
896
+ page: z.ZodDefault<z.ZodNumber>;
897
+ size: z.ZodDefault<z.ZodNumber>;
898
+ status: z.ZodDefault<z.ZodEnum<{
899
+ all: "all";
900
+ is_pubing: "is_pubing";
901
+ not_pubed: "not_pubed";
902
+ pubed: "pubed";
903
+ }>>;
904
+ }, z.core.$strict>;
905
+ readonly open_video: z.ZodObject<{
906
+ resourceId: z.ZodString;
907
+ }, z.core.$strict>;
908
+ readonly open_video_categories: z.ZodObject<{}, z.core.$strict>;
909
+ readonly open_article_list: z.ZodObject<{
910
+ page: z.ZodDefault<z.ZodNumber>;
911
+ size: z.ZodDefault<z.ZodNumber>;
912
+ sort: z.ZodDefault<z.ZodNumber>;
913
+ group: z.ZodDefault<z.ZodNumber>;
914
+ category: z.ZodDefault<z.ZodNumber>;
915
+ }, z.core.$strict>;
916
+ readonly open_article: z.ZodObject<{
917
+ articleId: z.ZodString;
918
+ }, z.core.$strict>;
919
+ readonly open_article_categories: z.ZodObject<{}, z.core.$strict>;
920
+ };
921
+ type OpenName = keyof typeof openInputs;
922
+ type OpenArguments<K extends OpenName> = z.input<(typeof openInputs)[K]>;
923
+ export declare function signOpen(credentials: OpenCredentials, body: string, now: number, nonce?: string): Record<string, string>;
924
+ export declare class OpenPlatform {
925
+ readonly options?: OpenOptions | undefined;
926
+ readonly mediaRoot?: string | undefined;
927
+ readonly traffic: Traffic;
928
+ constructor(traffic: Traffic, options?: OpenOptions | undefined, mediaRoot?: string | undefined);
929
+ session(scope: "ARC_BASE" | "ATC_BASE"): Promise<OpenSession>;
930
+ scope(action: OpenAction): "ARC_BASE" | "ATC_BASE";
931
+ bind(action: OpenAction): Promise<OpenAction>;
932
+ limit(): number;
933
+ image(attachment: {
934
+ file: string;
935
+ sha256?: string | undefined;
936
+ }): Promise<{
937
+ file: string;
938
+ sha256: string;
939
+ }>;
940
+ request(session: OpenSession, path: string, method: "GET" | "POST", data?: Record<string, unknown> | FormData, query?: Record<string, string | number>, group?: string): Promise<unknown>;
941
+ call<K extends OpenName>(name: K, input: OpenArguments<K>): Promise<unknown>;
942
+ execute(action: OpenAction, initial: Session, group: string, step: Step): Promise<unknown>;
943
+ uploadImage(session: OpenSession, path: string, attachment: {
944
+ file: string;
945
+ sha256?: string | undefined;
946
+ }, group: string): Promise<unknown>;
947
+ }
334
948
  declare class Writes {
335
949
  #private;
336
- constructor(client: BiliClient, store: StateStore);
950
+ private readonly mediaRoot?;
951
+ private readonly openPlatform?;
952
+ constructor(client: BiliClient, store: StateStore, mediaRoot?: string | undefined, openPlatform?: OpenPlatform | undefined);
337
953
  preview(input: WriteActionInput): {
338
954
  action: WriteAction;
339
955
  target: string;
@@ -377,6 +993,8 @@ interface FrameOptions {
377
993
  mediaRoot: string;
378
994
  outputRoot: string;
379
995
  ffmpegPath: string;
996
+ maxBytes?: number;
997
+ timeoutMs?: number;
380
998
  }
381
999
  declare const frameInput: z.ZodObject<{
382
1000
  file: z.ZodString;
@@ -386,6 +1004,309 @@ declare const frameInput: z.ZodObject<{
386
1004
  export declare function sampleFrames(options: FrameOptions, input: z.input<typeof frameInput>): Promise<{
387
1005
  files: string[];
388
1006
  }>;
1007
+ export declare const readInputs: {
1008
+ readonly creator_metrics: z.ZodObject<{
1009
+ bvid: z.ZodOptional<z.ZodString>;
1010
+ }, z.core.$strict>;
1011
+ readonly popular: z.ZodObject<{
1012
+ page: z.ZodDefault<z.ZodNumber>;
1013
+ size: z.ZodDefault<z.ZodNumber>;
1014
+ }, z.core.$strict>;
1015
+ readonly ranking: z.ZodObject<{
1016
+ rid: z.ZodDefault<z.ZodNumber>;
1017
+ }, z.core.$strict>;
1018
+ readonly hot_search: z.ZodObject<{}, z.core.$strict>;
1019
+ readonly search_advanced: z.ZodObject<{
1020
+ keyword: z.ZodString;
1021
+ type: z.ZodDefault<z.ZodEnum<{
1022
+ article: "article";
1023
+ bili_user: "bili_user";
1024
+ live_room: "live_room";
1025
+ video: "video";
1026
+ }>>;
1027
+ page: z.ZodDefault<z.ZodNumber>;
1028
+ order: z.ZodDefault<z.ZodEnum<{
1029
+ click: "click";
1030
+ dm: "dm";
1031
+ fans: "fans";
1032
+ level: "level";
1033
+ pubdate: "pubdate";
1034
+ scores: "scores";
1035
+ stow: "stow";
1036
+ totalrank: "totalrank";
1037
+ }>>;
1038
+ duration: z.ZodDefault<z.ZodNumber>;
1039
+ }, z.core.$strict>;
1040
+ readonly user: z.ZodObject<{
1041
+ uid: z.ZodString;
1042
+ }, z.core.$strict>;
1043
+ readonly user_videos: z.ZodObject<{
1044
+ uid: z.ZodString;
1045
+ page: z.ZodDefault<z.ZodNumber>;
1046
+ size: z.ZodDefault<z.ZodNumber>;
1047
+ order: z.ZodDefault<z.ZodEnum<{
1048
+ click: "click";
1049
+ pubdate: "pubdate";
1050
+ stow: "stow";
1051
+ }>>;
1052
+ }, z.core.$strict>;
1053
+ readonly followings: z.ZodObject<{
1054
+ uid: z.ZodString;
1055
+ page: z.ZodDefault<z.ZodNumber>;
1056
+ size: z.ZodDefault<z.ZodNumber>;
1057
+ }, z.core.$strict>;
1058
+ readonly followers: z.ZodObject<{
1059
+ uid: z.ZodString;
1060
+ page: z.ZodDefault<z.ZodNumber>;
1061
+ size: z.ZodDefault<z.ZodNumber>;
1062
+ }, z.core.$strict>;
1063
+ readonly favorite_folders: z.ZodObject<{
1064
+ uid: z.ZodString;
1065
+ }, z.core.$strict>;
1066
+ readonly favorite_items: z.ZodObject<{
1067
+ folderId: z.ZodString;
1068
+ page: z.ZodDefault<z.ZodNumber>;
1069
+ size: z.ZodDefault<z.ZodNumber>;
1070
+ keyword: z.ZodDefault<z.ZodString>;
1071
+ }, z.core.$strict>;
1072
+ readonly history: z.ZodObject<{
1073
+ max: z.ZodDefault<z.ZodString>;
1074
+ viewAt: z.ZodDefault<z.ZodNumber>;
1075
+ business: z.ZodDefault<z.ZodString>;
1076
+ }, z.core.$strict>;
1077
+ readonly watch_later: z.ZodObject<{}, z.core.$strict>;
1078
+ readonly related: z.ZodObject<{
1079
+ bvid: z.ZodString;
1080
+ }, z.core.$strict>;
1081
+ readonly tags: z.ZodObject<{
1082
+ bvid: z.ZodString;
1083
+ }, z.core.$strict>;
1084
+ readonly dynamic_feed: z.ZodObject<{
1085
+ offset: z.ZodDefault<z.ZodString>;
1086
+ type: z.ZodDefault<z.ZodEnum<{
1087
+ all: "all";
1088
+ video: "video";
1089
+ }>>;
1090
+ }, z.core.$strict>;
1091
+ readonly user_dynamics: z.ZodObject<{
1092
+ uid: z.ZodString;
1093
+ offset: z.ZodDefault<z.ZodString>;
1094
+ }, z.core.$strict>;
1095
+ readonly dynamic: z.ZodObject<{
1096
+ dynamicId: z.ZodString;
1097
+ }, z.core.$strict>;
1098
+ readonly articles: z.ZodObject<{
1099
+ uid: z.ZodString;
1100
+ page: z.ZodDefault<z.ZodNumber>;
1101
+ size: z.ZodDefault<z.ZodNumber>;
1102
+ }, z.core.$strict>;
1103
+ readonly article: z.ZodObject<{
1104
+ cvid: z.ZodString;
1105
+ }, z.core.$strict>;
1106
+ readonly notifications: z.ZodObject<{
1107
+ kind: z.ZodEnum<{
1108
+ at: "at";
1109
+ like: "like";
1110
+ reply: "reply";
1111
+ unread: "unread";
1112
+ }>;
1113
+ cursorId: z.ZodOptional<z.ZodString>;
1114
+ cursorTime: z.ZodOptional<z.ZodNumber>;
1115
+ }, z.core.$strict>;
1116
+ readonly comment_replies: z.ZodObject<{
1117
+ oid: z.ZodString;
1118
+ root: z.ZodString;
1119
+ page: z.ZodDefault<z.ZodNumber>;
1120
+ size: z.ZodDefault<z.ZodNumber>;
1121
+ }, z.core.$strict>;
1122
+ readonly comment_pinned: z.ZodObject<{
1123
+ oid: z.ZodString;
1124
+ }, z.core.$strict>;
1125
+ readonly comment_check: z.ZodObject<{
1126
+ oid: z.ZodString;
1127
+ rpid: z.ZodString;
1128
+ root: z.ZodOptional<z.ZodString>;
1129
+ maxPages: z.ZodDefault<z.ZodNumber>;
1130
+ }, z.core.$strict>;
1131
+ readonly resolve: z.ZodObject<{
1132
+ reference: z.ZodString;
1133
+ page: z.ZodOptional<z.ZodNumber>;
1134
+ }, z.core.$strict>;
1135
+ readonly transcript: z.ZodObject<{
1136
+ reference: z.ZodString;
1137
+ page: z.ZodOptional<z.ZodNumber>;
1138
+ language: z.ZodOptional<z.ZodString>;
1139
+ format: z.ZodDefault<z.ZodEnum<{
1140
+ json: "json";
1141
+ srt: "srt";
1142
+ text: "text";
1143
+ vtt: "vtt";
1144
+ }>>;
1145
+ }, z.core.$strict>;
1146
+ readonly video_danmaku: z.ZodObject<{
1147
+ reference: z.ZodString;
1148
+ page: z.ZodOptional<z.ZodNumber>;
1149
+ segment: z.ZodDefault<z.ZodNumber>;
1150
+ }, z.core.$strict>;
1151
+ readonly video_summary: z.ZodObject<{
1152
+ reference: z.ZodString;
1153
+ page: z.ZodOptional<z.ZodNumber>;
1154
+ }, z.core.$strict>;
1155
+ readonly live_resolve: z.ZodObject<{
1156
+ roomId: z.ZodString;
1157
+ }, z.core.$strict>;
1158
+ };
1159
+ type ReadName = keyof typeof readInputs;
1160
+ type ReadArguments<K extends ReadName> = z.input<(typeof readInputs)[K]>;
1161
+ type ReadMethods = { [K in ReadName]: (input: ReadArguments<K>) => Promise<unknown>; };
1162
+ export declare class ContentReads {
1163
+ readonly client: BiliClient;
1164
+ constructor(client: BiliClient);
1165
+ call<K extends ReadName>(name: K, input: ReadArguments<K>): Promise<unknown>;
1166
+ }
1167
+ export declare function formatSubtitles(lines: {
1168
+ from: number;
1169
+ to: number;
1170
+ content: string;
1171
+ }[], format: string): string;
1172
+ interface MediaOptions extends FrameOptions {
1173
+ maxBytes?: number;
1174
+ timeoutMs?: number;
1175
+ }
1176
+ export declare const mediaInputs: {
1177
+ readonly media_download: z.ZodObject<{
1178
+ reference: z.ZodString;
1179
+ page: z.ZodOptional<z.ZodNumber>;
1180
+ kind: z.ZodDefault<z.ZodEnum<{
1181
+ audio: "audio";
1182
+ video: "video";
1183
+ }>>;
1184
+ quality: z.ZodDefault<z.ZodNumber>;
1185
+ }, z.core.$strict>;
1186
+ readonly audio_clip: z.ZodObject<{
1187
+ file: z.ZodString;
1188
+ startSeconds: z.ZodDefault<z.ZodNumber>;
1189
+ durationSeconds: z.ZodDefault<z.ZodNumber>;
1190
+ }, z.core.$strict>;
1191
+ readonly online_frames: z.ZodObject<{
1192
+ reference: z.ZodString;
1193
+ page: z.ZodOptional<z.ZodNumber>;
1194
+ count: z.ZodDefault<z.ZodNumber>;
1195
+ intervalSeconds: z.ZodDefault<z.ZodNumber>;
1196
+ contactSheet: z.ZodDefault<z.ZodBoolean>;
1197
+ }, z.core.$strict>;
1198
+ readonly subtitle_export: z.ZodObject<{
1199
+ reference: z.ZodString;
1200
+ page: z.ZodOptional<z.ZodNumber>;
1201
+ language: z.ZodOptional<z.ZodString>;
1202
+ format: z.ZodDefault<z.ZodEnum<{
1203
+ json: "json";
1204
+ srt: "srt";
1205
+ text: "text";
1206
+ vtt: "vtt";
1207
+ }>>;
1208
+ }, z.core.$strict>;
1209
+ readonly article_export: z.ZodObject<{
1210
+ cvid: z.ZodString;
1211
+ }, z.core.$strict>;
1212
+ readonly live_frame: z.ZodObject<{
1213
+ roomId: z.ZodString;
1214
+ }, z.core.$strict>;
1215
+ readonly materials: z.ZodObject<{
1216
+ reference: z.ZodString;
1217
+ page: z.ZodOptional<z.ZodNumber>;
1218
+ comments: z.ZodDefault<z.ZodBoolean>;
1219
+ subtitles: z.ZodDefault<z.ZodBoolean>;
1220
+ frames: z.ZodDefault<z.ZodBoolean>;
1221
+ }, z.core.$strict>;
1222
+ };
1223
+ type MediaName = keyof typeof mediaInputs;
1224
+ type MediaArguments<K extends MediaName> = z.input<(typeof mediaInputs)[K]>;
1225
+ interface MediaImage {
1226
+ type: "image";
1227
+ mimeType: "image/png" | "image/jpeg";
1228
+ data: string;
1229
+ }
1230
+ export declare class Media {
1231
+ readonly client: BiliClient;
1232
+ readonly reads: ContentReads;
1233
+ readonly options?: MediaOptions | undefined;
1234
+ constructor(client: BiliClient, reads: ContentReads, options?: MediaOptions | undefined);
1235
+ config(): MediaOptions;
1236
+ directory(): Promise<string>;
1237
+ fetchBytes(url: string, maxBytes: number): Promise<Buffer>;
1238
+ download(input: MediaArguments<"media_download">): Promise<{
1239
+ file: string;
1240
+ bvid: string;
1241
+ cid: string;
1242
+ aid: string;
1243
+ page: number;
1244
+ kind: string;
1245
+ bytes: number;
1246
+ }>;
1247
+ call<K extends MediaName>(name: K, input: MediaArguments<K>): Promise<unknown>;
1248
+ }
1249
+ export declare function articleMarkdown(html: string): string;
1250
+ declare const eventInput: z.ZodObject<{
1251
+ source: z.ZodEnum<{
1252
+ at: "at";
1253
+ comments: "comments";
1254
+ like: "like";
1255
+ live: "live";
1256
+ reply: "reply";
1257
+ }>;
1258
+ roomId: z.ZodOptional<z.ZodString>;
1259
+ oid: z.ZodOptional<z.ZodString>;
1260
+ root: z.ZodOptional<z.ZodString>;
1261
+ }, z.core.$strict>;
1262
+ declare const eventAckInput: z.ZodObject<{
1263
+ source: z.ZodEnum<{
1264
+ at: "at";
1265
+ comments: "comments";
1266
+ like: "like";
1267
+ live: "live";
1268
+ reply: "reply";
1269
+ }>;
1270
+ roomId: z.ZodOptional<z.ZodString>;
1271
+ oid: z.ZodOptional<z.ZodString>;
1272
+ root: z.ZodOptional<z.ZodString>;
1273
+ receipt: z.ZodString;
1274
+ }, z.core.$strict>;
1275
+ type EventMessage = Message & {
1276
+ data: unknown;
1277
+ };
1278
+ declare class EventPoller {
1279
+ readonly client: BiliClient;
1280
+ readonly store: StateStore;
1281
+ readonly reads: ContentReads;
1282
+ constructor(client: BiliClient, store: StateStore, reads: ContentReads);
1283
+ private scope;
1284
+ peek(input: z.input<typeof eventInput>): Promise<{
1285
+ baseline: boolean;
1286
+ event: {
1287
+ receipt: string;
1288
+ message: {
1289
+ ts: number;
1290
+ sender: string;
1291
+ text: string;
1292
+ key: string;
1293
+ seq: string | null;
1294
+ data: unknown;
1295
+ };
1296
+ };
1297
+ coverage: string;
1298
+ } | {
1299
+ baseline: boolean;
1300
+ event: {
1301
+ receipt: `${string}-${string}-${string}-${string}-${string}`;
1302
+ message: EventMessage;
1303
+ } | null;
1304
+ coverage: string;
1305
+ }>;
1306
+ ack(input: z.input<typeof eventAckInput>): Promise<{
1307
+ acknowledged: true;
1308
+ }>;
1309
+ }
389
1310
  interface KitOptions {
390
1311
  store: StateStore;
391
1312
  credentials?: CredentialProvider;
@@ -393,14 +1314,20 @@ interface KitOptions {
393
1314
  clock?: Clock;
394
1315
  fetch?: typeof fetch;
395
1316
  frames?: FrameOptions;
1317
+ media?: MediaOptions;
1318
+ openPlatform?: OpenOptions;
396
1319
  }
397
- type ReadApi = Pick<BiliClient, "video" | "search" | "subtitles" | "comments" | "liveInfo" | "liveHistory"> & {
1320
+ type ReadApi = Pick<BiliClient, "video" | "search" | "subtitles" | "comments" | "liveInfo" | "liveHistory"> & ReadMethods & {
398
1321
  dmHistory(input: {
399
1322
  uid: string;
400
1323
  beforeSeq?: string | undefined;
401
1324
  }): ReturnType<BiliClient["dmHistory"]>;
402
1325
  };
403
1326
  export declare class BiliKit {
1327
+ readonly open: OpenPlatform;
1328
+ readonly media: Media;
1329
+ readonly content: ContentReads;
1330
+ readonly events: EventPoller;
404
1331
  readonly reads: ReadApi;
405
1332
  readonly writes: Writes;
406
1333
  readonly admin: Administrator;
@@ -456,6 +1383,41 @@ type Envelope<T> = {
456
1383
  };
457
1384
  export declare function envelope<T>(fn: () => Promise<T>): Promise<Envelope<T>>;
458
1385
  export declare const operations: {
1386
+ readonly events_poll: {
1387
+ description: string;
1388
+ schema: z.ZodObject<{
1389
+ source: z.ZodEnum<{
1390
+ at: "at";
1391
+ comments: "comments";
1392
+ like: "like";
1393
+ live: "live";
1394
+ reply: "reply";
1395
+ }>;
1396
+ roomId: z.ZodOptional<z.ZodString>;
1397
+ oid: z.ZodOptional<z.ZodString>;
1398
+ root: z.ZodOptional<z.ZodString>;
1399
+ }, z.core.$strict>;
1400
+ readOnly: boolean;
1401
+ run: (kit: BiliKit, input: unknown) => unknown;
1402
+ };
1403
+ readonly events_ack: {
1404
+ description: string;
1405
+ schema: z.ZodObject<{
1406
+ source: z.ZodEnum<{
1407
+ at: "at";
1408
+ comments: "comments";
1409
+ like: "like";
1410
+ live: "live";
1411
+ reply: "reply";
1412
+ }>;
1413
+ roomId: z.ZodOptional<z.ZodString>;
1414
+ oid: z.ZodOptional<z.ZodString>;
1415
+ root: z.ZodOptional<z.ZodString>;
1416
+ receipt: z.ZodString;
1417
+ }, z.core.$strict>;
1418
+ readOnly: boolean;
1419
+ run: (kit: BiliKit, input: unknown) => unknown;
1420
+ };
459
1421
  readonly video: {
460
1422
  description: string;
461
1423
  schema: z.ZodObject<{
@@ -539,6 +1501,146 @@ export declare const operations: {
539
1501
  description: string;
540
1502
  schema: z.ZodObject<{
541
1503
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
1504
+ kind: z.ZodLiteral<"video.like">;
1505
+ aid: z.ZodString;
1506
+ enabled: z.ZodDefault<z.ZodBoolean>;
1507
+ }, z.core.$strict>, z.ZodObject<{
1508
+ kind: z.ZodLiteral<"video.coin">;
1509
+ aid: z.ZodString;
1510
+ count: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1511
+ like: z.ZodDefault<z.ZodBoolean>;
1512
+ }, z.core.$strict>, z.ZodObject<{
1513
+ kind: z.ZodLiteral<"video.triple">;
1514
+ aid: z.ZodString;
1515
+ }, z.core.$strict>, z.ZodObject<{
1516
+ kind: z.ZodLiteral<"favorite.add">;
1517
+ aid: z.ZodString;
1518
+ folderId: z.ZodString;
1519
+ }, z.core.$strict>, z.ZodObject<{
1520
+ kind: z.ZodLiteral<"favorite.remove">;
1521
+ aid: z.ZodString;
1522
+ folderId: z.ZodString;
1523
+ }, z.core.$strict>, z.ZodObject<{
1524
+ kind: z.ZodLiteral<"user.follow">;
1525
+ uid: z.ZodString;
1526
+ }, z.core.$strict>, z.ZodObject<{
1527
+ kind: z.ZodLiteral<"user.unfollow">;
1528
+ uid: z.ZodString;
1529
+ }, z.core.$strict>, z.ZodObject<{
1530
+ kind: z.ZodLiteral<"comment.like">;
1531
+ oid: z.ZodString;
1532
+ rpid: z.ZodString;
1533
+ enabled: z.ZodDefault<z.ZodBoolean>;
1534
+ }, z.core.$strict>, z.ZodObject<{
1535
+ kind: z.ZodLiteral<"video.danmaku">;
1536
+ aid: z.ZodString;
1537
+ cid: z.ZodString;
1538
+ progressMs: z.ZodNumber;
1539
+ text: z.ZodString;
1540
+ color: z.ZodDefault<z.ZodNumber>;
1541
+ mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>;
1542
+ fontSize: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<18>, z.ZodLiteral<25>]>>;
1543
+ }, z.core.$strict>, z.ZodObject<{
1544
+ kind: z.ZodLiteral<"dynamic.create">;
1545
+ uid: z.ZodString;
1546
+ text: z.ZodString;
1547
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
1548
+ file: z.ZodString;
1549
+ sha256: z.ZodOptional<z.ZodString>;
1550
+ }, z.core.$strict>>>;
1551
+ }, z.core.$strict>, z.ZodObject<{
1552
+ kind: z.ZodLiteral<"dynamic.edit">;
1553
+ dynamicId: z.ZodString;
1554
+ text: z.ZodString;
1555
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
1556
+ file: z.ZodString;
1557
+ sha256: z.ZodOptional<z.ZodString>;
1558
+ }, z.core.$strict>>>;
1559
+ }, z.core.$strict>, z.ZodObject<{
1560
+ kind: z.ZodLiteral<"dynamic.delete">;
1561
+ dynamicId: z.ZodString;
1562
+ }, z.core.$strict>, z.ZodObject<{
1563
+ kind: z.ZodLiteral<"open.video.publish">;
1564
+ uid: z.ZodString;
1565
+ video: z.ZodObject<{
1566
+ file: z.ZodString;
1567
+ sha256: z.ZodOptional<z.ZodString>;
1568
+ }, z.core.$strict>;
1569
+ cover: z.ZodOptional<z.ZodObject<{
1570
+ file: z.ZodString;
1571
+ sha256: z.ZodOptional<z.ZodString>;
1572
+ }, z.core.$strict>>;
1573
+ metadata: z.ZodObject<{
1574
+ title: z.ZodString;
1575
+ tid: z.ZodNumber;
1576
+ tag: z.ZodString;
1577
+ desc: z.ZodDefault<z.ZodString>;
1578
+ copyright: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1579
+ source: z.ZodDefault<z.ZodString>;
1580
+ no_reprint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
1581
+ }, z.core.$strict>;
1582
+ }, z.core.$strict>, z.ZodObject<{
1583
+ kind: z.ZodLiteral<"open.video.edit">;
1584
+ uid: z.ZodString;
1585
+ resourceId: z.ZodString;
1586
+ metadata: z.ZodObject<{
1587
+ title: z.ZodString;
1588
+ tid: z.ZodNumber;
1589
+ cover: z.ZodString;
1590
+ desc: z.ZodString;
1591
+ no_reprint: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1592
+ }, z.core.$strict>;
1593
+ }, z.core.$strict>, z.ZodObject<{
1594
+ kind: z.ZodLiteral<"open.video.delete">;
1595
+ uid: z.ZodString;
1596
+ resourceId: z.ZodString;
1597
+ }, z.core.$strict>, z.ZodObject<{
1598
+ kind: z.ZodLiteral<"open.article.publish">;
1599
+ uid: z.ZodString;
1600
+ metadata: z.ZodObject<{
1601
+ title: z.ZodString;
1602
+ category: z.ZodNumber;
1603
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1604
+ summary: z.ZodString;
1605
+ content: z.ZodString;
1606
+ banner_url: z.ZodString;
1607
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1608
+ image_urls: z.ZodString;
1609
+ tags: z.ZodString;
1610
+ list_id: z.ZodNumber;
1611
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1612
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
1613
+ }, z.core.$strict>;
1614
+ }, z.core.$strict>, z.ZodObject<{
1615
+ kind: z.ZodLiteral<"open.article.edit">;
1616
+ uid: z.ZodString;
1617
+ articleId: z.ZodString;
1618
+ metadata: z.ZodObject<{
1619
+ title: z.ZodString;
1620
+ category: z.ZodNumber;
1621
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1622
+ summary: z.ZodString;
1623
+ content: z.ZodString;
1624
+ banner_url: z.ZodString;
1625
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1626
+ image_urls: z.ZodString;
1627
+ tags: z.ZodString;
1628
+ list_id: z.ZodNumber;
1629
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1630
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
1631
+ }, z.core.$strict>;
1632
+ }, z.core.$strict>, z.ZodObject<{
1633
+ kind: z.ZodLiteral<"open.article.delete">;
1634
+ uid: z.ZodString;
1635
+ articleId: z.ZodString;
1636
+ }, z.core.$strict>, z.ZodObject<{
1637
+ kind: z.ZodLiteral<"open.article.image">;
1638
+ uid: z.ZodString;
1639
+ image: z.ZodObject<{
1640
+ file: z.ZodString;
1641
+ sha256: z.ZodOptional<z.ZodString>;
1642
+ }, z.core.$strict>;
1643
+ }, z.core.$strict>, z.ZodObject<{
542
1644
  kind: z.ZodLiteral<"comment.add">;
543
1645
  oid: z.ZodString;
544
1646
  type: z.ZodDefault<z.ZodLiteral<1>>;
@@ -567,6 +1669,146 @@ export declare const operations: {
567
1669
  description: string;
568
1670
  schema: z.ZodObject<{
569
1671
  action: z.ZodDiscriminatedUnion<[z.ZodObject<{
1672
+ kind: z.ZodLiteral<"video.like">;
1673
+ aid: z.ZodString;
1674
+ enabled: z.ZodDefault<z.ZodBoolean>;
1675
+ }, z.core.$strict>, z.ZodObject<{
1676
+ kind: z.ZodLiteral<"video.coin">;
1677
+ aid: z.ZodString;
1678
+ count: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1679
+ like: z.ZodDefault<z.ZodBoolean>;
1680
+ }, z.core.$strict>, z.ZodObject<{
1681
+ kind: z.ZodLiteral<"video.triple">;
1682
+ aid: z.ZodString;
1683
+ }, z.core.$strict>, z.ZodObject<{
1684
+ kind: z.ZodLiteral<"favorite.add">;
1685
+ aid: z.ZodString;
1686
+ folderId: z.ZodString;
1687
+ }, z.core.$strict>, z.ZodObject<{
1688
+ kind: z.ZodLiteral<"favorite.remove">;
1689
+ aid: z.ZodString;
1690
+ folderId: z.ZodString;
1691
+ }, z.core.$strict>, z.ZodObject<{
1692
+ kind: z.ZodLiteral<"user.follow">;
1693
+ uid: z.ZodString;
1694
+ }, z.core.$strict>, z.ZodObject<{
1695
+ kind: z.ZodLiteral<"user.unfollow">;
1696
+ uid: z.ZodString;
1697
+ }, z.core.$strict>, z.ZodObject<{
1698
+ kind: z.ZodLiteral<"comment.like">;
1699
+ oid: z.ZodString;
1700
+ rpid: z.ZodString;
1701
+ enabled: z.ZodDefault<z.ZodBoolean>;
1702
+ }, z.core.$strict>, z.ZodObject<{
1703
+ kind: z.ZodLiteral<"video.danmaku">;
1704
+ aid: z.ZodString;
1705
+ cid: z.ZodString;
1706
+ progressMs: z.ZodNumber;
1707
+ text: z.ZodString;
1708
+ color: z.ZodDefault<z.ZodNumber>;
1709
+ mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>;
1710
+ fontSize: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<18>, z.ZodLiteral<25>]>>;
1711
+ }, z.core.$strict>, z.ZodObject<{
1712
+ kind: z.ZodLiteral<"dynamic.create">;
1713
+ uid: z.ZodString;
1714
+ text: z.ZodString;
1715
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
1716
+ file: z.ZodString;
1717
+ sha256: z.ZodOptional<z.ZodString>;
1718
+ }, z.core.$strict>>>;
1719
+ }, z.core.$strict>, z.ZodObject<{
1720
+ kind: z.ZodLiteral<"dynamic.edit">;
1721
+ dynamicId: z.ZodString;
1722
+ text: z.ZodString;
1723
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
1724
+ file: z.ZodString;
1725
+ sha256: z.ZodOptional<z.ZodString>;
1726
+ }, z.core.$strict>>>;
1727
+ }, z.core.$strict>, z.ZodObject<{
1728
+ kind: z.ZodLiteral<"dynamic.delete">;
1729
+ dynamicId: z.ZodString;
1730
+ }, z.core.$strict>, z.ZodObject<{
1731
+ kind: z.ZodLiteral<"open.video.publish">;
1732
+ uid: z.ZodString;
1733
+ video: z.ZodObject<{
1734
+ file: z.ZodString;
1735
+ sha256: z.ZodOptional<z.ZodString>;
1736
+ }, z.core.$strict>;
1737
+ cover: z.ZodOptional<z.ZodObject<{
1738
+ file: z.ZodString;
1739
+ sha256: z.ZodOptional<z.ZodString>;
1740
+ }, z.core.$strict>>;
1741
+ metadata: z.ZodObject<{
1742
+ title: z.ZodString;
1743
+ tid: z.ZodNumber;
1744
+ tag: z.ZodString;
1745
+ desc: z.ZodDefault<z.ZodString>;
1746
+ copyright: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1747
+ source: z.ZodDefault<z.ZodString>;
1748
+ no_reprint: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
1749
+ }, z.core.$strict>;
1750
+ }, z.core.$strict>, z.ZodObject<{
1751
+ kind: z.ZodLiteral<"open.video.edit">;
1752
+ uid: z.ZodString;
1753
+ resourceId: z.ZodString;
1754
+ metadata: z.ZodObject<{
1755
+ title: z.ZodString;
1756
+ tid: z.ZodNumber;
1757
+ cover: z.ZodString;
1758
+ desc: z.ZodString;
1759
+ no_reprint: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1760
+ }, z.core.$strict>;
1761
+ }, z.core.$strict>, z.ZodObject<{
1762
+ kind: z.ZodLiteral<"open.video.delete">;
1763
+ uid: z.ZodString;
1764
+ resourceId: z.ZodString;
1765
+ }, z.core.$strict>, z.ZodObject<{
1766
+ kind: z.ZodLiteral<"open.article.publish">;
1767
+ uid: z.ZodString;
1768
+ metadata: z.ZodObject<{
1769
+ title: z.ZodString;
1770
+ category: z.ZodNumber;
1771
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1772
+ summary: z.ZodString;
1773
+ content: z.ZodString;
1774
+ banner_url: z.ZodString;
1775
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1776
+ image_urls: z.ZodString;
1777
+ tags: z.ZodString;
1778
+ list_id: z.ZodNumber;
1779
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1780
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
1781
+ }, z.core.$strict>;
1782
+ }, z.core.$strict>, z.ZodObject<{
1783
+ kind: z.ZodLiteral<"open.article.edit">;
1784
+ uid: z.ZodString;
1785
+ articleId: z.ZodString;
1786
+ metadata: z.ZodObject<{
1787
+ title: z.ZodString;
1788
+ category: z.ZodNumber;
1789
+ template_id: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1790
+ summary: z.ZodString;
1791
+ content: z.ZodString;
1792
+ banner_url: z.ZodString;
1793
+ original: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1794
+ image_urls: z.ZodString;
1795
+ tags: z.ZodString;
1796
+ list_id: z.ZodNumber;
1797
+ up_closed_reply: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>;
1798
+ top_video_bvid: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
1799
+ }, z.core.$strict>;
1800
+ }, z.core.$strict>, z.ZodObject<{
1801
+ kind: z.ZodLiteral<"open.article.delete">;
1802
+ uid: z.ZodString;
1803
+ articleId: z.ZodString;
1804
+ }, z.core.$strict>, z.ZodObject<{
1805
+ kind: z.ZodLiteral<"open.article.image">;
1806
+ uid: z.ZodString;
1807
+ image: z.ZodObject<{
1808
+ file: z.ZodString;
1809
+ sha256: z.ZodOptional<z.ZodString>;
1810
+ }, z.core.$strict>;
1811
+ }, z.core.$strict>, z.ZodObject<{
570
1812
  kind: z.ZodLiteral<"comment.add">;
571
1813
  oid: z.ZodString;
572
1814
  type: z.ZodDefault<z.ZodLiteral<1>>;
@@ -629,7 +1871,7 @@ export declare class FileCredentials {
629
1871
  readonly path: string;
630
1872
  constructor(path: string);
631
1873
  read(): Promise<Credentials | undefined>;
632
- update(fn: (previous: Credentials | undefined) => Promise<Credentials | undefined>): Promise<void>;
1874
+ update(fn: (previous: Credentials | undefined, checkpoint: (credentials: Credentials) => Promise<void>) => Promise<Credentials | undefined>): Promise<void>;
633
1875
  }
634
1876
  interface LoginOptions {
635
1877
  signal?: AbortSignal;
@@ -653,6 +1895,15 @@ export declare class FileAuth {
653
1895
  authenticated: true;
654
1896
  account: LoginAccount;
655
1897
  }>;
1898
+ refreshCheck(signal?: AbortSignal): Promise<{
1899
+ refresh: boolean;
1900
+ timestamp: number;
1901
+ refreshable: boolean;
1902
+ }>;
1903
+ refresh(signal?: AbortSignal): Promise<{
1904
+ refreshed: boolean;
1905
+ confirmed: boolean;
1906
+ }>;
656
1907
  logout(): Promise<{
657
1908
  authenticated: false;
658
1909
  }>;
@@ -663,9 +1914,21 @@ export declare const configSchema: z.ZodObject<{
663
1914
  credentialsFile: z.ZodOptional<z.ZodString>;
664
1915
  policy: z.ZodDefault<z.ZodObject<{
665
1916
  writesEnabled: z.ZodDefault<z.ZodBoolean>;
1917
+ allowedActions: z.ZodDefault<z.ZodArray<z.ZodString>>;
666
1918
  allowedTargets: z.ZodDefault<z.ZodArray<z.ZodString>>;
667
1919
  trustedDmTargets: z.ZodDefault<z.ZodArray<z.ZodString>>;
668
1920
  }, z.core.$strict>>;
1921
+ media: z.ZodOptional<z.ZodObject<{
1922
+ mediaRoot: z.ZodString;
1923
+ outputRoot: z.ZodString;
1924
+ ffmpegPath: z.ZodString;
1925
+ maxBytes: z.ZodDefault<z.ZodNumber>;
1926
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
1927
+ }, z.core.$strict>>;
1928
+ openPlatform: z.ZodOptional<z.ZodObject<{
1929
+ credentialsFile: z.ZodString;
1930
+ maxUploadBytes: z.ZodDefault<z.ZodNumber>;
1931
+ }, z.core.$strict>>;
669
1932
  frames: z.ZodOptional<z.ZodObject<{
670
1933
  mediaRoot: z.ZodString;
671
1934
  outputRoot: z.ZodString;
@@ -674,5 +1937,50 @@ export declare const configSchema: z.ZodObject<{
674
1937
  }, z.core.$strict>;
675
1938
  export declare function loadKit(configPath: string): Promise<BiliKit>;
676
1939
  export declare function loadAuth(configPath: string, protocol?: QrLogin): Promise<FileAuth>;
677
- export type { Clock, Comments, CredentialProvider, Credentials, DmHistory, Draft, Envelope, ErrorCode, FrameOptions, KitOptions, LiveHistory, LiveInfo, LoginAccount, LoginOptions, Message, OperationName, Policy, QrChallenge, QrResult, SearchResults, State, StateStore, Subtitles, Video, WriteAction, WriteActionInput };
1940
+ declare const referenceInput: z.ZodObject<{
1941
+ reference: z.ZodString;
1942
+ page: z.ZodOptional<z.ZodNumber>;
1943
+ }, z.core.$strict>;
1944
+ type ReferenceInput = z.input<typeof referenceInput>;
1945
+ interface VideoReference {
1946
+ bvid: string;
1947
+ aid: string;
1948
+ cid: string;
1949
+ page: number;
1950
+ title: string;
1951
+ duration: number;
1952
+ pages: {
1953
+ cid: string;
1954
+ page: number;
1955
+ part: string;
1956
+ duration: number;
1957
+ }[];
1958
+ }
1959
+ interface Danmaku {
1960
+ id: string;
1961
+ progressMs: number;
1962
+ mode: number;
1963
+ fontSize: number;
1964
+ color: number;
1965
+ text: string;
1966
+ sentAt: number;
1967
+ }
1968
+ export declare function decodeDanmaku(bytes: Uint8Array): Danmaku[];
1969
+ /** Trusted host protocol; never expose return credentials to MCP. */
1970
+ export declare class CookieRefresh {
1971
+ readonly protocol: QrLogin;
1972
+ constructor(protocol?: QrLogin);
1973
+ request(url: URL, credentials: Credentials, fields?: Record<string, string>, html?: boolean, signal?: AbortSignal): Promise<{
1974
+ data: unknown;
1975
+ response: Response;
1976
+ }>;
1977
+ check(credentials: Credentials, signal?: AbortSignal): Promise<{
1978
+ refresh: boolean;
1979
+ timestamp: number;
1980
+ }>;
1981
+ challenge(credentials: Credentials, timestamp: number, signal?: AbortSignal): Promise<string>;
1982
+ rotate(credentials: Credentials, challenge: string, signal?: AbortSignal): Promise<Credentials>;
1983
+ confirm(credentials: Credentials, previousToken: string, signal?: AbortSignal): Promise<void>;
1984
+ }
1985
+ export type { Clock, Comments, CredentialProvider, Credentials, Danmaku, DmHistory, Draft, Envelope, ErrorCode, FrameOptions, KitOptions, LiveHistory, LiveInfo, LoginAccount, LoginOptions, MediaArguments, MediaImage, MediaName, MediaOptions, Message, OpenArguments, OpenCredentials, OpenName, OpenOptions, OperationName, Policy, QrChallenge, QrResult, ReadArguments, ReadMethods, ReadName, ReferenceInput, SearchResults, State, StateStore, Subtitles, Video, VideoReference, WriteAction, WriteActionInput };
678
1986
  //# sourceMappingURL=index.d.mts.map