@waterwx/dsh-novel-forge 2.0.1-alpha → 2.1.0-alpha

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.
Files changed (135) hide show
  1. package/README.md +97 -2
  2. package/lib/client.js +3291 -752
  3. package/lib/index.js +3557 -237
  4. package/lib/types/assets.d.ts +16 -3
  5. package/lib/types/assistant.d.ts +4 -0
  6. package/lib/types/client/api.d.ts +89 -0
  7. package/lib/types/client/llmLive.d.ts +33 -0
  8. package/lib/types/client/locales.d.ts +3 -3
  9. package/lib/types/client/panel/AdaptModeView.d.ts +1 -1
  10. package/lib/types/client/panel/AssetsTab.d.ts +1 -1
  11. package/lib/types/client/panel/AssistantTab.d.ts +1 -1
  12. package/lib/types/client/panel/AuthorAssetsView.d.ts +1 -1
  13. package/lib/types/client/panel/AuthorHome.d.ts +4 -2
  14. package/lib/types/client/panel/BookAnalysisView.d.ts +4 -0
  15. package/lib/types/client/panel/BookshelfBar.d.ts +1 -1
  16. package/lib/types/client/panel/CreateBookView.d.ts +6 -2
  17. package/lib/types/client/panel/DirectorView.d.ts +7 -0
  18. package/lib/types/client/panel/FlowGuide.d.ts +1 -1
  19. package/lib/types/client/panel/GlobalAssetLibraryView.d.ts +1 -1
  20. package/lib/types/client/panel/IdeaInspirationView.d.ts +6 -0
  21. package/lib/types/client/panel/ImportModal.d.ts +1 -1
  22. package/lib/types/client/panel/KnowledgeBaseView.d.ts +4 -0
  23. package/lib/types/client/panel/LiveFeedLog.d.ts +5 -0
  24. package/lib/types/client/panel/MangaRoleLibrary.d.ts +1 -1
  25. package/lib/types/client/panel/MangaWorkspace.d.ts +1 -1
  26. package/lib/types/client/panel/MarketRadarView.d.ts +5 -0
  27. package/lib/types/client/panel/NovelPanel.d.ts +2 -2
  28. package/lib/types/client/panel/ProgressConsole.d.ts +1 -1
  29. package/lib/types/client/panel/ProgressHomeView.d.ts +1 -1
  30. package/lib/types/client/panel/PropLibrary.d.ts +1 -1
  31. package/lib/types/client/panel/ReaderView.d.ts +1 -1
  32. package/lib/types/client/panel/RunPanel.d.ts +1 -1
  33. package/lib/types/client/panel/SceneLibrary.d.ts +1 -1
  34. package/lib/types/client/panel/SettingsView.d.ts +1 -1
  35. package/lib/types/client/panel/ShelfView.d.ts +1 -1
  36. package/lib/types/client/panel/StoryboardTab.d.ts +1 -1
  37. package/lib/types/client/panel/StyleCard.d.ts +1 -1
  38. package/lib/types/client/panel/StyleGallery.d.ts +1 -1
  39. package/lib/types/client/panel/WorldTab.d.ts +1 -1
  40. package/lib/types/engine.d.ts +29 -1
  41. package/lib/types/global-assets.d.ts +6 -0
  42. package/lib/types/index.d.ts +6 -0
  43. package/lib/types/llm-live.d.ts +44 -0
  44. package/lib/types/market-radar-scan.d.ts +19 -0
  45. package/lib/types/market-radar-sources.d.ts +31 -0
  46. package/lib/types/prompting.d.ts +35 -0
  47. package/lib/types/protocol.d.ts +364 -8
  48. package/lib/types/run.d.ts +1 -1
  49. package/lib/types/src/ai-scan.d.ts +36 -0
  50. package/lib/types/src/assets.d.ts +37 -0
  51. package/lib/types/src/assistant.d.ts +45 -0
  52. package/lib/types/src/author-assets.d.ts +25 -0
  53. package/lib/types/src/bookshelf.d.ts +42 -0
  54. package/lib/types/src/client/api.d.ts +234 -0
  55. package/lib/types/src/client/docx.d.ts +15 -0
  56. package/lib/types/src/client/index.d.ts +14 -0
  57. package/lib/types/src/client/locales.d.ts +212 -0
  58. package/lib/types/src/client/mount.d.ts +9 -0
  59. package/lib/types/src/client/panel/AdaptModeView.d.ts +5 -0
  60. package/lib/types/src/client/panel/AssetsTab.d.ts +12 -0
  61. package/lib/types/src/client/panel/AssistantTab.d.ts +7 -0
  62. package/lib/types/src/client/panel/AuthorAssetsView.d.ts +4 -0
  63. package/lib/types/src/client/panel/AuthorHome.d.ts +32 -0
  64. package/lib/types/src/client/panel/BookshelfBar.d.ts +11 -0
  65. package/lib/types/src/client/panel/CreateBookView.d.ts +9 -0
  66. package/lib/types/src/client/panel/FlowGuide.d.ts +22 -0
  67. package/lib/types/src/client/panel/GlobalAssetLibraryView.d.ts +4 -0
  68. package/lib/types/src/client/panel/ImportModal.d.ts +7 -0
  69. package/lib/types/src/client/panel/MangaRoleLibrary.d.ts +20 -0
  70. package/lib/types/src/client/panel/MangaWorkspace.d.ts +12 -0
  71. package/lib/types/src/client/panel/ModelManager.d.ts +14 -0
  72. package/lib/types/src/client/panel/NovelPanel.d.ts +13 -0
  73. package/lib/types/src/client/panel/ProgressConsole.d.ts +17 -0
  74. package/lib/types/src/client/panel/ProgressHomeView.d.ts +5 -0
  75. package/lib/types/src/client/panel/PropLibrary.d.ts +8 -0
  76. package/lib/types/src/client/panel/ReaderView.d.ts +8 -0
  77. package/lib/types/src/client/panel/ReasoningSection.d.ts +10 -0
  78. package/lib/types/src/client/panel/RunPanel.d.ts +5 -0
  79. package/lib/types/src/client/panel/SceneLibrary.d.ts +16 -0
  80. package/lib/types/src/client/panel/SettingsView.d.ts +16 -0
  81. package/lib/types/src/client/panel/ShelfView.d.ts +15 -0
  82. package/lib/types/src/client/panel/StoryboardTab.d.ts +19 -0
  83. package/lib/types/src/client/panel/StyleCard.d.ts +8 -0
  84. package/lib/types/src/client/panel/StyleGallery.d.ts +1 -0
  85. package/lib/types/src/client/panel/WorldTab.d.ts +10 -0
  86. package/lib/types/src/client/panel/controller.d.ts +19 -0
  87. package/lib/types/src/client/panel/helpers.d.ts +18 -0
  88. package/lib/types/src/client/panel/views.d.ts +77 -0
  89. package/lib/types/src/client/sidebar-entry.d.ts +13 -0
  90. package/lib/types/src/client/text.d.ts +9 -0
  91. package/lib/types/src/comic-presets.d.ts +12 -0
  92. package/lib/types/src/docx.d.ts +19 -0
  93. package/lib/types/src/engine.d.ts +402 -0
  94. package/lib/types/src/index.d.ts +79 -0
  95. package/lib/types/src/manga-genre-rules.d.ts +22 -0
  96. package/lib/types/src/novel-context.d.ts +80 -0
  97. package/lib/types/src/prompt-utils.d.ts +35 -0
  98. package/lib/types/src/protocol.d.ts +2176 -0
  99. package/lib/types/src/review-policy.d.ts +97 -0
  100. package/lib/types/src/routes.d.ts +29 -0
  101. package/lib/types/src/run.d.ts +32 -0
  102. package/lib/types/src/shot-language.d.ts +46 -0
  103. package/lib/types/src/story-beat-language.d.ts +35 -0
  104. package/lib/types/src/style-library.d.ts +33 -0
  105. package/package.json +1 -1
  106. package/src/assets.ts +1774 -879
  107. package/src/assistant.ts +154 -9
  108. package/src/client/api.ts +105 -6
  109. package/src/client/llmLive.ts +101 -0
  110. package/src/client/locales.ts +4 -4
  111. package/src/client/panel/AdaptModeView.tsx +18 -3
  112. package/src/client/panel/AssistantTab.tsx +41 -3
  113. package/src/client/panel/AuthorHome.tsx +51 -20
  114. package/src/client/panel/BookAnalysisView.tsx +60 -0
  115. package/src/client/panel/CreateBookView.tsx +22 -3
  116. package/src/client/panel/DirectorView.tsx +200 -0
  117. package/src/client/panel/IdeaInspirationView.tsx +71 -0
  118. package/src/client/panel/KnowledgeBaseView.tsx +73 -0
  119. package/src/client/panel/LiveFeedLog.tsx +76 -0
  120. package/src/client/panel/MarketRadarView.tsx +374 -0
  121. package/src/client/panel/NovelPanel.tsx +117 -16
  122. package/src/client/panel/ProgressConsole.tsx +5 -6
  123. package/src/client/panel/SettingsView.tsx +3 -0
  124. package/src/client/panel/panel.module.css +2 -3
  125. package/src/engine.ts +459 -23
  126. package/src/global-assets.ts +59 -0
  127. package/src/index.ts +17 -1
  128. package/src/llm-live.ts +68 -0
  129. package/src/market-radar-scan.ts +41 -0
  130. package/src/market-radar-sources.ts +173 -0
  131. package/src/prompting.ts +159 -0
  132. package/src/protocol.ts +340 -8
  133. package/src/routes.ts +579 -59
  134. package/src/run.ts +15 -8
  135. package/skills/chapter-batch/SKILL.md +0 -81
package/src/protocol.ts CHANGED
@@ -25,6 +25,20 @@ export const NOVEL_API = {
25
25
  bible: '/api/dsh-novel-forge/bible',
26
26
  assets: '/api/dsh-novel-forge/assets',
27
27
  styleEngine: '/api/dsh-novel-forge/style-engine',
28
+ styleFormula: '/api/dsh-novel-forge/style-formula',
29
+ styleDetect: '/api/dsh-novel-forge/style-detect',
30
+ knowledge: '/api/dsh-novel-forge/knowledge',
31
+ bookAnalysis: '/api/dsh-novel-forge/book-analysis',
32
+ ideaInspiration: '/api/dsh-novel-forge/idea-inspiration',
33
+ ideaInspirationMarket: '/api/dsh-novel-forge/idea-inspiration/market',
34
+ director: '/api/dsh-novel-forge/director',
35
+ directorTodos: '/api/dsh-novel-forge/director/todos',
36
+ llmLive: '/api/dsh-novel-forge/llm-live/stream',
37
+ marketRadar: '/api/dsh-novel-forge/market-radar',
38
+ marketRadarScan: '/api/dsh-novel-forge/market-radar/scan',
39
+ marketRadarApply: '/api/dsh-novel-forge/market-radar/apply',
40
+ marketRadarSync: '/api/dsh-novel-forge/market-radar/foundation-sync',
41
+ marketRadarBrief: '/api/dsh-novel-forge/market-radar/brief',
28
42
  generate: '/api/dsh-novel-forge/generate',
29
43
  review: '/api/dsh-novel-forge/review',
30
44
  rewrite: '/api/dsh-novel-forge/rewrite',
@@ -588,6 +602,18 @@ export interface ChapterPlan {
588
602
  beats: string
589
603
  /** Target character count (defaults to the configured chapter size). */
590
604
  targetChars: number
605
+ /** 本章必达项(必须推进的局面/关系/信息/风险/决策变化)。 */
606
+ mustAdvance?: string[]
607
+ /** 本章必须保持/不得破坏的项(如人物状态、已有伏笔不提前揭)。 */
608
+ mustPreserve?: string[]
609
+ /** 本章不可违背的人物硬事实(身份/阵营/境界/当前位置/知情度)。 */
610
+ characterHardFacts?: string[]
611
+ /** 伏笔操作指令(seed/touch/pressure/partial_reveal/payoff/forbid)。 */
612
+ payoffDirectives?: Array<{ no?: number; operation?: 'seed' | 'touch' | 'pressure' | 'partial_reveal' | 'payoff' | 'forbid'; text?: string }>
613
+ /** 章末钩子要求(悬念/反转/新线索/未闭合选择)。 */
614
+ endingHook?: string
615
+ /** 本章义务合约(人类可读摘要,供生成与审稿共同锚定)。 */
616
+ obligation?: string
591
617
  /** Generation/review state. */
592
618
  status: ChapterStatus
593
619
  /** 进入 generating 的时间(用于超时自动复位;未在生成时无此字段)。 */
@@ -627,6 +653,14 @@ export interface AuthorReview {
627
653
  continuity: string
628
654
  /** 近期节奏趋势提示(拖沓/爽点密度等)。 */
629
655
  trend: string
656
+ /** 本章发生的关键状态变化(人物状态/世界局面/关系/资源),用于回灌整本与事实库。 */
657
+ stateChanges?: string[]
658
+ /** 本章新引入或升级的冲突(供整本控制层与后续卷节奏参考)。 */
659
+ newConflicts?: string[]
660
+ /** 本章埋下/推进的新线索(供知识与伏笔系统回灌)。 */
661
+ clues?: string[]
662
+ /** 本章缺席但值得注意的角色及风险(卷级职责/缺席风险)。 */
663
+ absentRisks?: string[]
630
664
  /** 复盘时间。 */
631
665
  reviewedAt: string
632
666
  }
@@ -644,6 +678,18 @@ export interface ReviewIssue {
644
678
  item: string
645
679
  /** Concrete suggestion for fixing it. */
646
680
  suggestion: string
681
+ /** 命中的反 AI 规则名(结构化,便于统计)。 */
682
+ ruleName?: string
683
+ /** 规则类别:forbidden / risk / encourage。 */
684
+ ruleType?: 'forbidden' | 'risk' | 'encourage'
685
+ /** 问题细分类(如 套话 句式 段落 心理 设定)。 */
686
+ category?: string
687
+ /** 命中的原文摘录。 */
688
+ excerpt?: string
689
+ /** 判定理由。 */
690
+ reason?: string
691
+ /** 是否可自动改写。 */
692
+ canAutoRewrite?: boolean
647
693
  }
648
694
 
649
695
  /** AI review report for one chapter. */
@@ -656,6 +702,12 @@ export interface ReviewReport {
656
702
  verdict: string
657
703
  /** Individual findings. */
658
704
  issues: ReviewIssue[]
705
+ /** 风险分 0-100(越高越需人工处理;源自 LLM 复核与本地扫描)。 */
706
+ riskScore?: number
707
+ /** 本地 AI 味指数 0-100(越高越像 AI;LLM 复核锚点,供 UI 展示)。 */
708
+ aiFlavor?: number
709
+ /** 本地扫描命中的高频套话(按次数降序,取前若干)。 */
710
+ aiPhrases?: Array<{ word: string; count: number }>
659
711
  /** When the review ran. */
660
712
  reviewedAt: string
661
713
  }
@@ -672,6 +724,139 @@ export interface Volume {
672
724
  chapterStart: number
673
725
  /** Last chapter number (inclusive). */
674
726
  chapterEnd: number
727
+ /** 卷级战略(这一卷的定位/承转,如「立威卷」「冲突升级卷」)。 */
728
+ strategy?: string
729
+ /** 卷节奏板(这一卷的节奏安排:起-承-转-合/爽点密度/关键节点)。 */
730
+ pacing?: string
731
+ }
732
+
733
+ /** 开书定盘:面向读者的承诺与流派定位(生成/规划均可引用)。 */
734
+ export interface BookContract {
735
+ /** 一句话卖点/题材承诺。 */
736
+ promise?: string
737
+ /** 主推进模式名(从推进模式库选)。 */
738
+ primaryModeName?: string
739
+ /** 辅助推进模式名。 */
740
+ secondaryModeNames?: string[]
741
+ /** 整体文风基调(一句话)。 */
742
+ tone?: string
743
+ /** 目标平台(如「番茄」)。 */
744
+ targetPlatform?: string
745
+ }
746
+
747
+ /** 书内知识库文档(供生成/规划时检索注入的参考资料)。 */
748
+ export interface KnowledgeDoc {
749
+ id: string
750
+ title: string
751
+ content: string
752
+ updatedAt: string
753
+ }
754
+
755
+ /** POST /knowledge request:增删改知识库文档。 */
756
+ export interface KnowledgeRequest {
757
+ action: 'add' | 'remove' | 'replace'
758
+ doc?: { id?: string; title: string; content: string }
759
+ id?: string
760
+ }
761
+
762
+ /** POST /book-analysis request。 */
763
+ export interface BookAnalysisRequest {
764
+ text: string
765
+ }
766
+
767
+ /** 书分析/拆书结果。 */
768
+ export interface BookAnalysisResult {
769
+ sellingPoints: string[]
770
+ structure: string[]
771
+ lessons: string[]
772
+ risks: string[]
773
+ }
774
+
775
+ /** POST /idea-inspiration request。 */
776
+ export interface IdeaInspirationRequest {
777
+ idea: string
778
+ count?: number
779
+ }
780
+
781
+ /** 创意灵感结果:多方向开书灵感。 */
782
+ export interface IdeaInspirationResult {
783
+ ideas: Array<{ title: string; hook: string; genre: string; pov: string; payoff: string }>
784
+ }
785
+
786
+ /** POST /director request。 */
787
+ export interface DirectorRequest {
788
+ focus?: string
789
+ }
790
+
791
+ /** 自动导演编排建议(下一卷/阶段编排 + 修复再平衡)。 */
792
+ export interface DirectorAdvice {
793
+ summary: string
794
+ nextArc: string[]
795
+ pacing: string
796
+ risks: string[]
797
+ fixes: string[]
798
+ }
799
+
800
+ /** 自动导演「采纳」后生成的书内待办项。 */
801
+ export interface DirectorTodo {
802
+ id: string
803
+ text: string
804
+ /** 来源:风险 或 修复。 */
805
+ source: 'risk' | 'fix'
806
+ done: boolean
807
+ createdAt: string
808
+ }
809
+
810
+ /** 题材雷达:单条市场信号。 */
811
+ export interface MarketRadarSignal {
812
+ id: string
813
+ kind: 'genre' | 'protagonist' | 'advantage' | 'opening' | 'relationship' | 'title_pattern' | 'opportunity' | 'crowding'
814
+ title: string
815
+ detail: string
816
+ /** 趋势:current / rising / stable / falling。 */
817
+ direction?: 'current' | 'rising' | 'stable' | 'falling'
818
+ /** 是否建议优先考虑。 */
819
+ recommended?: boolean
820
+ }
821
+
822
+ /** 题材雷达:生产底座(引用内置题材/推进模式库,或给出新资产)。 */
823
+ export interface ProductionFoundation {
824
+ genre: { existingId?: string; name: string; description: string; template?: string }
825
+ primaryStoryMode: { existingId?: string; name: string; driver: string; readerExpectation: string }
826
+ secondaryStoryMode?: { existingId?: string; name: string; driver: string; readerExpectation: string }
827
+ }
828
+
829
+ /** 题材雷达:开书创意简报(可执行,严禁照搬具体作品/命名)。 */
830
+ export interface MarketCreativeBrief {
831
+ promptBlock: string
832
+ openingIdea: string
833
+ coreAdvantage: string
834
+ bookSellingPoint: string
835
+ first30ChapterPromise: string
836
+ }
837
+
838
+ /** 题材雷达结果。 */
839
+ export interface MarketRadarResult {
840
+ signals: MarketRadarSignal[]
841
+ productionFoundation: ProductionFoundation
842
+ /** 开书创意简报(可选;用「用信号创作」接口单独生成)。 */
843
+ creativeBrief?: MarketCreativeBrief
844
+ }
845
+
846
+ /** POST /market-radar request。 */
847
+ export interface MarketRadarRequest {
848
+ platform?: string
849
+ genre?: string
850
+ keywords?: string
851
+ feedText?: string
852
+ /** 已扫描的上榜记录(来自真实榜单抓取),用于让分析基于真实榜单证据。 */
853
+ candidates?: Array<{ title: string; author?: string; tags?: string[]; synopsis?: string; category?: string; heatLabel?: string }>
854
+ }
855
+
856
+ /** POST /market-radar/brief request:用选中的信号 + 影响模式生成开书创意。 */
857
+ export interface MarketRadarBriefRequest {
858
+ influenceMode: 'follow_hot' | 'differentiate' | 'light'
859
+ signals: MarketRadarSignal[]
675
860
  }
676
861
 
677
862
  /** A character card from the story bible. */
@@ -746,6 +931,8 @@ export interface AuditResponse {
746
931
  auditedChapters: number
747
932
  /** 质检时间。 */
748
933
  auditedAt: string
934
+ /** 本次质检使用的模型(auditModel 或全局 model)。 */
935
+ model?: string
749
936
  }
750
937
 
751
938
  /** 全书质检的实时状态(通过 /status 暴露给面板/外部读取)。 */
@@ -1302,8 +1489,14 @@ export interface ProjectState {
1302
1489
  assets?: ProjectAssets
1303
1490
  /** 事实库/时间线:每章生成后抽取,注入后续章节保持一致性。 */
1304
1491
  facts?: ChapterFact[]
1492
+ /** 书内知识库文档(可检索资料/设定/参考)。 */
1493
+ knowledgeDocs?: KnowledgeDoc[]
1494
+ /** 自动导演待办:风险/修复「采纳」后生成的随手清单。 */
1495
+ todos?: DirectorTodo[]
1305
1496
  /** 小说简介(面向读者的作品门面,AI 生成或手动保存)。 */
1306
1497
  blurb?: string
1498
+ /** 开书定盘:书籍级承诺与流派定位(前30章承诺/主副模式/文风/平台)。 */
1499
+ bookContract?: BookContract
1307
1500
  /** 封面文件名(相对输出目录,如 cover.png)。 */
1308
1501
  coverPath?: string
1309
1502
  /** 大世界结构化数据(境界体系/区域/势力)。 */
@@ -1489,6 +1682,12 @@ export interface NovelConfig {
1489
1682
  provider: string
1490
1683
  /** LLM model id (e.g. deepseek-v4-flash). */
1491
1684
  model: string
1685
+ /** 生成正文用模型(缺省用 model)。 */
1686
+ generateModel?: string
1687
+ /** 审稿用模型(缺省用 model;建议用更强的 reasoner/pro)。 */
1688
+ reviewModel?: string
1689
+ /** 全书质检(审计)用模型(缺省用 model)。 */
1690
+ auditModel?: string
1492
1691
  /** LLM reasoning effort: off = no thinking; low/high/max = thinking intensity. */
1493
1692
  reasoningEffort: 'off' | 'low' | 'high' | 'max'
1494
1693
  /** 分析类任务(提炼/拆书/反推大纲等)的推理档位;默认 low,不受上面写作档位影响。 */
@@ -1730,6 +1929,9 @@ export interface ConfigPatch {
1730
1929
  outputDir?: string
1731
1930
  provider?: string
1732
1931
  model?: string
1932
+ generateModel?: string
1933
+ reviewModel?: string
1934
+ auditModel?: string
1733
1935
  reasoningEffort?: 'off' | 'low' | 'high' | 'max'
1734
1936
  analysisReasoning?: 'off' | 'low' | 'high' | 'max'
1735
1937
  chapterChars?: number
@@ -1778,6 +1980,8 @@ export type AssistantFrame =
1778
1980
  | { type: 'tool'; name: string; status: 'start' | 'done' | 'error'; detail?: string }
1779
1981
  /** Live output while a tool runs (e.g. chapter text being generated). */
1780
1982
  | { type: 'toolDelta'; name: string; text: string }
1983
+ /** 工具完整结果(供前端渲染成结构化卡片,如拆书/导演)。 */
1984
+ | { type: 'toolResult'; name: string; text: string }
1781
1985
  | { type: 'done' }
1782
1986
  | { type: 'error'; message: string }
1783
1987
 
@@ -1790,16 +1994,22 @@ export interface AssistantHistoryResponse {
1790
1994
 
1791
1995
  /** 题材基底库:一本书属于哪个阅读市场。树形(题材→子题材→下级)。 */
1792
1996
  export interface GenreNode {
1997
+ /** 稳定标识(内置库交叉引用)。 */
1998
+ id?: string
1793
1999
  /** 题材名称(标签,如「仙侠修真」「都市异能」)。 */
1794
2000
  name: string
1795
2001
  /** 题材特征、常见爽点、叙事重心或读者期待。 */
1796
2002
  description: string
2003
+ /** 该题材的写法指引(开书定盘/卷计划用,区别于「读者期待」)。 */
2004
+ template?: string
1797
2005
  /** 子题材。 */
1798
2006
  children: GenreNode[]
1799
2007
  }
1800
2008
 
1801
2009
  /** 推进模式库:读者为什么继续看下一章。 */
1802
2010
  export interface ProgressionMode {
2011
+ /** 稳定标识(与内置库交叉引用)。 */
2012
+ key?: string
1803
2013
  /** 模式名称(如「升级变强」「经营扩张」「解谜揭露」)。 */
1804
2014
  name: string
1805
2015
  /** 核心驱动力:靠什么制造追读动力。 */
@@ -1812,12 +2022,34 @@ export interface ProgressionMode {
1812
2022
  risks: string[]
1813
2023
  /** 主模式或辅助模式。 */
1814
2024
  primary: boolean
2025
+ /** 该模式的写法指引(开书定盘/卷计划用)。 */
2026
+ template?: string
2027
+ /** 推进单位序列(每章如何推进,如「立威→打破质疑→扩大影响→碾压」)。 */
2028
+ progressionUnits?: string[]
2029
+ /** 允许出现的冲突形态。 */
2030
+ allowedConflictForms?: string[]
2031
+ /** 应避免的冲突形态(跑偏信号)。 */
2032
+ forbiddenConflictForms?: string[]
2033
+ /** 冲突烈度上限(low/medium/high),用于卷/章计划和审稿对齐。 */
2034
+ conflictCeiling?: 'low' | 'medium' | 'high'
2035
+ /** 单章推进单位说明。 */
2036
+ chapterUnit?: string
2037
+ /** 卷末应兑现的回报。 */
2038
+ volumeReward?: string
2039
+ /** 主驱动必须持续出现的信号(读者期待确认)。 */
2040
+ mandatorySignals?: string[]
2041
+ /** 反信号:出现即跑偏。 */
2042
+ antiSignals?: string[]
2043
+ /** 优先用的问题解决方式。 */
2044
+ resolutionStyle?: string
1815
2045
  }
1816
2046
 
1817
2047
  /** 反 AI 规则:一条「要避免的问题 + 修正方向」。 */
1818
2048
  export interface AntiAiRule {
1819
2049
  /** 规则名(如「禁止解释型心理描写」「AI 高频套话」)。 */
1820
2050
  name: string
2051
+ /** 稳定标识(与 defaultAntiAiRuleKeys 交叉引用;缺省用 name)。 */
2052
+ key?: string
1821
2053
  /** 要避免的表达问题,具体可检查。 */
1822
2054
  avoid: string
1823
2055
  /** 推荐修正方向。 */
@@ -1826,8 +2058,16 @@ export interface AntiAiRule {
1826
2058
  detectPatterns?: string[]
1827
2059
  /** 是否内置全局规则(内置规则随插件发布,项目规则为用户自定义)。 */
1828
2060
  builtin?: boolean
1829
- /** 规则类型:forbidden=禁止类(命中即问题)/ encourage=鼓励类(不命中不算错,只作建议)。缺省按名称「鼓励」前缀推断。 */
1830
- severity?: 'forbidden' | 'encourage'
2061
+ /** 规则类别:forbidden=禁止类(命中即问题)/ risk=风险类(需注意但不硬伤)/ encourage=鼓励类(不命中不算错,只作建议)。 */
2062
+ severity?: 'forbidden' | 'risk' | 'encourage'
2063
+ /** 问题严重度(用于审稿优先级;缺省按类别推断)。 */
2064
+ riskLevel?: 'low' | 'medium' | 'high'
2065
+ /** 生成时直接注入的约束指令(缺失时回退到 avoid)。 */
2066
+ promptInstruction?: string
2067
+ /** 是否允许自动改写(risk 类通常 false)。 */
2068
+ autoRewrite?: boolean
2069
+ /** 是否为全局基线规则(新书默认启用,防止规则丢失后降级)。 */
2070
+ globalBaselineEnabled?: boolean
1831
2071
  /** 是否启用(缺省 true)。 */
1832
2072
  enabled?: boolean
1833
2073
  /** 作用域(缺省 all)。 */
@@ -1835,6 +2075,43 @@ export interface AntiAiRule {
1835
2075
  }
1836
2076
 
1837
2077
  /** 预置写法模板(来自 AI-Novel-Writing-Assistant 内置数据,一键绑定无需样本文本)。 */
2078
+ export interface StyleTemplateNarrativeRules {
2079
+ progressionMode?: string
2080
+ sceneUnitPattern?: string[]
2081
+ multiPov?: boolean
2082
+ looping?: boolean
2083
+ endingStyle?: string
2084
+ povSwitchStyle?: string
2085
+ summary?: string
2086
+ }
2087
+
2088
+ export interface StyleTemplateCharacterRules {
2089
+ allowSelfReflection?: boolean
2090
+ emotionExpression?: string
2091
+ defenseMechanisms?: string[]
2092
+ facePriority?: boolean
2093
+ dialogueStyle?: string
2094
+ summary?: string
2095
+ }
2096
+
2097
+ export interface StyleTemplateLanguageRules {
2098
+ register?: string
2099
+ roughness?: number
2100
+ allowIncompleteSentences?: boolean
2101
+ allowSwearing?: boolean
2102
+ sentenceVariation?: string
2103
+ allowUselessDetails?: boolean
2104
+ summary?: string
2105
+ }
2106
+
2107
+ export interface StyleTemplateRhythmRules {
2108
+ pace?: string
2109
+ paragraphDensity?: string
2110
+ allowFragmentedFlow?: boolean
2111
+ actionOverExplanation?: boolean
2112
+ summary?: string
2113
+ }
2114
+
1838
2115
  export interface StyleTemplate {
1839
2116
  /** 模板 key(如 power-up-escalation)。 */
1840
2117
  key: string
@@ -1846,18 +2123,42 @@ export interface StyleTemplate {
1846
2123
  category: string
1847
2124
  /** 适用题材。 */
1848
2125
  applicableGenres: string[]
1849
- /** 叙述规则。 */
2126
+ /** 标签(便于筛选)。 */
2127
+ tags?: string[]
2128
+ /** 一句话分析(模板定位说明)。 */
2129
+ analysisMarkdown?: string
2130
+ /** 叙述规则(结构化)。 */
2131
+ narrative?: StyleTemplateNarrativeRules
2132
+ /** 角色规则(结构化)。 */
2133
+ character?: StyleTemplateCharacterRules
2134
+ /** 语言规则(结构化)。 */
2135
+ language?: StyleTemplateLanguageRules
2136
+ /** 节奏规则(结构化)。 */
2137
+ rhythm?: StyleTemplateRhythmRules
2138
+ /** 叙述规则(扁平,兼容旧数据)。 */
1850
2139
  proseRules: string[]
1851
- /** 角色/台词规则。 */
2140
+ /** 角色/台词规则(扁平,兼容旧数据)。 */
1852
2141
  dialogueRules: string[]
1853
- /** 语言规则。 */
2142
+ /** 语言规则(扁平,兼容旧数据)。 */
1854
2143
  languageRules: string[]
1855
- /** 节奏规则。 */
2144
+ /** 节奏规则(扁平,兼容旧数据)。 */
1856
2145
  rhythmRules: string[]
1857
2146
  /** 该模板默认绑定的反 AI 规则 key(内置规则名)。 */
1858
2147
  defaultAntiAiRuleKeys: string[]
1859
2148
  }
1860
2149
 
2150
+ /** 起始风格画像:无样本文本也能快速绑定一套写法(对齐上游 DEFAULT_STARTER_STYLE_PROFILES)。 */
2151
+ export interface StarterStyleProfile {
2152
+ /** stable key(如 starter-power-up)。 */
2153
+ key: string
2154
+ /** 绑定到的写法模板 key。 */
2155
+ templateKey: string
2156
+ /** 画像名。 */
2157
+ name: string
2158
+ /** 画像说明。 */
2159
+ description: string
2160
+ }
2161
+
1861
2162
  /** 剧情桥段库:可复用的情节套路/桥段(作者阅读经验沉淀,与书内 Plotline 不同层)。 */
1862
2163
  export interface PlotBeatTemplate {
1863
2164
  /** 模板 key(如 face-slap / exit-wedding)。 */
@@ -1896,6 +2197,32 @@ export interface StyleAsset {
1896
2197
  boundaries: string[]
1897
2198
  /** 来源样本文本(可空)。 */
1898
2199
  sourceText?: string
2200
+ /** 仿写预设:imitate=高保真仿写 / balanced=平衡 / transfer=迁移(去指纹)。 */
2201
+ preset?: 'imitate' | 'balanced' | 'transfer'
2202
+ /** 指纹风险:仿写时照搬原作独特表达的风险。 */
2203
+ fingerprintRisk?: 'low' | 'medium' | 'high'
2204
+ /** 净化后的写作指引(可安全用于生成,去掉了会暴露来源的具体细节)。 */
2205
+ writingGuidance?: string[]
2206
+ /** 禁止照搬的原作特有实体(人名/地名/核心设定句式),生成时需避开。 */
2207
+ forbiddenEntities?: string[]
2208
+ /** 创建时间。 */
2209
+ createdAt: string
2210
+ }
2211
+
2212
+ /** 写作公式(从样本文本分层提取的"这套文怎么写"浓缩,供生成/改写复用)。 */
2213
+ export interface StyleFormula {
2214
+ /** 稳定 key。 */
2215
+ key: string
2216
+ /** 公式名。 */
2217
+ name: string
2218
+ /** 提取深度:basic=骨架 / standard=完整 / deep=逐句细化。 */
2219
+ depth: 'basic' | 'standard' | 'deep'
2220
+ /** 重点聚焦域(如 开场/对话/节奏/爽点密度)。 */
2221
+ focusAreas: string[]
2222
+ /** 公式正文(Markdown)。 */
2223
+ formula: string
2224
+ /** 应用指引(生成/改写时如何套用)。 */
2225
+ applyGuidance: string
1899
2226
  /** 创建时间。 */
1900
2227
  createdAt: string
1901
2228
  }
@@ -1912,6 +2239,8 @@ export interface ProjectAssets {
1912
2239
  antiAiRules: AntiAiRule[]
1913
2240
  /** 绑定的写法资产。 */
1914
2241
  styleAssets: StyleAsset[]
2242
+ /** 写作公式(分层提取:basic/standard/deep)。 */
2243
+ styleFormulas?: StyleFormula[]
1915
2244
  /** 资产更新时间。 */
1916
2245
  updatedAt?: string
1917
2246
  }
@@ -1927,6 +2256,8 @@ export interface AssetsResponse {
1927
2256
  styleTemplates: StyleTemplate[]
1928
2257
  /** 内置推进模式候选。 */
1929
2258
  progressionLibrary: ProgressionMode[]
2259
+ /** 起始风格画像(无样本文本快速绑定写法)。 */
2260
+ starterStyleProfiles: StarterStyleProfile[]
1930
2261
  /** 内置剧情桥段库(可复用套路)。 */
1931
2262
  plotBeatLibrary: PlotBeatTemplate[]
1932
2263
  }
@@ -1938,6 +2269,7 @@ export interface AssetsPatch {
1938
2269
  auxiliaryProgressions?: ProgressionMode[]
1939
2270
  antiAiRules?: AntiAiRule[]
1940
2271
  styleAssets?: StyleAsset[]
2272
+ styleFormulas?: StyleFormula[]
1941
2273
  }
1942
2274
 
1943
2275
  /** POST /style-engine request:从样本文本提取写法资产。 */
@@ -2012,8 +2344,8 @@ export interface AdaptationDimension {
2012
2344
  current: string
2013
2345
  /** 该值在正文中的出现证据(章节/频次,可空)。 */
2014
2346
  evidence?: string
2015
- /** AI 建议的候选新值(可空)。 */
2016
- candidates?: string[]
2347
+ /** AI 建议的候选新值(可空,每套含名称与一句话说明)。 */
2348
+ candidates?: Array<{ name: string; desc?: string }>
2017
2349
  /** 联动影响说明(改了会影响哪些章节/角色/伏笔/术语)。 */
2018
2350
  impact: string
2019
2351
  /** 风险评级。 */