@waterwx/dsh-novel-forge 1.3.2 → 1.4.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/README.md +2 -2
- package/lib/client.js +548 -267
- package/lib/client.js.map +1 -1
- package/lib/index.js +183 -9
- package/lib/index.js.map +1 -1
- package/lib/types/bookshelf.d.ts +6 -1
- package/lib/types/client/api.d.ts +4 -0
- package/lib/types/client/panel/ImportModal.d.ts +7 -0
- package/lib/types/client/panel/ShelfView.d.ts +3 -1
- package/lib/types/engine.d.ts +6 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/protocol.d.ts +32 -0
- package/package.json +97 -97
- package/src/bookshelf.ts +18 -2
- package/src/client/api.ts +420 -410
- package/src/client/panel/ImportModal.tsx +191 -0
- package/src/client/panel/NovelPanel.tsx +5058 -5046
- package/src/client/panel/ShelfView.tsx +249 -236
- package/src/client/panel/panel.module.css +3037 -2941
- package/src/engine.ts +3001 -2943
- package/src/index.ts +7 -5
- package/src/protocol.ts +1244 -1207
- package/src/routes.ts +2332 -2272
- package/scripts/assistant-frames.txt +0 -8
- package/scripts/diagnose-adapter.mts +0 -81
- package/scripts/diagnose-assistant.mjs +0 -58
- package/scripts/diagnose-bible.mjs +0 -72
- package/scripts/diagnose-harness.mts +0 -75
- package/scripts/novel-forge-restart.log +0 -10
- package/scripts/novel-forge-web.stderr.log +0 -2
- package/scripts/novel-forge-web.stdout.log +0 -1
- package/scripts/outline-sample.txt +0 -449
- package/scripts/probe.mjs +0 -6
- package/scripts/restart-web.ps1 +0 -88
- package/scripts/smoke.mts +0 -72
- package/scripts/upload-github.ps1 +0 -51
package/src/protocol.ts
CHANGED
|
@@ -1,1207 +1,1244 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dsh-novel-forge — shared protocol between the host half (Node) and the
|
|
3
|
-
* browser half (web GUI). Route paths, request/response shapes, the project
|
|
4
|
-
* state file format, and the NDJSON generation stream frames all live here so
|
|
5
|
-
* both halves spell exactly one vocabulary.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** The /api/dsh-novel-forge route family (same-origin, loopback-fenced). */
|
|
9
|
-
export const NOVEL_API = {
|
|
10
|
-
status: '/api/dsh-novel-forge/status',
|
|
11
|
-
loadOutline: '/api/dsh-novel-forge/load-outline',
|
|
12
|
-
saveOutline: '/api/dsh-novel-forge/save-outline',
|
|
13
|
-
plan: '/api/dsh-novel-forge/plan',
|
|
14
|
-
volumes: '/api/dsh-novel-forge/volumes',
|
|
15
|
-
bible: '/api/dsh-novel-forge/bible',
|
|
16
|
-
assets: '/api/dsh-novel-forge/assets',
|
|
17
|
-
styleEngine: '/api/dsh-novel-forge/style-engine',
|
|
18
|
-
generate: '/api/dsh-novel-forge/generate',
|
|
19
|
-
review: '/api/dsh-novel-forge/review',
|
|
20
|
-
rewrite: '/api/dsh-novel-forge/rewrite',
|
|
21
|
-
polish: '/api/dsh-novel-forge/polish',
|
|
22
|
-
/** 采纳待确认草稿(润色/重写产物)覆盖正文文件。 */
|
|
23
|
-
draftApply: '/api/dsh-novel-forge/draft/apply',
|
|
24
|
-
/** 放弃待确认草稿,保留原稿。 */
|
|
25
|
-
draftDiscard: '/api/dsh-novel-forge/draft/discard',
|
|
26
|
-
summary: '/api/dsh-novel-forge/summary',
|
|
27
|
-
foreshadow: '/api/dsh-novel-forge/foreshadow',
|
|
28
|
-
exportBook: '/api/dsh-novel-forge/export',
|
|
29
|
-
chapter: '/api/dsh-novel-forge/chapter',
|
|
30
|
-
/** 审查任意正文文本(作者手动编辑后,不落盘)。 */
|
|
31
|
-
chapterCheck: '/api/dsh-novel-forge/chapter/check',
|
|
32
|
-
/** 保存手动编辑的正文(自动备份 .bak)。 */
|
|
33
|
-
chapterSave: '/api/dsh-novel-forge/chapter/save',
|
|
34
|
-
assistant: '/api/dsh-novel-forge/assistant',
|
|
35
|
-
assistantHistory: '/api/dsh-novel-forge/assistant-history',
|
|
36
|
-
/** 清空助手对话记录。 */
|
|
37
|
-
assistantClear: '/api/dsh-novel-forge/assistant/clear',
|
|
38
|
-
bookshelf: '/api/dsh-novel-forge/bookshelf',
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
export interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/** POST /
|
|
479
|
-
export interface
|
|
480
|
-
/**
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
/** POST /
|
|
489
|
-
export interface
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
/** POST /
|
|
672
|
-
export interface
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/** POST /
|
|
709
|
-
export interface
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
/**
|
|
730
|
-
export interface
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
export interface
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
/**
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
/**
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
/**
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
/** POST /
|
|
924
|
-
export interface
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
/**
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
export interface
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
export interface
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
/**
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
/**
|
|
1185
|
-
|
|
1186
|
-
/**
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
/**
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1
|
+
/**
|
|
2
|
+
* dsh-novel-forge — shared protocol between the host half (Node) and the
|
|
3
|
+
* browser half (web GUI). Route paths, request/response shapes, the project
|
|
4
|
+
* state file format, and the NDJSON generation stream frames all live here so
|
|
5
|
+
* both halves spell exactly one vocabulary.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** The /api/dsh-novel-forge route family (same-origin, loopback-fenced). */
|
|
9
|
+
export const NOVEL_API = {
|
|
10
|
+
status: '/api/dsh-novel-forge/status',
|
|
11
|
+
loadOutline: '/api/dsh-novel-forge/load-outline',
|
|
12
|
+
saveOutline: '/api/dsh-novel-forge/save-outline',
|
|
13
|
+
plan: '/api/dsh-novel-forge/plan',
|
|
14
|
+
volumes: '/api/dsh-novel-forge/volumes',
|
|
15
|
+
bible: '/api/dsh-novel-forge/bible',
|
|
16
|
+
assets: '/api/dsh-novel-forge/assets',
|
|
17
|
+
styleEngine: '/api/dsh-novel-forge/style-engine',
|
|
18
|
+
generate: '/api/dsh-novel-forge/generate',
|
|
19
|
+
review: '/api/dsh-novel-forge/review',
|
|
20
|
+
rewrite: '/api/dsh-novel-forge/rewrite',
|
|
21
|
+
polish: '/api/dsh-novel-forge/polish',
|
|
22
|
+
/** 采纳待确认草稿(润色/重写产物)覆盖正文文件。 */
|
|
23
|
+
draftApply: '/api/dsh-novel-forge/draft/apply',
|
|
24
|
+
/** 放弃待确认草稿,保留原稿。 */
|
|
25
|
+
draftDiscard: '/api/dsh-novel-forge/draft/discard',
|
|
26
|
+
summary: '/api/dsh-novel-forge/summary',
|
|
27
|
+
foreshadow: '/api/dsh-novel-forge/foreshadow',
|
|
28
|
+
exportBook: '/api/dsh-novel-forge/export',
|
|
29
|
+
chapter: '/api/dsh-novel-forge/chapter',
|
|
30
|
+
/** 审查任意正文文本(作者手动编辑后,不落盘)。 */
|
|
31
|
+
chapterCheck: '/api/dsh-novel-forge/chapter/check',
|
|
32
|
+
/** 保存手动编辑的正文(自动备份 .bak)。 */
|
|
33
|
+
chapterSave: '/api/dsh-novel-forge/chapter/save',
|
|
34
|
+
assistant: '/api/dsh-novel-forge/assistant',
|
|
35
|
+
assistantHistory: '/api/dsh-novel-forge/assistant-history',
|
|
36
|
+
/** 清空助手对话记录。 */
|
|
37
|
+
assistantClear: '/api/dsh-novel-forge/assistant/clear',
|
|
38
|
+
bookshelf: '/api/dsh-novel-forge/bookshelf',
|
|
39
|
+
/** 导入已有项目目录(含 novel-project.json)到书架。 */
|
|
40
|
+
bookshelfImportDir: '/api/dsh-novel-forge/bookshelf/import-dir',
|
|
41
|
+
/** 导入 txt/md 全本:拆章建项目并登记书架。 */
|
|
42
|
+
bookshelfImportText: '/api/dsh-novel-forge/bookshelf/import-text',
|
|
43
|
+
/** 重置项目(可选携带新大纲):清空设定/卷/章节/伏笔/资产/事实库。 */
|
|
44
|
+
reset: '/api/dsh-novel-forge/reset',
|
|
45
|
+
/** 全书一致性质检:LLM 扫描已生成章节,输出矛盾问题清单。 */
|
|
46
|
+
audit: '/api/dsh-novel-forge/audit',
|
|
47
|
+
/** 角色卡刷新:基于事实库与各章摘要聚合角色当前状态。 */
|
|
48
|
+
charactersRefresh: '/api/dsh-novel-forge/characters/refresh',
|
|
49
|
+
/** 事实库回填:对历史已生成章节批量抽取事实(旧章节无事实记录时用)。 */
|
|
50
|
+
factsBackfill: '/api/dsh-novel-forge/facts/backfill',
|
|
51
|
+
/** 设定圣经局部修补(如世界观规则编辑)。 */
|
|
52
|
+
biblePatch: '/api/dsh-novel-forge/bible/patch',
|
|
53
|
+
/** 小说简介:生成(AI)/补全(AI)/保存。 */
|
|
54
|
+
blurb: '/api/dsh-novel-forge/blurb',
|
|
55
|
+
/** 重命名当前书(同步项目与书架条目)。 */
|
|
56
|
+
rename: '/api/dsh-novel-forge/rename',
|
|
57
|
+
/** 大世界:AI 提炼 / 保存结构化数据(境界/区域/势力)。 */
|
|
58
|
+
world: '/api/dsh-novel-forge/world',
|
|
59
|
+
/** 封面:GET 读取(dataUrl)/ POST 上传或移除。 */
|
|
60
|
+
cover: '/api/dsh-novel-forge/blurb/cover',
|
|
61
|
+
/** 剧情线管理:增删改 + 关联章节。 */
|
|
62
|
+
plotlines: '/api/dsh-novel-forge/plotlines',
|
|
63
|
+
/** 角色库:AI 提炼 / 采纳 / 更新 / 删除。 */
|
|
64
|
+
roles: '/api/dsh-novel-forge/roles',
|
|
65
|
+
scenes: '/api/dsh-novel-forge/scenes',
|
|
66
|
+
visualRules: '/api/dsh-novel-forge/visual-rules',
|
|
67
|
+
/** 作者复盘补跑:对已写章节补齐 authorReview(全书流式 / 单章 JSON)。 */
|
|
68
|
+
reviewBackfill: '/api/dsh-novel-forge/review/backfill',
|
|
69
|
+
/** 章节复位:generating 卡死 → pending(可重新生成)。 */
|
|
70
|
+
chapterReset: '/api/dsh-novel-forge/chapter/reset',
|
|
71
|
+
/** 章节直接通过:作者对 rejected/written 章节行使最终决定权。 */
|
|
72
|
+
chapterApprove: '/api/dsh-novel-forge/chapter/approve',
|
|
73
|
+
/** 敏感词检查:全书已写章节或指定文本。 */
|
|
74
|
+
sensitiveCheck: '/api/dsh-novel-forge/sensitive-check',
|
|
75
|
+
/** 开书想法 → AI 补全大纲:输入一句话想法,生成 2-3 个可选大纲方案。 */
|
|
76
|
+
outlineSuggest: '/api/dsh-novel-forge/outline/suggest',
|
|
77
|
+
/** 拆书分析:对已写章节做结构/人物/文风/卖点四维体检(两阶段:源笔记→分节分析)。 */
|
|
78
|
+
breakdown: '/api/dsh-novel-forge/breakdown',
|
|
79
|
+
/** 漫剧分镜生成:章节 → 角色锚点 + 分镜表(可适配豆包/Seedance/SD)。 */
|
|
80
|
+
/** 漫剧分集计划:读一卷 → 按故事弧线分集(高潮拆集/过渡并章)。 */
|
|
81
|
+
/** 漫画脚本:章节 → 分页分格漫画脚本(含角色视觉锚点)。 */
|
|
82
|
+
/** 生产单:启动批量生产(计划补足 + 逐章生成 + 被拒分级处理)。 */
|
|
83
|
+
runStart: '/api/dsh-novel-forge/run/start',
|
|
84
|
+
/** 生产单控制:pause / resume / stop。 */
|
|
85
|
+
runControl: '/api/dsh-novel-forge/run/control',
|
|
86
|
+
/** 生产单状态(含进度统计与日志)。 */
|
|
87
|
+
runStatus: '/api/dsh-novel-forge/run/status',
|
|
88
|
+
config: '/api/dsh-novel-forge/config',
|
|
89
|
+
openFolder: '/api/dsh-novel-forge/open-folder',
|
|
90
|
+
} as const
|
|
91
|
+
|
|
92
|
+
/** 书架:一本书的条目。 */
|
|
93
|
+
export interface BookEntry {
|
|
94
|
+
/** 稳定 id。 */
|
|
95
|
+
id: string
|
|
96
|
+
/** 书名。 */
|
|
97
|
+
bookName: string
|
|
98
|
+
/** 该书输出目录(独立项目目录)。 */
|
|
99
|
+
outputDir: string
|
|
100
|
+
/** 创建时间。 */
|
|
101
|
+
createdAt: string
|
|
102
|
+
/** 最后活动时间。 */
|
|
103
|
+
updatedAt: string
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 书架快照(含每本书的进度摘要)。 */
|
|
107
|
+
export interface BookshelfSnapshot {
|
|
108
|
+
books: Array<BookEntry & { done: number; total: number; hasProject: boolean; hasCover: boolean; blurb?: string }>
|
|
109
|
+
/** 当前激活的书 id(无则 null)。 */
|
|
110
|
+
activeBookId: string | null
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** POST /bookshelf 请求:创建新书。 */
|
|
114
|
+
export interface BookCreateRequest {
|
|
115
|
+
bookName: string
|
|
116
|
+
outputDir?: string
|
|
117
|
+
/** 开书向导:创建时直接导入的大纲文本(提供则立即建立项目)。 */
|
|
118
|
+
outline?: string
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** POST /reset 请求:重置项目(可选更新大纲)。 */
|
|
122
|
+
export interface ResetRequest {
|
|
123
|
+
/** 新大纲文本;提供则替换 outline,否则保留原大纲。 */
|
|
124
|
+
outline?: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** POST /bookshelf/activate 请求:切换当前书。 */
|
|
128
|
+
export interface BookActivateRequest {
|
|
129
|
+
id: string
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** POST /bookshelf/remove 请求:移除书架条目。 */
|
|
133
|
+
export interface BookRemoveRequest {
|
|
134
|
+
id: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** POST /bookshelf/import-dir 请求:导入已有项目目录。 */
|
|
138
|
+
export interface BookImportDirRequest {
|
|
139
|
+
/** 项目目录(须含 novel-project.json)。 */
|
|
140
|
+
outputDir: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** POST /bookshelf/import-dir 响应。 */
|
|
144
|
+
export interface BookImportDirResponse {
|
|
145
|
+
book: BookEntry
|
|
146
|
+
/** true = 目录已在书架中(本次为重新激活)。 */
|
|
147
|
+
existed: boolean
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** POST /bookshelf/import-text 请求:导入 txt/md 全本。 */
|
|
151
|
+
export interface BookImportTextRequest {
|
|
152
|
+
/** 源文件绝对路径(txt 或 md)。 */
|
|
153
|
+
filePath: string
|
|
154
|
+
/** 输出目录;缺省为 ~/.dsh/novels/书名。 */
|
|
155
|
+
outputDir?: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** POST /bookshelf/import-text 响应。 */
|
|
159
|
+
export interface BookImportTextResponse {
|
|
160
|
+
bookName: string
|
|
161
|
+
/** 成功拆出的章节数。 */
|
|
162
|
+
chapters: number
|
|
163
|
+
/** 因内容过短被跳过的章节标题列表。 */
|
|
164
|
+
skipped: string[]
|
|
165
|
+
/** 登记后的书架条目。 */
|
|
166
|
+
book: BookEntry
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
/** Chapter lifecycle states (the writing pipeline's state machine). */
|
|
171
|
+
export type ChapterStatus =
|
|
172
|
+
| 'pending' // planned, not started
|
|
173
|
+
| 'generating' // LLM writing right now
|
|
174
|
+
| 'written' // body on disk, awaiting review
|
|
175
|
+
| 'reviewing' // review in progress
|
|
176
|
+
| 'approved' // passed review (or user-approved)
|
|
177
|
+
| 'rejected' // review found problems
|
|
178
|
+
| 'error' // generation failed
|
|
179
|
+
|
|
180
|
+
/** One chapter in the plan. */
|
|
181
|
+
export interface ChapterPlan {
|
|
182
|
+
/** 1-based chapter number (stable identity; files are named from it). */
|
|
183
|
+
no: number
|
|
184
|
+
/** Volume this chapter belongs to (1-based; 0 = unassigned). */
|
|
185
|
+
volume: number
|
|
186
|
+
/** Chapter title, decided by the LLM plan step. */
|
|
187
|
+
title: string
|
|
188
|
+
/** Story beats / plot points for this chapter (model-facing guidance). */
|
|
189
|
+
beats: string
|
|
190
|
+
/** Target character count (defaults to the configured chapter size). */
|
|
191
|
+
targetChars: number
|
|
192
|
+
/** Generation/review state. */
|
|
193
|
+
status: ChapterStatus
|
|
194
|
+
/** 进入 generating 的时间(用于超时自动复位;未在生成时无此字段)。 */
|
|
195
|
+
generatingAt?: string
|
|
196
|
+
/** Actual character count once generated. */
|
|
197
|
+
chars?: number
|
|
198
|
+
/** Failure message when status is 'error'. */
|
|
199
|
+
error?: string
|
|
200
|
+
/** Output file name once generated (relative to the output dir). */
|
|
201
|
+
file?: string
|
|
202
|
+
/** LLM summary of the chapter (narrative memory for later chapters). */
|
|
203
|
+
summary?: string
|
|
204
|
+
/** Latest review report (present once reviewed). */
|
|
205
|
+
review?: ReviewReport
|
|
206
|
+
/** 作者复盘:钩子兑现/结尾钩子/剧情线推进/连续性/节奏趋势(生成后自动)。 */
|
|
207
|
+
authorReview?: AuthorReview
|
|
208
|
+
/**
|
|
209
|
+
* 待确认草稿:润色(去AI味)或整章重写的产物正文。生成时先存这里,
|
|
210
|
+
* 用户看过对比后点「采纳」才覆盖正文文件;点「放弃」则丢弃。刷新页面不丢失。
|
|
211
|
+
*/
|
|
212
|
+
pendingDraft?: string
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** 作者复盘:叙事结构层面的逐章检查(钩子/推进/连续性/趋势)。 */
|
|
216
|
+
export interface AuthorReview {
|
|
217
|
+
/** 上一章结尾钩子是否在本章兑现。 */
|
|
218
|
+
hookHonored: boolean
|
|
219
|
+
/** 钩子兑现说明(未兑现时给出建议)。 */
|
|
220
|
+
hookNote: string
|
|
221
|
+
/** 本章结尾钩子强度 0-10。 */
|
|
222
|
+
endingHook: number
|
|
223
|
+
/** 剧情线推进情况(推进了哪条线/或未推进)。 */
|
|
224
|
+
plotlineProgress: string
|
|
225
|
+
/** 结构化:本章推进的剧情线名称列表(与项目剧情线 name 精确匹配,复盘后自动关联章节)。 */
|
|
226
|
+
advancedLines?: string[]
|
|
227
|
+
/** 连续性检查(人物位置/时间/伤势/资源是否与上章衔接)。 */
|
|
228
|
+
continuity: string
|
|
229
|
+
/** 近期节奏趋势提示(拖沓/爽点密度等)。 */
|
|
230
|
+
trend: string
|
|
231
|
+
/** 复盘时间。 */
|
|
232
|
+
reviewedAt: string
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** One review finding. */
|
|
236
|
+
export interface ReviewIssue {
|
|
237
|
+
/** Severity: high = must fix, medium = should fix, low = suggestion. */
|
|
238
|
+
severity: 'high' | 'medium' | 'low'
|
|
239
|
+
/** What the problem is. */
|
|
240
|
+
item: string
|
|
241
|
+
/** Concrete suggestion for fixing it. */
|
|
242
|
+
suggestion: string
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** AI review report for one chapter. */
|
|
246
|
+
export interface ReviewReport {
|
|
247
|
+
/** Overall score 0-100. */
|
|
248
|
+
score: number
|
|
249
|
+
/** Pass threshold (config; 70 default). */
|
|
250
|
+
passed: boolean
|
|
251
|
+
/** One-line verdict. */
|
|
252
|
+
verdict: string
|
|
253
|
+
/** Individual findings. */
|
|
254
|
+
issues: ReviewIssue[]
|
|
255
|
+
/** When the review ran. */
|
|
256
|
+
reviewedAt: string
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** A volume of the book. */
|
|
260
|
+
export interface Volume {
|
|
261
|
+
/** 1-based volume number. */
|
|
262
|
+
no: number
|
|
263
|
+
/** Volume title. */
|
|
264
|
+
title: string
|
|
265
|
+
/** Volume positioning / summary. */
|
|
266
|
+
summary: string
|
|
267
|
+
/** First chapter number of this volume. */
|
|
268
|
+
chapterStart: number
|
|
269
|
+
/** Last chapter number (inclusive). */
|
|
270
|
+
chapterEnd: number
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** A character card from the story bible. */
|
|
274
|
+
export interface CharacterCard {
|
|
275
|
+
name: string
|
|
276
|
+
role: 'protagonist' | 'supporting' | 'antagonist' | 'other'
|
|
277
|
+
/** Personality / traits (short lines). */
|
|
278
|
+
traits: string[]
|
|
279
|
+
/** Goals and motivations. */
|
|
280
|
+
goals: string
|
|
281
|
+
/** Key relations to other characters. */
|
|
282
|
+
relations: string
|
|
283
|
+
/** 知情度:该角色已经知道的事实/秘密(未列出的信息该角色不知道)。 */
|
|
284
|
+
knowledge?: string[]
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** The structured story bible (worldbuilding extracted from the outline). */
|
|
288
|
+
export interface StoryBible {
|
|
289
|
+
/** Genre + tone tags. */
|
|
290
|
+
genre: string
|
|
291
|
+
/** Worldbuilding rules (power system, geography, factions...). */
|
|
292
|
+
worldRules: string[]
|
|
293
|
+
/** Character cards. */
|
|
294
|
+
characters: CharacterCard[]
|
|
295
|
+
/** Writing red lines (forbidden content / must-avoid tropes). */
|
|
296
|
+
redLines: string[]
|
|
297
|
+
/** Style guidance (pacing, pov, tone). */
|
|
298
|
+
style: string[]
|
|
299
|
+
/** When the bible was generated. */
|
|
300
|
+
generatedAt?: string
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** A planted/active/resolved foreshadowing thread. */
|
|
304
|
+
export interface Foreshadow {
|
|
305
|
+
/** Stable id. */
|
|
306
|
+
id: string
|
|
307
|
+
/** What the foreshadow is. */
|
|
308
|
+
description: string
|
|
309
|
+
/** Chapter where it was planted (undefined = planned). */
|
|
310
|
+
plantedChapter?: number
|
|
311
|
+
/** Chapter where it should be paid off. */
|
|
312
|
+
targetChapter?: number
|
|
313
|
+
/** Lifecycle state. */
|
|
314
|
+
status: 'planned' | 'planted' | 'progressing' | 'resolved' | 'abandoned'
|
|
315
|
+
/** Resolution note when resolved. */
|
|
316
|
+
resolvedNote?: string
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** 一条已确立的叙事事实(事实库/时间线,注入后续章节生成)。 */
|
|
320
|
+
export interface ChapterFact {
|
|
321
|
+
/** 来源章节号。 */
|
|
322
|
+
chapterNo: number
|
|
323
|
+
/** 事实文本(人物状态/境界资源/关系变化/伏笔落地等)。 */
|
|
324
|
+
text: string
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** 一条全书质检发现的问题(一致性矛盾,定位到章)。 */
|
|
328
|
+
export interface AuditIssue {
|
|
329
|
+
/** 问题所在章节号(无法定位时 0)。 */
|
|
330
|
+
chapterNo: number
|
|
331
|
+
severity: 'high' | 'medium' | 'low'
|
|
332
|
+
/** 矛盾描述。 */
|
|
333
|
+
item: string
|
|
334
|
+
/** 修改建议。 */
|
|
335
|
+
suggestion: string
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** POST /audit 响应。 */
|
|
339
|
+
export interface AuditResponse {
|
|
340
|
+
issues: AuditIssue[]
|
|
341
|
+
/** 参与质检的章节数。 */
|
|
342
|
+
auditedChapters: number
|
|
343
|
+
/** 质检时间。 */
|
|
344
|
+
auditedAt: string
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** 全书质检的实时状态(通过 /status 暴露给面板/外部读取)。 */
|
|
348
|
+
export interface AuditStatus {
|
|
349
|
+
status: 'idle' | 'running' | 'done' | 'error'
|
|
350
|
+
/** 开始时间(ISO)。 */
|
|
351
|
+
startedAt?: string
|
|
352
|
+
/** 结束时间(ISO)。 */
|
|
353
|
+
finishedAt?: string
|
|
354
|
+
/** 总批次数(0 = 尚未开始/无章节)。 */
|
|
355
|
+
totalBatches: number
|
|
356
|
+
/** 已完成批次数。 */
|
|
357
|
+
completedBatches: number
|
|
358
|
+
/** 参与质检的章节数。 */
|
|
359
|
+
auditedChapters?: number
|
|
360
|
+
/** 发现的问题数(done 后有效)。 */
|
|
361
|
+
issuesCount?: number
|
|
362
|
+
/** 最近一次质检的问题清单(done 后有效;error 时为空)。 */
|
|
363
|
+
issues?: AuditIssue[]
|
|
364
|
+
/** 失败信息(error 时有效)。 */
|
|
365
|
+
error?: string
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** 一条剧情线(主线/支线/人物线/悬念线)。 */
|
|
369
|
+
export interface Plotline {
|
|
370
|
+
/** 稳定 id。 */
|
|
371
|
+
id: string
|
|
372
|
+
/** 线名。 */
|
|
373
|
+
name: string
|
|
374
|
+
/** 类型:主线 / 支线 / 人物线 / 悬念线。 */
|
|
375
|
+
kind: 'main' | 'branch' | 'character' | 'mystery'
|
|
376
|
+
/** 目标/终点(这条线最终要完成什么)。 */
|
|
377
|
+
goal: string
|
|
378
|
+
/** 当前进度说明(最近推进到哪)。 */
|
|
379
|
+
progress: string
|
|
380
|
+
/** 生命周期状态。 */
|
|
381
|
+
status: 'active' | 'paused' | 'resolved' | 'abandoned'
|
|
382
|
+
/** 关联章节号(推进/落地的章节)。 */
|
|
383
|
+
chapters: number[]
|
|
384
|
+
/** 创建时间。 */
|
|
385
|
+
createdAt: string
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** POST /plotlines 请求:剧情线增删改 + 关联章节 + AI 辅助。 */
|
|
389
|
+
export interface PlotlinesRequest {
|
|
390
|
+
op: 'add' | 'update' | 'remove' | 'link' | 'suggest' | 'refresh' | 'health' | 'plan'
|
|
391
|
+
/** add / update 时传入的完整剧情线。 */
|
|
392
|
+
line?: Plotline
|
|
393
|
+
/** remove / link / refresh 时的目标线 id。 */
|
|
394
|
+
id?: string
|
|
395
|
+
/** link 时关联的章节号。 */
|
|
396
|
+
chapterNo?: number
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** 剧情线健康检查报告。 */
|
|
400
|
+
export interface PlotlineHealthReport {
|
|
401
|
+
/** 是否需要新线(需要 / 暂不需要 / 再写 X 章后需要)。 */
|
|
402
|
+
verdict: string
|
|
403
|
+
/** 建议添加新线的时机说明。 */
|
|
404
|
+
timing: string
|
|
405
|
+
/** 依据(基于数据的理由,每条一句)。 */
|
|
406
|
+
reasons: string[]
|
|
407
|
+
/** 各线健康度。 */
|
|
408
|
+
lines: Array<{
|
|
409
|
+
name: string
|
|
410
|
+
/** ok=健康 / warning=预警 / stale=搁置过久。 */
|
|
411
|
+
health: 'ok' | 'warning' | 'stale'
|
|
412
|
+
note: string
|
|
413
|
+
}>
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** AI 剧情方案:下一阶段目标 + 建议新线。 */
|
|
417
|
+
export interface PlotlinePlan {
|
|
418
|
+
/** 下一阶段(未来 5-10 章)剧情方向。 */
|
|
419
|
+
direction: string
|
|
420
|
+
/** 建议的新线(可逐条采纳)。 */
|
|
421
|
+
suggestions: Plotline[]
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** POST /plotlines 响应。 */
|
|
425
|
+
export interface PlotlinesResponse {
|
|
426
|
+
plotlines: Plotline[]
|
|
427
|
+
/** op=suggest 时的 AI 建议候选线。 */
|
|
428
|
+
suggestions?: Plotline[]
|
|
429
|
+
/** op=health 时的健康检查报告。 */
|
|
430
|
+
health?: PlotlineHealthReport
|
|
431
|
+
/** op=plan 时的剧情方案。 */
|
|
432
|
+
plan?: PlotlinePlan
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** 一条敏感词命中。 */
|
|
436
|
+
export interface SensitiveHit {
|
|
437
|
+
/** 命中章节号(文本检测时为 0)。 */
|
|
438
|
+
chapterNo: number
|
|
439
|
+
/** 命中的违禁词。 */
|
|
440
|
+
word: string
|
|
441
|
+
/** 类别:政治 / 擦边 / 暴力 / 辱骂 / 广告 / 其他。 */
|
|
442
|
+
category: string
|
|
443
|
+
/** 出现次数。 */
|
|
444
|
+
count: number
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** POST /sensitive-check 请求:检测指定章节/任意文本/全书。 */
|
|
448
|
+
export interface SensitiveCheckRequest {
|
|
449
|
+
/** 检测该章正文。 */
|
|
450
|
+
chapterNo?: number
|
|
451
|
+
/** 检测任意文本(优先于 chapterNo)。 */
|
|
452
|
+
text?: string
|
|
453
|
+
/** 扫描全部已写章节。 */
|
|
454
|
+
all?: boolean
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** POST /sensitive-check 响应。 */
|
|
458
|
+
export interface SensitiveCheckResponse {
|
|
459
|
+
hits: SensitiveHit[]
|
|
460
|
+
/** 参与扫描的章节数。 */
|
|
461
|
+
scannedChapters: number
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** 开书想法 → AI 大纲方案(一个候选)。 */
|
|
465
|
+
export interface OutlineCandidate {
|
|
466
|
+
/** 唯一 id(前端暂留/换批用)。 */
|
|
467
|
+
id: string
|
|
468
|
+
/** 推荐书名。 */
|
|
469
|
+
bookName: string
|
|
470
|
+
/** 题材(如 仙侠修真 / 都市)。 */
|
|
471
|
+
genre: string
|
|
472
|
+
/** 核心卖点一句话。 */
|
|
473
|
+
sellingPoint: string
|
|
474
|
+
/** 完整大纲文本(可直接用作项目大纲,≥800 字)。 */
|
|
475
|
+
outline: string
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** POST /outline/suggest 请求:想法 → 2-3 个可选大纲。 */
|
|
479
|
+
export interface OutlineSuggestRequest {
|
|
480
|
+
/** 作者想法(一两句话,≥50 字)。 */
|
|
481
|
+
idea: string
|
|
482
|
+
/** 本次要生成的候选数(默认 3,最多 3)。 */
|
|
483
|
+
count?: number
|
|
484
|
+
/** 已暂留方案的剧情方向摘要(换批时让 LLM 避开,防止与已留方案重复)。 */
|
|
485
|
+
exclude?: string[]
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** POST /outline/suggest 响应。 */
|
|
489
|
+
export interface OutlineSuggestResponse {
|
|
490
|
+
candidates: OutlineCandidate[]
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** 拆书分析:一个分析小节。 */
|
|
494
|
+
export interface BreakdownSection {
|
|
495
|
+
/** 小节键:overview / plot / character / style / market。 */
|
|
496
|
+
key: string
|
|
497
|
+
/** 小节标题(如「拆书总览」)。 */
|
|
498
|
+
title: string
|
|
499
|
+
/** 可读分析稿(markdown)。 */
|
|
500
|
+
markdown: string
|
|
501
|
+
/** 结构化数据(程序可消费)。 */
|
|
502
|
+
structured: Record<string, unknown>
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** 拆书分析:一条证据(结论→原文回溯)。 */
|
|
506
|
+
export interface BreakdownEvidence {
|
|
507
|
+
label: string
|
|
508
|
+
excerpt: string
|
|
509
|
+
/** 来源章节号(0 = 未定位)。 */
|
|
510
|
+
chapterNo: number
|
|
511
|
+
/** 指向的结构化字段。 */
|
|
512
|
+
fieldKey?: string
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** POST /breakdown 请求:对已写章节做拆书分析。 */
|
|
516
|
+
export interface BreakdownRequest {
|
|
517
|
+
/** 分析范围:'recent'=最近 20 章 / 'volume:N'=第 N 卷 / 'all'=全书(默认 recent)。 */
|
|
518
|
+
scope?: string
|
|
519
|
+
/** 分析档位:'quick'=4 维(总览/剧情/人物/文风)/ 'standard'=5 维(+卖点)。 */
|
|
520
|
+
preset?: 'quick' | 'standard'
|
|
521
|
+
/** token 预算上限(默认 50000)。 */
|
|
522
|
+
budgetTokens?: number
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** POST /breakdown 响应。 */
|
|
526
|
+
export interface BreakdownResponse {
|
|
527
|
+
sections: BreakdownSection[]
|
|
528
|
+
evidence: BreakdownEvidence[]
|
|
529
|
+
/** 参与分析的章节数。 */
|
|
530
|
+
chaptersScanned: number
|
|
531
|
+
/** 估算消耗 token。 */
|
|
532
|
+
usedTokens: number
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** 角色卡:角色当前状态(从事实库聚合)。 */
|
|
536
|
+
export interface RoleStatusCard {
|
|
537
|
+
name: string
|
|
538
|
+
/** protagonist / supporting / antagonist / other。 */
|
|
539
|
+
role: string
|
|
540
|
+
/** 当前状态一句话(境界/资源/伤势/心境)。 */
|
|
541
|
+
status: string
|
|
542
|
+
/** 最近出场章节。 */
|
|
543
|
+
lastChapter: number
|
|
544
|
+
/** 出场次数。 */
|
|
545
|
+
appearances: number
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** 角色库条目(主表:作者维护 + AI 提炼 + 编年录自动聚合)。 */
|
|
549
|
+
export interface RoleRecord {
|
|
550
|
+
/** 角色名(唯一键)。 */
|
|
551
|
+
name: string
|
|
552
|
+
/** 定位:主角 / 女主 / 女配 / 配角 / 反派 / 路人。 */
|
|
553
|
+
roleLabel: 'protagonist' | 'female_lead' | 'female_support' | 'support' | 'antagonist' | 'extra'
|
|
554
|
+
/** 身份一句话(如:祭族后裔、青云宗杂役)。 */
|
|
555
|
+
identity: string
|
|
556
|
+
/** 性格标签。 */
|
|
557
|
+
traits: string[]
|
|
558
|
+
/** 目标与动机。 */
|
|
559
|
+
goals: string
|
|
560
|
+
/** 关系网:[角色名](关系)。 */
|
|
561
|
+
relations: string[]
|
|
562
|
+
/** 成长线:阶段 → 说明(可含章节)。 */
|
|
563
|
+
arc: string[]
|
|
564
|
+
/** 知情度:该角色已经知道的信息。 */
|
|
565
|
+
knowledge: string[]
|
|
566
|
+
/** 首次出场章节(编年录聚合,可手动修正)。 */
|
|
567
|
+
firstChapter?: number
|
|
568
|
+
/** 动漫形象描述词(AI 绘图用:中文描述 + 英文标签 + 关键外貌标签)。 */
|
|
569
|
+
imagePrompt?: {
|
|
570
|
+
/** 中文外貌描述:连贯一段(发色/瞳色/服装/气质/标志物)。 */
|
|
571
|
+
zh: string
|
|
572
|
+
/** 英文绘图标签:booru 风格逗号分隔。 */
|
|
573
|
+
en: string
|
|
574
|
+
/** 中文关键标签(发色/瞳色/服装/气质/标志物)。 */
|
|
575
|
+
tags: string[]
|
|
576
|
+
/** 依据来源说明(哪几章哪些描写)。 */
|
|
577
|
+
source?: string
|
|
578
|
+
}
|
|
579
|
+
/** 角色参考图(dataURL 或 URL)。用于漫画/漫剧出图时锁定角色一致性。 */
|
|
580
|
+
imageUrl?: string
|
|
581
|
+
/** 角色图集(图像锚点):立绘/四视图/表情/场景/细节等,label 标注用途。 */
|
|
582
|
+
gallery?: RoleImage[]
|
|
583
|
+
/** 该角色所需的情绪表情清单(提炼时 LLM 补全 6-12 个,如"疲惫/麻木/压抑悲伤")。 */
|
|
584
|
+
expressions?: string[]
|
|
585
|
+
/** LLM 精修的四类生图提示词包(前端拼装版之外的高质量版,promptKit 接口生成)。 */
|
|
586
|
+
promptKit?: {
|
|
587
|
+
/** 立绘:全身/半身正视图。 */
|
|
588
|
+
portrait: { zh: string; en: string }
|
|
589
|
+
/** 四视图:正面/侧面/背面设定表。 */
|
|
590
|
+
sheet: { zh: string; en: string }
|
|
591
|
+
/** 表情:同一脸部锚换情绪,每表情一段。 */
|
|
592
|
+
expressions: { name: string; zh: string; en: string }[]
|
|
593
|
+
/** 细节:标志物局部特写。 */
|
|
594
|
+
details: { zh: string; en: string }
|
|
595
|
+
}
|
|
596
|
+
/** 漫画/漫剧重要性:main=必须建卡保证一致;support=有锚点即可;extra=路人随机生成不约束。 */
|
|
597
|
+
importance?: 'main' | 'support' | 'extra'
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** 角色图集条目:一张已定型的角色图(图像锚点)。 */
|
|
601
|
+
export interface RoleImage {
|
|
602
|
+
/** 用途标签:立绘 / 四视图 / 表情-疲惫 / 场景 / 细节 等。 */
|
|
603
|
+
label: string
|
|
604
|
+
/** dataURL 或 URL。 */
|
|
605
|
+
dataUrl: string
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** 场景库条目:从正文提炼的「镜头场景」视觉锚点(漫剧分镜/生图用)。 */
|
|
609
|
+
export interface SceneCard {
|
|
610
|
+
/** 场景名(唯一键),如「旧茶渡·地下石殿」。 */
|
|
611
|
+
name: string
|
|
612
|
+
/** 一句话定位:空间/氛围/功能。 */
|
|
613
|
+
summary: string
|
|
614
|
+
/** 幕归属:第一幕·后场 / 第二幕·卖场 / …(便于按剧情段落组织)。 */
|
|
615
|
+
act?: string
|
|
616
|
+
/** 时间光态:夜间闭店后 / 雨夜 / 凌晨 / 频闪灯… */
|
|
617
|
+
moment?: string
|
|
618
|
+
/** 关键情节镜头 1-3 条:该场景拍什么(人物动作+情绪+镜头推进)。 */
|
|
619
|
+
beats?: string[]
|
|
620
|
+
/** 人物在场状态:主角/关键角色在该场景的状态一句话。 */
|
|
621
|
+
characterState?: string
|
|
622
|
+
/** 环境构成:空间结构/陈设/标志物。 */
|
|
623
|
+
elements: string[]
|
|
624
|
+
/** 色调与光影(含 HEX 色板,可空)。 */
|
|
625
|
+
palette: string[]
|
|
626
|
+
/** 氛围关键词:压抑/神秘/空旷… */
|
|
627
|
+
moods: string[]
|
|
628
|
+
/** 中文生图提示词(连贯一段,写实电影感)。 */
|
|
629
|
+
zh: string
|
|
630
|
+
/** 英文生图提示词(逗号分隔标签)。 */
|
|
631
|
+
en: string
|
|
632
|
+
/** 关键标签。 */
|
|
633
|
+
tags: string[]
|
|
634
|
+
/** 依据来源(哪几章哪些描写)。 */
|
|
635
|
+
source?: string
|
|
636
|
+
/** 场景图集(图像锚点):全景/局部/氛围 等。 */
|
|
637
|
+
gallery?: RoleImage[]
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/** POST /scenes 请求:场景库提炼 / 采纳 / 更新 / 删除 / 图集。 */
|
|
641
|
+
export interface ScenesRequest {
|
|
642
|
+
op: 'extract' | 'adopt' | 'update' | 'remove' | 'image' | 'removeImage'
|
|
643
|
+
/** adopt / update 时传入的场景卡(adopt 可修改后采纳)。 */
|
|
644
|
+
scene?: SceneCard
|
|
645
|
+
/** remove / image 时的场景名。 */
|
|
646
|
+
name?: string
|
|
647
|
+
/** op='image' 时的图片 dataURL 与用途标签(全景/局部/氛围)。 */
|
|
648
|
+
dataUrl?: string
|
|
649
|
+
label?: string
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/** POST /visual-rules 请求:视觉世界观规则提炼 / 保存。 */
|
|
653
|
+
export interface VisualRulesRequest {
|
|
654
|
+
op: 'extract' | 'save'
|
|
655
|
+
/** op=save 时的规则数组。 */
|
|
656
|
+
rules?: string[]
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** POST /visual-rules 响应。 */
|
|
660
|
+
export interface VisualRulesResponse {
|
|
661
|
+
rules: string[]
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/** POST /scenes 响应。 */
|
|
665
|
+
export interface ScenesResponse {
|
|
666
|
+
scenes: SceneCard[]
|
|
667
|
+
/** op=extract 时的 AI 候选场景。 */
|
|
668
|
+
candidates?: SceneCard[]
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/** POST /roles 请求:角色库增删改 + AI 提炼 + 参考图上传。 */
|
|
672
|
+
export interface RolesRequest {
|
|
673
|
+
op: 'extract' | 'adopt' | 'update' | 'remove' | 'visual' | 'image' | 'removeImage' | 'imageGenerate' | 'promptKit'
|
|
674
|
+
/** adopt / update 时传入的角色(adopt 可修改后采纳)。 */
|
|
675
|
+
role?: RoleRecord
|
|
676
|
+
/** remove 时的角色名。 */
|
|
677
|
+
name?: string
|
|
678
|
+
/** op='image' 时的参考图 dataURL。 */
|
|
679
|
+
dataUrl?: string
|
|
680
|
+
/** op='image' 时的图集用途标签(立绘/四视图/表情-x/场景/细节);缺省视为角色参考图(imageUrl)。 */
|
|
681
|
+
label?: string
|
|
682
|
+
/** op='imageGenerate' 时的漫画风格预设 id(用于统一角色图与漫画页风格)。 */
|
|
683
|
+
style?: string
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/** POST /roles 响应。 */
|
|
687
|
+
export interface RolesResponse {
|
|
688
|
+
roles: RoleRecord[]
|
|
689
|
+
/** op=extract 时的 AI 候选角色。 */
|
|
690
|
+
candidates?: RoleRecord[]
|
|
691
|
+
/** op=visual 时的动漫形象描述词(已写入角色卡)。 */
|
|
692
|
+
visual?: RoleRecord['imagePrompt']
|
|
693
|
+
/** op=promptKit 时的四类提示词精修包(已写入角色卡)。 */
|
|
694
|
+
promptKit?: RoleRecord['promptKit']
|
|
695
|
+
/** op=image 时的角色参考图 dataURL。 */
|
|
696
|
+
imageUrl?: string
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/** POST /bible/patch 请求:局部修补设定圣经。 */
|
|
700
|
+
export interface BiblePatchRequest {
|
|
701
|
+
worldRules?: string[]
|
|
702
|
+
redLines?: string[]
|
|
703
|
+
style?: string[]
|
|
704
|
+
/** 角色卡整体替换(人物志编辑知情度等)。 */
|
|
705
|
+
characters?: CharacterCard[]
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/** POST /blurb 请求:AI 生成/补全或手动保存小说简介。 */
|
|
709
|
+
export interface BlurbRequest {
|
|
710
|
+
action: 'generate' | 'save'
|
|
711
|
+
/** 已写好的开头(AI 补全时使用;留空 = 全量生成)。 */
|
|
712
|
+
partial?: string
|
|
713
|
+
/** 手动保存的完整简介(action=save 时)。 */
|
|
714
|
+
text?: string
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/** POST /chapter/check|save 请求:审查/保存手动编辑的正文。 */
|
|
718
|
+
export interface ChapterTextRequest {
|
|
719
|
+
chapterNo: number
|
|
720
|
+
/** 当前编辑中的正文全文。 */
|
|
721
|
+
text: string
|
|
722
|
+
/** 保存时携带:已在工作区审查过的报告(沿用落盘,不重复审);缺省则保存后自动正式审稿一次。 */
|
|
723
|
+
report?: ReviewReport
|
|
724
|
+
/** 审查/验证时携带:上一轮审稿报告。传入后进入「验证模式」——逐条核对原意见是否解决、
|
|
725
|
+
* 只挑新增 high,不再全新找茬(防止"越修 high 越多")。 */
|
|
726
|
+
previousReport?: ReviewReport
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/** POST /chapter/save 响应。 */
|
|
730
|
+
export interface ChapterSaveResponse {
|
|
731
|
+
ok: boolean
|
|
732
|
+
chars: number
|
|
733
|
+
file: string
|
|
734
|
+
/** 落盘的审稿报告(沿用工作区报告或保存后自动审稿)。 */
|
|
735
|
+
report?: ReviewReport
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/** POST /cover 请求:上传或移除封面。 */
|
|
739
|
+
export interface CoverRequest {
|
|
740
|
+
action: 'upload' | 'remove'
|
|
741
|
+
/** 上传时:data:image/...;base64,... 格式的图片数据。 */
|
|
742
|
+
dataUrl?: string
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/** POST /rename 请求:重命名当前书。 */
|
|
746
|
+
export interface RenameRequest {
|
|
747
|
+
bookName: string
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/** 大世界:一个境界等级。 */
|
|
751
|
+
export interface WorldRealm {
|
|
752
|
+
/** 境界名(练气/筑基/金丹…)。 */
|
|
753
|
+
name: string
|
|
754
|
+
/** 描述:突破条件/寿命/标志等。 */
|
|
755
|
+
description: string
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** 大世界:一个地理区域。 */
|
|
759
|
+
export interface WorldRegion {
|
|
760
|
+
name: string
|
|
761
|
+
description: string
|
|
762
|
+
/** 关联势力名(可空)。 */
|
|
763
|
+
faction?: string
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/** 大世界:一方势力。 */
|
|
767
|
+
export interface WorldFaction {
|
|
768
|
+
name: string
|
|
769
|
+
/** 类型:宗门/家族/王朝/组织… */
|
|
770
|
+
kind: string
|
|
771
|
+
description: string
|
|
772
|
+
/** 驻地区域(可空)。 */
|
|
773
|
+
region?: string
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/** 大世界结构化数据。 */
|
|
777
|
+
export interface WorldState {
|
|
778
|
+
realms: WorldRealm[]
|
|
779
|
+
regions: WorldRegion[]
|
|
780
|
+
factions: WorldFaction[]
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/** POST /world 请求:AI 提炼或手动保存。 */
|
|
784
|
+
export interface WorldRequest {
|
|
785
|
+
action: 'generate' | 'save'
|
|
786
|
+
/** action=save 时的完整世界数据。 */
|
|
787
|
+
world?: WorldState
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/** GET /cover 响应:封面的 dataUrl(无封面为 null)。 */
|
|
791
|
+
export interface CoverResponse {
|
|
792
|
+
dataUrl: string | null
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/** The persisted project: outline + bible + plan + progress. */
|
|
796
|
+
export interface ProjectState {
|
|
797
|
+
/** Book title (first non-empty line of the outline, usually). */
|
|
798
|
+
bookName: string
|
|
799
|
+
/** Full outline text (docx-extracted or pasted). */
|
|
800
|
+
outline: string
|
|
801
|
+
/** Source outline path when loaded from a docx. */
|
|
802
|
+
outlinePath?: string
|
|
803
|
+
/** Structured story bible (worldbuilding), if generated. */
|
|
804
|
+
bible?: StoryBible
|
|
805
|
+
/** Volumes, if planned. */
|
|
806
|
+
volumes?: Volume[]
|
|
807
|
+
/** Chapter plan. */
|
|
808
|
+
chapters: ChapterPlan[]
|
|
809
|
+
/** Foreshadowing threads. */
|
|
810
|
+
foreshadows: Foreshadow[]
|
|
811
|
+
/** 写作资产(题材基底/推进模式/反AI规则/写法资产)。 */
|
|
812
|
+
assets?: ProjectAssets
|
|
813
|
+
/** 事实库/时间线:每章生成后抽取,注入后续章节保持一致性。 */
|
|
814
|
+
facts?: ChapterFact[]
|
|
815
|
+
/** 小说简介(面向读者的作品门面,AI 生成或手动保存)。 */
|
|
816
|
+
blurb?: string
|
|
817
|
+
/** 封面文件名(相对输出目录,如 cover.png)。 */
|
|
818
|
+
coverPath?: string
|
|
819
|
+
/** 大世界结构化数据(境界体系/区域/势力)。 */
|
|
820
|
+
world?: WorldState
|
|
821
|
+
/** 剧情线(主线/支线/人物线/悬念线)。 */
|
|
822
|
+
plotlines?: Plotline[]
|
|
823
|
+
/** 角色库(作者维护 + AI 提炼的主表)。 */
|
|
824
|
+
roles?: RoleRecord[]
|
|
825
|
+
/** 场景库(作者维护 + AI 提炼的主表)。 */
|
|
826
|
+
scenes?: SceneCard[]
|
|
827
|
+
/** 视觉世界观规则(生图/生视频必须遵守,从道藏提炼,注入所有提示词)。 */
|
|
828
|
+
visualRules?: string[]
|
|
829
|
+
/** 人物志:角色当前状态聚合结果(从编年录刷新后存档,打开页面直接显示)。 */
|
|
830
|
+
roleStatus?: RoleStatusCard[]
|
|
831
|
+
/** 漫剧分镜结果缓存:章号 → 分镜(持久化,刷新不丢)。 */
|
|
832
|
+
/** 漫剧分集计划缓存:卷号/0=全书 → 分集计划(持久化,刷新不丢)。 */
|
|
833
|
+
/** 漫画脚本缓存:章号 → 漫画脚本(持久化,刷新不丢)。 */
|
|
834
|
+
/** ISO timestamps. */
|
|
835
|
+
createdAt: string
|
|
836
|
+
updatedAt: string
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/** Runtime config surface exposed to the panel (subset of plugin Config). */
|
|
840
|
+
export interface NovelConfig {
|
|
841
|
+
/** Absolute path of the default docx outline to load. */
|
|
842
|
+
outlinePath: string
|
|
843
|
+
/** Absolute output directory for chapters + project state. */
|
|
844
|
+
outputDir: string
|
|
845
|
+
/** LLM provider route (e.g. deepseek-official). */
|
|
846
|
+
provider: string
|
|
847
|
+
/** LLM model id (e.g. deepseek-v4-flash). */
|
|
848
|
+
model: string
|
|
849
|
+
/** LLM reasoning effort: off = no thinking; low/high/max = thinking intensity. */
|
|
850
|
+
reasoningEffort: 'off' | 'low' | 'high' | 'max'
|
|
851
|
+
/** Target characters per chapter. */
|
|
852
|
+
chapterChars: number
|
|
853
|
+
/** Max output tokens per chapter call. */
|
|
854
|
+
maxTokens: number
|
|
855
|
+
/** Review pass threshold (0-100). */
|
|
856
|
+
reviewPassScore: number
|
|
857
|
+
/** Whether generation auto-runs review after writing. */
|
|
858
|
+
autoReview: boolean
|
|
859
|
+
/** Whether generation auto-runs the author review (hook/continuity/trend) after writing. */
|
|
860
|
+
autoAuthorReview: boolean
|
|
861
|
+
/** 修订/润色产出草稿后是否自动附带一次 AI 审查(工作区显示新稿评分与剩余问题)。 */
|
|
862
|
+
autoReviewAfterRevise: boolean
|
|
863
|
+
/** 豆包/Seedream 生图 API Key(保存在服务端配置,不暴露给前端明文回显)。 */
|
|
864
|
+
imageApiKey?: string
|
|
865
|
+
/** 豆包/Seedream 生图模型 ID(如 doubao-seedream-5-0-pro-260628)。 */
|
|
866
|
+
imageApiModel?: string
|
|
867
|
+
/** 是否启用豆包生图(默认关,避免误调用付费 API)。 */
|
|
868
|
+
imageApiEnabled?: boolean
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/** GET /status response. */
|
|
872
|
+
export interface StatusResponse {
|
|
873
|
+
config: NovelConfig
|
|
874
|
+
/** The persisted project, when one exists in the output dir. */
|
|
875
|
+
project?: ProjectState
|
|
876
|
+
/** Chapter files already on disk (basenames, sorted). */
|
|
877
|
+
generatedFiles: string[]
|
|
878
|
+
/** 全书质检实时状态(用于面板/外部读取进度)。 */
|
|
879
|
+
audit?: AuditStatus
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/** 生产单状态(生产单 = 区间批量生产执行器:计划补足 + 逐章生成 + 被拒分级处理)。 */
|
|
883
|
+
export interface RunState {
|
|
884
|
+
runId: string
|
|
885
|
+
/** 区间起点(含)。 */
|
|
886
|
+
startNo: number
|
|
887
|
+
/** 区间终点(含)。 */
|
|
888
|
+
endNo: number
|
|
889
|
+
status: 'running' | 'paused' | 'done' | 'stopped' | 'error'
|
|
890
|
+
/** 当前处理到的章号(已 approved 的章会快进)。 */
|
|
891
|
+
currentNo: number
|
|
892
|
+
stats: {
|
|
893
|
+
/** 新生成(含审稿)的章数。 */
|
|
894
|
+
generated: number
|
|
895
|
+
/** 被拒后按意见修订并通过的章数。 */
|
|
896
|
+
revised: number
|
|
897
|
+
/** 被拒后豁免通过(无 high)的章数。 */
|
|
898
|
+
exempted: number
|
|
899
|
+
/** error 后重新生成的章数。 */
|
|
900
|
+
regenerated: number
|
|
901
|
+
/** 生成失败的章数。 */
|
|
902
|
+
error: number
|
|
903
|
+
}
|
|
904
|
+
/** 两轮修订仍不过、保留草稿待人工的章号。 */
|
|
905
|
+
pendingManual: number[]
|
|
906
|
+
/** 运行日志(保留最近 300 条)。 */
|
|
907
|
+
log: Array<{ at: string; text: string }>
|
|
908
|
+
startedAt: string
|
|
909
|
+
updatedAt: string
|
|
910
|
+
error?: string
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/** POST /run/start request. */
|
|
914
|
+
export interface RunStartRequest {
|
|
915
|
+
/** 起始章号(默认 1)。 */
|
|
916
|
+
startNo?: number
|
|
917
|
+
/** 结束章号(含;超出计划时自动补计划)。 */
|
|
918
|
+
endNo?: number
|
|
919
|
+
/** 或指定新增章数(从当前最后一章 +1 起)。 */
|
|
920
|
+
count?: number
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** POST /run/control request. */
|
|
924
|
+
export interface RunControlRequest {
|
|
925
|
+
action: 'pause' | 'resume' | 'stop'
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/** POST /load-outline request: either a docx path or raw text. */
|
|
929
|
+
export interface LoadOutlineRequest {
|
|
930
|
+
/** Absolute docx path; defaults to the configured outline path. */
|
|
931
|
+
path?: string
|
|
932
|
+
/** Raw outline text (takes precedence over path when present). */
|
|
933
|
+
text?: string
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/** POST /load-outline response. */
|
|
937
|
+
export interface LoadOutlineResponse {
|
|
938
|
+
outline: string
|
|
939
|
+
bookName: string
|
|
940
|
+
chars: number
|
|
941
|
+
path?: string
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/** POST /plan request. */
|
|
945
|
+
export interface PlanRequest {
|
|
946
|
+
/** Outline to plan from; defaults to the persisted project's outline. */
|
|
947
|
+
outline?: string
|
|
948
|
+
/** Number of chapters to plan (default: 30). */
|
|
949
|
+
chapterCount?: number
|
|
950
|
+
/** Volume to plan (1-based); when given, plans only that volume's chapters. */
|
|
951
|
+
volume?: number
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/** POST /plan response. */
|
|
955
|
+
export interface PlanResponse {
|
|
956
|
+
chapters: ChapterPlan[]
|
|
957
|
+
volumes?: Volume[]
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/** POST /volumes request/response. */
|
|
961
|
+
export interface VolumesRequest {
|
|
962
|
+
/** Outline to split into volumes; defaults to the project outline. */
|
|
963
|
+
outline?: string
|
|
964
|
+
}
|
|
965
|
+
export interface VolumesResponse {
|
|
966
|
+
volumes: Volume[]
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/** POST /bible request/response. */
|
|
970
|
+
export interface BibleRequest {
|
|
971
|
+
/** Outline to extract from; defaults to the project outline. */
|
|
972
|
+
outline?: string
|
|
973
|
+
}
|
|
974
|
+
export interface BibleResponse {
|
|
975
|
+
bible: StoryBible
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/** POST /generate request: one chapter of the current project. */
|
|
979
|
+
export interface GenerateRequest {
|
|
980
|
+
chapterNo: number
|
|
981
|
+
/** When true, skips the auto-review step. */
|
|
982
|
+
skipReview?: boolean
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/** One NDJSON frame of a generation/review/rewrite stream. */
|
|
986
|
+
export type JobFrame =
|
|
987
|
+
| { type: 'start'; no: number; title: string }
|
|
988
|
+
| { type: 'delta'; text: string }
|
|
989
|
+
| { type: 'progress'; chars: number }
|
|
990
|
+
| { type: 'done'; no: number; file: string; chars: number; title: string }
|
|
991
|
+
| { type: 'review'; no: number; report: ReviewReport }
|
|
992
|
+
| { type: 'author-review'; no: number; review: AuthorReview }
|
|
993
|
+
| { type: 'author-backfill-done'; count: number }
|
|
994
|
+
| { type: 'rewritten'; no: number; file: string; chars: number }
|
|
995
|
+
/** 润色/重写完成,产物作为待确认草稿(尚未覆盖正文)。 */
|
|
996
|
+
| { type: 'drafted'; no: number; chars: number; draft: string }
|
|
997
|
+
| { type: 'error'; no: number; message: string }
|
|
998
|
+
|
|
999
|
+
/** POST /review request: review one written chapter. */
|
|
1000
|
+
export interface ReviewRequest {
|
|
1001
|
+
chapterNo: number
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/** POST /rewrite request: rewrite one chapter (optionally per review issues). */
|
|
1005
|
+
export interface RewriteRequest {
|
|
1006
|
+
chapterNo: number
|
|
1007
|
+
/** Free-form instructions; defaults to fixing the review's high issues. */
|
|
1008
|
+
instructions?: string
|
|
1009
|
+
/**
|
|
1010
|
+
* 局部修订:正文中的一段原文(无需完全精确,取一个自然段内的片段即可)。
|
|
1011
|
+
* 提供时只重写该段,其余正文保持不变;不提供时整章重写。
|
|
1012
|
+
*/
|
|
1013
|
+
target?: string
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/** POST /polish request: de-AI-ify one chapter. */
|
|
1017
|
+
export interface PolishRequest {
|
|
1018
|
+
chapterNo: number
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** POST /draft/apply | /draft/discard request: 采纳或放弃待确认草稿。 */
|
|
1022
|
+
export interface DraftDecisionRequest {
|
|
1023
|
+
chapterNo: number
|
|
1024
|
+
/** apply 时可携带审查报告(沿用结论定状态;不携带则置 written)。 */
|
|
1025
|
+
report?: ReviewReport
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/** POST /summary request: (re)generate a chapter summary. */
|
|
1029
|
+
export interface SummaryRequest {
|
|
1030
|
+
chapterNo: number
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/** POST /foreshadow request: create, update, or AI-suggest foreshadows. */
|
|
1034
|
+
export interface ForeshadowRequest {
|
|
1035
|
+
/** When true, runs the LLM suggestion pass (ignores other fields). */
|
|
1036
|
+
suggest?: boolean
|
|
1037
|
+
/** When given, updates that foreshadow instead of creating one. */
|
|
1038
|
+
id?: string
|
|
1039
|
+
description?: string
|
|
1040
|
+
plantedChapter?: number
|
|
1041
|
+
targetChapter?: number
|
|
1042
|
+
status?: Foreshadow['status']
|
|
1043
|
+
resolvedNote?: string
|
|
1044
|
+
}
|
|
1045
|
+
export interface ForeshadowResponse {
|
|
1046
|
+
foreshadows: Foreshadow[]
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/** GET /chapter response. */
|
|
1050
|
+
export interface ChapterResponse {
|
|
1051
|
+
no: number
|
|
1052
|
+
title: string
|
|
1053
|
+
markdown: string
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/** POST /export request/response. */
|
|
1057
|
+
export interface ExportRequest {
|
|
1058
|
+
format: 'txt' | 'md'
|
|
1059
|
+
}
|
|
1060
|
+
export interface ExportResponse {
|
|
1061
|
+
file: string
|
|
1062
|
+
chars: number
|
|
1063
|
+
chapters: number
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/** POST /config request: patch any subset of the runtime config. */
|
|
1067
|
+
export interface ConfigPatch {
|
|
1068
|
+
outlinePath?: string
|
|
1069
|
+
outputDir?: string
|
|
1070
|
+
provider?: string
|
|
1071
|
+
model?: string
|
|
1072
|
+
reasoningEffort?: 'off' | 'low' | 'high' | 'max'
|
|
1073
|
+
chapterChars?: number
|
|
1074
|
+
maxTokens?: number
|
|
1075
|
+
reviewPassScore?: number
|
|
1076
|
+
autoReview?: boolean
|
|
1077
|
+
autoAuthorReview?: boolean
|
|
1078
|
+
autoReviewAfterRevise?: boolean
|
|
1079
|
+
imageApiKey?: string
|
|
1080
|
+
imageApiModel?: string
|
|
1081
|
+
imageApiEnabled?: boolean
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
// ------------------------------------------------------------ assistant
|
|
1085
|
+
|
|
1086
|
+
/** One assistant conversation message (persisted per project). */
|
|
1087
|
+
export interface AssistantMessage {
|
|
1088
|
+
role: 'user' | 'assistant' | 'tool'
|
|
1089
|
+
/** Message text (tool messages carry the tool result). */
|
|
1090
|
+
content: string
|
|
1091
|
+
/** ISO timestamp. */
|
|
1092
|
+
ts: string
|
|
1093
|
+
/** For tool messages: which tool ran. */
|
|
1094
|
+
tool?: string
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/** POST /assistant request: one user turn. */
|
|
1098
|
+
export interface AssistantRequest {
|
|
1099
|
+
message: string
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/** One NDJSON frame of the assistant stream. */
|
|
1103
|
+
export type AssistantFrame =
|
|
1104
|
+
| { type: 'delta'; text: string }
|
|
1105
|
+
| { type: 'tool'; name: string; status: 'start' | 'done' | 'error'; detail?: string }
|
|
1106
|
+
/** Live output while a tool runs (e.g. chapter text being generated). */
|
|
1107
|
+
| { type: 'toolDelta'; name: string; text: string }
|
|
1108
|
+
| { type: 'done' }
|
|
1109
|
+
| { type: 'error'; message: string }
|
|
1110
|
+
|
|
1111
|
+
/** GET /assistant-history response. */
|
|
1112
|
+
export interface AssistantHistoryResponse {
|
|
1113
|
+
messages: AssistantMessage[]
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
// ---------------------------------------------------------- writing assets
|
|
1117
|
+
|
|
1118
|
+
/** 题材基底库:一本书属于哪个阅读市场。树形(题材→子题材→下级)。 */
|
|
1119
|
+
export interface GenreNode {
|
|
1120
|
+
/** 题材名称(标签,如「仙侠修真」「都市异能」)。 */
|
|
1121
|
+
name: string
|
|
1122
|
+
/** 题材特征、常见爽点、叙事重心或读者期待。 */
|
|
1123
|
+
description: string
|
|
1124
|
+
/** 子题材。 */
|
|
1125
|
+
children: GenreNode[]
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/** 推进模式库:读者为什么继续看下一章。 */
|
|
1129
|
+
export interface ProgressionMode {
|
|
1130
|
+
/** 模式名称(如「升级变强」「经营扩张」「解谜揭露」)。 */
|
|
1131
|
+
name: string
|
|
1132
|
+
/** 核心驱动力:靠什么制造追读动力。 */
|
|
1133
|
+
driver: string
|
|
1134
|
+
/** 读者期待:每隔几章获得什么变化或回报。 */
|
|
1135
|
+
readerExpectation: string
|
|
1136
|
+
/** 常见兑现方式(爽点如何落地)。 */
|
|
1137
|
+
payoffs: string[]
|
|
1138
|
+
/** 节奏风险:最怕什么(重复升级、冲突变弱、谜题拖太久…)。 */
|
|
1139
|
+
risks: string[]
|
|
1140
|
+
/** 主模式或辅助模式。 */
|
|
1141
|
+
primary: boolean
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/** 反 AI 规则:一条「要避免的问题 + 修正方向」。 */
|
|
1145
|
+
export interface AntiAiRule {
|
|
1146
|
+
/** 规则名(如「禁止解释型心理描写」「AI 高频套话」)。 */
|
|
1147
|
+
name: string
|
|
1148
|
+
/** 要避免的表达问题,具体可检查。 */
|
|
1149
|
+
avoid: string
|
|
1150
|
+
/** 推荐修正方向。 */
|
|
1151
|
+
fix: string
|
|
1152
|
+
/** 命中即告警的具体表达模式(用于审稿逐条核对与去 AI 味检测)。 */
|
|
1153
|
+
detectPatterns?: string[]
|
|
1154
|
+
/** 是否内置全局规则(内置规则随插件发布,项目规则为用户自定义)。 */
|
|
1155
|
+
builtin?: boolean
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/** 预置写法模板(来自 AI-Novel-Writing-Assistant 内置数据,一键绑定无需样本文本)。 */
|
|
1159
|
+
export interface StyleTemplate {
|
|
1160
|
+
/** 模板 key(如 power-up-escalation)。 */
|
|
1161
|
+
key: string
|
|
1162
|
+
/** 模板名(如「爽文递进推进流」)。 */
|
|
1163
|
+
name: string
|
|
1164
|
+
/** 模板说明。 */
|
|
1165
|
+
description: string
|
|
1166
|
+
/** 分类(如「爽文流」「悬疑流」)。 */
|
|
1167
|
+
category: string
|
|
1168
|
+
/** 适用题材。 */
|
|
1169
|
+
applicableGenres: string[]
|
|
1170
|
+
/** 叙述规则。 */
|
|
1171
|
+
proseRules: string[]
|
|
1172
|
+
/** 角色/台词规则。 */
|
|
1173
|
+
dialogueRules: string[]
|
|
1174
|
+
/** 语言规则。 */
|
|
1175
|
+
languageRules: string[]
|
|
1176
|
+
/** 节奏规则。 */
|
|
1177
|
+
rhythmRules: string[]
|
|
1178
|
+
/** 该模板默认绑定的反 AI 规则 key(内置规则名)。 */
|
|
1179
|
+
defaultAntiAiRuleKeys: string[]
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/** 写法引擎:从样本文本提取的叙事风格资产。 */
|
|
1183
|
+
export interface StyleAsset {
|
|
1184
|
+
/** 资产名(如「林越式痞坏」「冷峻猎手风」)。 */
|
|
1185
|
+
name: string
|
|
1186
|
+
/** 叙述视角与句式节奏。 */
|
|
1187
|
+
proseRules: string[]
|
|
1188
|
+
/** 角色台词风格。 */
|
|
1189
|
+
dialogueRules: string[]
|
|
1190
|
+
/** 描写密度与情绪表达。 */
|
|
1191
|
+
descriptionRules: string[]
|
|
1192
|
+
/** 表达边界(不要做什么)。 */
|
|
1193
|
+
boundaries: string[]
|
|
1194
|
+
/** 来源样本文本(可空)。 */
|
|
1195
|
+
sourceText?: string
|
|
1196
|
+
/** 创建时间。 */
|
|
1197
|
+
createdAt: string
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
/** 项目写作资产(题材基底 + 推进模式 + 反 AI 规则 + 写法资产)。 */
|
|
1201
|
+
export interface ProjectAssets {
|
|
1202
|
+
/** 本书选用的题材(可以是题材基底库中某节点名)。 */
|
|
1203
|
+
genre?: GenreNode
|
|
1204
|
+
/** 主推进模式。 */
|
|
1205
|
+
primaryProgression?: ProgressionMode
|
|
1206
|
+
/** 辅助推进模式。 */
|
|
1207
|
+
auxiliaryProgressions: ProgressionMode[]
|
|
1208
|
+
/** 生效的反 AI 规则(内置 + 自定义)。 */
|
|
1209
|
+
antiAiRules: AntiAiRule[]
|
|
1210
|
+
/** 绑定的写法资产。 */
|
|
1211
|
+
styleAssets: StyleAsset[]
|
|
1212
|
+
/** 资产更新时间。 */
|
|
1213
|
+
updatedAt?: string
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/** GET /assets response(含全局题材库与反 AI 规则库)。 */
|
|
1217
|
+
export interface AssetsResponse {
|
|
1218
|
+
projectAssets: ProjectAssets
|
|
1219
|
+
/** 全局题材基底库(可复用资产,跨书)。 */
|
|
1220
|
+
genreLibrary: GenreNode[]
|
|
1221
|
+
/** 全局反 AI 规则库(内置默认规则)。 */
|
|
1222
|
+
antiAiLibrary: AntiAiRule[]
|
|
1223
|
+
/** 预置写法模板(一键绑定,无需样本文本)。 */
|
|
1224
|
+
styleTemplates: StyleTemplate[]
|
|
1225
|
+
/** 内置推进模式候选。 */
|
|
1226
|
+
progressionLibrary: ProgressionMode[]
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/** POST /assets request:更新项目写作资产(部分字段可选)。 */
|
|
1230
|
+
export interface AssetsPatch {
|
|
1231
|
+
genre?: GenreNode
|
|
1232
|
+
primaryProgression?: ProgressionMode
|
|
1233
|
+
auxiliaryProgressions?: ProgressionMode[]
|
|
1234
|
+
antiAiRules?: AntiAiRule[]
|
|
1235
|
+
styleAssets?: StyleAsset[]
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/** POST /style-engine request:从样本文本提取写法资产。 */
|
|
1239
|
+
export interface StyleEngineRequest {
|
|
1240
|
+
/** 样本文本(风格来源)。 */
|
|
1241
|
+
sampleText: string
|
|
1242
|
+
/** 资产名(可选,默认「风格资产 N」)。 */
|
|
1243
|
+
name?: string
|
|
1244
|
+
}
|