@waterwx/dsh-novel-forge 0.1.0 → 1.0.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 (180) hide show
  1. package/README.md +162 -111
  2. package/cordis.patch.yml +1 -1
  3. package/lib/client.js +54165 -2666
  4. package/lib/index.js +11895 -2211
  5. package/lib/types/ai-scan.d.ts +36 -0
  6. package/lib/types/assets.d.ts +19 -4
  7. package/lib/types/assistant.d.ts +6 -0
  8. package/lib/types/author-assets.d.ts +25 -0
  9. package/lib/types/bookshelf.d.ts +8 -1
  10. package/lib/types/client/api.d.ts +235 -3
  11. package/lib/types/client/index.d.ts +1 -1
  12. package/lib/types/client/llmLive.d.ts +33 -0
  13. package/lib/types/client/locales.d.ts +101 -28
  14. package/lib/types/client/panel/AdaptModeView.d.ts +5 -0
  15. package/lib/types/client/panel/AssetsTab.d.ts +6 -1
  16. package/lib/types/client/panel/AuthorAssetsView.d.ts +4 -0
  17. package/lib/types/client/panel/AuthorHome.d.ts +34 -0
  18. package/lib/types/client/panel/BookAnalysisView.d.ts +4 -0
  19. package/lib/types/client/panel/CreateBookView.d.ts +13 -0
  20. package/lib/types/client/panel/DirectorView.d.ts +7 -0
  21. package/lib/types/client/panel/FlowGuide.d.ts +22 -0
  22. package/lib/types/client/panel/GlobalAssetLibraryView.d.ts +4 -0
  23. package/lib/types/client/panel/IdeaInspirationView.d.ts +6 -0
  24. package/lib/types/client/panel/ImportModal.d.ts +7 -0
  25. package/lib/types/client/panel/KnowledgeBaseView.d.ts +4 -0
  26. package/lib/types/client/panel/LiveFeedLog.d.ts +5 -0
  27. package/lib/types/client/panel/MangaRoleLibrary.d.ts +20 -0
  28. package/lib/types/client/panel/MangaWorkspace.d.ts +12 -0
  29. package/lib/types/client/panel/MarketRadarView.d.ts +5 -0
  30. package/lib/types/client/panel/ModelManager.d.ts +14 -0
  31. package/lib/types/client/panel/ModelPicker.d.ts +11 -0
  32. package/lib/types/client/panel/NovelPanel.d.ts +1 -1
  33. package/lib/types/client/panel/ProgressConsole.d.ts +17 -0
  34. package/lib/types/client/panel/ProgressHomeView.d.ts +5 -0
  35. package/lib/types/client/panel/PropLibrary.d.ts +8 -0
  36. package/lib/types/client/panel/ReaderView.d.ts +8 -0
  37. package/lib/types/client/panel/ReasoningSection.d.ts +10 -0
  38. package/lib/types/client/panel/RunPanel.d.ts +5 -0
  39. package/lib/types/client/panel/SceneLibrary.d.ts +16 -0
  40. package/lib/types/client/panel/SettingsView.d.ts +16 -0
  41. package/lib/types/client/panel/ShelfView.d.ts +15 -0
  42. package/lib/types/client/panel/StoryboardTab.d.ts +19 -0
  43. package/lib/types/client/panel/StyleCard.d.ts +8 -0
  44. package/lib/types/client/panel/StyleGallery.d.ts +1 -0
  45. package/lib/types/client/panel/WorldTab.d.ts +10 -0
  46. package/lib/types/client/panel/helpers.d.ts +10 -0
  47. package/lib/types/client/panel/views.d.ts +77 -0
  48. package/lib/types/client/run-status.d.ts +19 -0
  49. package/lib/types/client/text.d.ts +9 -0
  50. package/lib/types/comic-presets.d.ts +12 -0
  51. package/lib/types/engine.d.ts +250 -8
  52. package/lib/types/global-assets.d.ts +6 -0
  53. package/lib/types/index.d.ts +24 -2
  54. package/lib/types/llm-live.d.ts +44 -0
  55. package/lib/types/manga-genre-rules.d.ts +22 -0
  56. package/lib/types/market-radar-scan.d.ts +19 -0
  57. package/lib/types/market-radar-sources.d.ts +31 -0
  58. package/lib/types/novel-context.d.ts +80 -0
  59. package/lib/types/prompt-utils.d.ts +35 -0
  60. package/lib/types/prompting.d.ts +35 -0
  61. package/lib/types/protocol.d.ts +1453 -5
  62. package/lib/types/review-policy.d.ts +97 -0
  63. package/lib/types/run.d.ts +32 -0
  64. package/lib/types/shot-language.d.ts +46 -0
  65. package/lib/types/src/ai-scan.d.ts +36 -0
  66. package/lib/types/src/assets.d.ts +37 -0
  67. package/lib/types/src/assistant.d.ts +45 -0
  68. package/lib/types/src/author-assets.d.ts +25 -0
  69. package/lib/types/src/bookshelf.d.ts +42 -0
  70. package/lib/types/src/client/api.d.ts +234 -0
  71. package/lib/types/src/client/docx.d.ts +15 -0
  72. package/lib/types/src/client/index.d.ts +14 -0
  73. package/lib/types/src/client/locales.d.ts +212 -0
  74. package/lib/types/src/client/mount.d.ts +9 -0
  75. package/lib/types/src/client/panel/AdaptModeView.d.ts +5 -0
  76. package/lib/types/src/client/panel/AssetsTab.d.ts +12 -0
  77. package/lib/types/src/client/panel/AssistantTab.d.ts +7 -0
  78. package/lib/types/src/client/panel/AuthorAssetsView.d.ts +4 -0
  79. package/lib/types/src/client/panel/AuthorHome.d.ts +32 -0
  80. package/lib/types/src/client/panel/BookshelfBar.d.ts +11 -0
  81. package/lib/types/src/client/panel/CreateBookView.d.ts +9 -0
  82. package/lib/types/src/client/panel/FlowGuide.d.ts +22 -0
  83. package/lib/types/src/client/panel/GlobalAssetLibraryView.d.ts +4 -0
  84. package/lib/types/src/client/panel/ImportModal.d.ts +7 -0
  85. package/lib/types/src/client/panel/MangaRoleLibrary.d.ts +20 -0
  86. package/lib/types/src/client/panel/MangaWorkspace.d.ts +12 -0
  87. package/lib/types/src/client/panel/ModelManager.d.ts +14 -0
  88. package/lib/types/src/client/panel/NovelPanel.d.ts +13 -0
  89. package/lib/types/src/client/panel/ProgressConsole.d.ts +17 -0
  90. package/lib/types/src/client/panel/ProgressHomeView.d.ts +5 -0
  91. package/lib/types/src/client/panel/PropLibrary.d.ts +8 -0
  92. package/lib/types/src/client/panel/ReaderView.d.ts +8 -0
  93. package/lib/types/src/client/panel/ReasoningSection.d.ts +10 -0
  94. package/lib/types/src/client/panel/RunPanel.d.ts +5 -0
  95. package/lib/types/src/client/panel/SceneLibrary.d.ts +16 -0
  96. package/lib/types/src/client/panel/SettingsView.d.ts +16 -0
  97. package/lib/types/src/client/panel/ShelfView.d.ts +15 -0
  98. package/lib/types/src/client/panel/StoryboardTab.d.ts +19 -0
  99. package/lib/types/src/client/panel/StyleCard.d.ts +8 -0
  100. package/lib/types/src/client/panel/StyleGallery.d.ts +1 -0
  101. package/lib/types/src/client/panel/WorldTab.d.ts +10 -0
  102. package/lib/types/src/client/panel/controller.d.ts +19 -0
  103. package/lib/types/src/client/panel/helpers.d.ts +18 -0
  104. package/lib/types/src/client/panel/views.d.ts +77 -0
  105. package/lib/types/src/client/sidebar-entry.d.ts +13 -0
  106. package/lib/types/src/client/text.d.ts +9 -0
  107. package/lib/types/src/comic-presets.d.ts +12 -0
  108. package/lib/types/src/docx.d.ts +19 -0
  109. package/lib/types/src/engine.d.ts +402 -0
  110. package/lib/types/src/index.d.ts +79 -0
  111. package/lib/types/src/manga-genre-rules.d.ts +22 -0
  112. package/lib/types/src/novel-context.d.ts +80 -0
  113. package/lib/types/src/prompt-utils.d.ts +35 -0
  114. package/lib/types/src/protocol.d.ts +2176 -0
  115. package/lib/types/src/review-policy.d.ts +97 -0
  116. package/lib/types/src/routes.d.ts +29 -0
  117. package/lib/types/src/run.d.ts +32 -0
  118. package/lib/types/src/shot-language.d.ts +46 -0
  119. package/lib/types/src/story-beat-language.d.ts +35 -0
  120. package/lib/types/src/style-library.d.ts +33 -0
  121. package/lib/types/story-beat-language.d.ts +35 -0
  122. package/lib/types/style-library.d.ts +33 -0
  123. package/package.json +57 -42
  124. package/scripts/patch-schemastery.mjs +47 -0
  125. package/src/ai-scan.ts +179 -0
  126. package/src/assets.ts +1774 -518
  127. package/src/assistant.ts +915 -547
  128. package/src/author-assets.ts +147 -0
  129. package/src/bookshelf.ts +32 -2
  130. package/src/client/api.ts +666 -254
  131. package/src/client/index.ts +3 -1
  132. package/src/client/llmLive.ts +101 -0
  133. package/src/client/locales.ts +178 -31
  134. package/src/client/mount.tsx +1 -1
  135. package/src/client/panel/AdaptModeView.tsx +535 -0
  136. package/src/client/panel/AssetsTab.tsx +168 -51
  137. package/src/client/panel/AssistantTab.tsx +339 -188
  138. package/src/client/panel/AuthorAssetsView.tsx +208 -0
  139. package/src/client/panel/AuthorHome.tsx +234 -0
  140. package/src/client/panel/BookAnalysisView.tsx +60 -0
  141. package/src/client/panel/BookshelfBar.tsx +63 -9
  142. package/src/client/panel/CreateBookView.tsx +371 -0
  143. package/src/client/panel/DirectorView.tsx +200 -0
  144. package/src/client/panel/GlobalAssetLibraryView.tsx +172 -0
  145. package/src/client/panel/IdeaInspirationView.tsx +71 -0
  146. package/src/client/panel/ImportModal.tsx +303 -0
  147. package/src/client/panel/KnowledgeBaseView.tsx +73 -0
  148. package/src/client/panel/LiveFeedLog.tsx +67 -0
  149. package/src/client/panel/MarketRadarView.tsx +374 -0
  150. package/src/client/panel/ModelManager.tsx +205 -0
  151. package/src/client/panel/NovelPanel.tsx +4713 -990
  152. package/src/client/panel/ProgressConsole.tsx +63 -0
  153. package/src/client/panel/ProgressHomeView.tsx +87 -0
  154. package/src/client/panel/ReaderView.tsx +306 -0
  155. package/src/client/panel/ReasoningSection.tsx +31 -0
  156. package/src/client/panel/RunPanel.tsx +204 -0
  157. package/src/client/panel/SettingsView.tsx +265 -0
  158. package/src/client/panel/ShelfView.tsx +242 -0
  159. package/src/client/panel/WorldTab.tsx +202 -0
  160. package/src/client/panel/helpers.ts +50 -0
  161. package/src/client/panel/panel.module.css +4325 -526
  162. package/src/client/panel/views.tsx +346 -0
  163. package/src/client/run-status.ts +100 -0
  164. package/src/client/sidebar-entry.ts +1 -1
  165. package/src/client/text.ts +28 -0
  166. package/src/engine.ts +4230 -1019
  167. package/src/global-assets.ts +59 -0
  168. package/src/index.ts +123 -9
  169. package/src/llm-live.ts +68 -0
  170. package/src/market-radar-scan.ts +41 -0
  171. package/src/market-radar-sources.ts +173 -0
  172. package/src/novel-context.ts +287 -0
  173. package/src/prompt-utils.ts +73 -0
  174. package/src/prompting.ts +159 -0
  175. package/src/protocol.ts +1998 -539
  176. package/src/review-policy.ts +161 -0
  177. package/src/routes.ts +3277 -955
  178. package/src/run.ts +338 -0
  179. package/lib/client.js.map +0 -1
  180. package/lib/index.js.map +0 -1
@@ -0,0 +1,77 @@
1
+ /**
2
+ * 纯展示组件(views):所有状态与事件处理器都留在 NovelPanel,
3
+ * 这里只接收 props 渲染。便于单独维护与复用。
4
+ */
5
+ import type { ReactElement } from 'react';
6
+ import type { AuditIssue, Plotline, PlotlineHealthReport, PlotlinePlan, RoleRecord, RoleStatusCard } from '../../protocol.ts';
7
+ /** 统计格:状态摘要条 / 资产健康通用。 */
8
+ export declare function StatCell(props: {
9
+ label: string;
10
+ value: string;
11
+ detail: string;
12
+ /** 值颜色(可选)。 */
13
+ valueColor?: string;
14
+ /** 值字号覆盖(如长文本用 13)。 */
15
+ valueFontSize?: number;
16
+ /** detail 悬浮提示(可选)。 */
17
+ detailTitle?: string;
18
+ }): ReactElement;
19
+ /** 待办队列行。 */
20
+ export declare function TodoRow(props: {
21
+ tone: 'danger' | 'warning' | 'info' | 'success';
22
+ title: string;
23
+ description: string;
24
+ actionLabel: string;
25
+ disabled: boolean;
26
+ onAction: () => void;
27
+ }): ReactElement;
28
+ /** 全书质检问题行。 */
29
+ export declare function AuditIssueRow(props: {
30
+ issue: AuditIssue;
31
+ disabled: boolean;
32
+ onFix: () => void;
33
+ }): ReactElement;
34
+ /** 剧情线卡片(列表主体)。 */
35
+ export declare function PlotlineCard(props: {
36
+ line: Plotline;
37
+ disabled: boolean;
38
+ onRefresh: () => void;
39
+ onEdit: () => void;
40
+ onRemove: () => void;
41
+ }): ReactElement;
42
+ /** AI 候选角色行(提炼结果,可采纳/修改后采纳)。 */
43
+ export declare function RoleCandidateRow(props: {
44
+ candidate: RoleRecord;
45
+ disabled: boolean;
46
+ onAdopt: () => void;
47
+ onEdit: () => void;
48
+ }): ReactElement;
49
+ /** 已收录角色卡(含从编年录刷新的当前状态行)。 */
50
+ export declare function RoleCard(props: {
51
+ role: RoleRecord;
52
+ status?: RoleStatusCard;
53
+ disabled: boolean;
54
+ onEdit: () => void;
55
+ onRemove: () => void;
56
+ }): ReactElement;
57
+ /** 🩺 剧情健康检查报告面板。 */
58
+ export declare function PlotlineHealthPanel(props: {
59
+ report: PlotlineHealthReport;
60
+ disabled: boolean;
61
+ onPlan: () => void;
62
+ onClose: () => void;
63
+ }): ReactElement;
64
+ /** ✨ AI 剧情方案面板。 */
65
+ export declare function PlotlinePlanPanel(props: {
66
+ plan: PlotlinePlan;
67
+ disabled: boolean;
68
+ onAdopt: (suggestion: Plotline) => void;
69
+ onClose: () => void;
70
+ }): ReactElement;
71
+ /** ✨ AI 建议剧情线面板。 */
72
+ export declare function PlotlineSuggestionPanel(props: {
73
+ suggestions: Plotline[];
74
+ disabled: boolean;
75
+ onAdopt: (suggestion: Plotline) => void;
76
+ onClose: () => void;
77
+ }): ReactElement;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 运行状态芯片:固定在页面顶部的「小说工坊生成状态」小徽标。
3
+ * 轮询 /run/status,实时显示 生成中/暂停/完成/停止/出错 + 当前章号;
4
+ * 点击可打开/关闭小说工坊面板。独立 DOM 注入,不触碰主面板逻辑,挂载失败静默降级。
5
+ *
6
+ * P0 重写说明(原实现的三个问题):
7
+ * 1. 整块背景染状态色 + 固定白字 → 浅色主题下「白字配亮底」对比度崩坏。
8
+ * 现在改为「玻璃底 + 主题前景色文字 + 左侧状态色点」,状态只由色点承载,
9
+ * 文字永远跟随主题,任何深浅色下都可读。
10
+ * 2. 样式写死在 JS 的 inline style 里,切主题纹丝不动。
11
+ * 现在改用 CSS Module class,配色走 --nf-chip-* 令牌,
12
+ * 由 body[data-ds-dark-theme] 跟随宿主深浅色。
13
+ * 3. role="button" 却没有 tabindex、没有键盘处理,键盘用户完全用不了。
14
+ * 现在补 tabindex + Enter/Space 激活 + aria-label/live。
15
+ */
16
+ import type { NovelApi } from './api.ts';
17
+ import type { PanelController } from './panel/controller.ts';
18
+ /** 生成一个固定顶部的状态芯片并开始轮询。返回 dispose。 */
19
+ export declare function mountRunStatus(controller: PanelController, api: NovelApi): () => void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 客户端文件文本智能解码:兼容 UTF-8 BOM / UTF-16 / UTF-8 / GB18030(GBK)。
3
+ * 浏览器 File.text() 固定按 UTF-8 解码,GBK 中文网文 txt 会乱码,这里兜底。
4
+ */
5
+ /**
6
+ * 读取一个 File 的文本,按编码探测兜底解码。
7
+ * @returns 解码后的文本。
8
+ */
9
+ export declare function readFileTextSmart(file: File): Promise<string>;
@@ -0,0 +1,12 @@
1
+ /** 漫画风格预设:每个预设对应一组出图提示词与排版偏好。 */
2
+ export interface ComicStylePreset {
3
+ id: string;
4
+ label: string;
5
+ /** 注入 imagePrompt 的风格描述词。 */
6
+ prompt: string;
7
+ /** 可选:排版偏好说明。 */
8
+ layoutHint?: string;
9
+ }
10
+ export declare const COMIC_STYLE_PRESETS: ComicStylePreset[];
11
+ export declare function getComicStylePrompt(styleId?: string): string;
12
+ export declare function getComicStyleLabel(styleId?: string): string;
@@ -5,8 +5,14 @@
5
5
  * tracking, project persistence, and whole-book export. Pure Node (no
6
6
  * web-server dependencies), so routes stay thin and logic is testable.
7
7
  */
8
+ /**
9
+ * 内容合规红线(平台硬性要求):所有书籍、所有章节无条件生效,
10
+ * 优先级高于单书大纲/道藏中的任何设定与作者自定义红线。
11
+ * 注入点:章节生成系统提示 + 审稿系统提示(命中即 high)。
12
+ */
13
+ export declare const COMPLIANCE_REDLINES: ReadonlyArray<string>;
8
14
  import type { Context } from '@deepseek-ai/cordis';
9
- import type { ChapterPlan, Foreshadow, NovelConfig, ProjectState, ReviewReport, StoryBible, Volume } from './protocol.ts';
15
+ import type { AdaptationDimension, AdaptAnalyzeResponse, AdaptationMapping, AdaptationRules, AdaptProposeResponse, AuditIssue, AuthorReview, BreakdownResponse, ChapterPlan, Foreshadow, NovelConfig, OutlineCandidate, Plotline, PlotlineHealthReport, PlotlinePlan, ProjectState, ReviewReport, RoleRecord, RoleStatusCard, StoryBible, AddModelRequest, AddModelResponse, LlmModelsResponse, LlmVendorsResponse, LlmProvidersResponse, RemoveProviderRequest, RemoveProviderResponse, LlmTestResponse, Volume, WorldState, AdaptMaterializeRequest, AdaptMaterializeResponse, AdaptMaterializeSaveRequest, AdaptMaterializeSaveResponse, MarketRadarRequest, MarketRadarResult, MarketRadarSignal, MarketRadarBriefRequest, ProductionFoundation, MarketCreativeBrief, BookAnalysisRequest, BookAnalysisResult, IdeaInspirationRequest, IdeaInspirationResult, DirectorRequest, DirectorAdvice } from './protocol.ts';
10
16
  /** Project state file name inside the output dir. */
11
17
  export declare const PROJECT_FILE = "novel-project.json";
12
18
  /** Chapter output file name, e.g. 第001章_开篇.md */
@@ -17,6 +23,19 @@ export declare function inferBookName(outline: string): string;
17
23
  export declare function loadProject(outputDir: string): ProjectState | undefined;
18
24
  /** Persist the project state next to the chapters. */
19
25
  export declare function saveProject(outputDir: string, project: ProjectState): void;
26
+ /**
27
+ * 并发保护:长任务(章节计划生成/正文生成)在内存中持有旧快照,
28
+ * 期间其他请求可能修改了「易变字段」(道藏/角色库/剧情线/人物志存档/简介/封面)。
29
+ * 保存前用磁盘最新版本合并这些字段,避免旧快照覆盖新修改(曾导致角色卡丢失)。
30
+ * 注意:调用方若自己修改了这些字段,不要使用本函数。
31
+ */
32
+ export declare function mergeVolatileFromDisk(outputDir: string, project: ProjectState): void;
33
+ /** 对一段文本做违禁词硬匹配,返回命中(词/类别/次数)。 */
34
+ export declare function checkSensitiveText(text: string): Array<{
35
+ word: string;
36
+ category: string;
37
+ count: number;
38
+ }>;
20
39
  /** List generated chapter files in the output dir (sorted). */
21
40
  export declare function listChapterFiles(outputDir: string): string[];
22
41
  /** Re-sync chapter status against files on disk (a file may exist without state). */
@@ -26,15 +45,87 @@ export declare function readChapterFile(outputDir: string, chapter: ChapterPlan)
26
45
  /** Create a fresh project from an outline. */
27
46
  export declare function createProject(outline: string, outlinePath?: string): ProjectState;
28
47
  /** Extract the story bible from an outline. */
29
- export declare function extractBible(ctx: Context, config: NovelConfig, outline: string): Promise<StoryBible>;
48
+ export declare function extractBible(ctx: Context, config: NovelConfig, outline: string, project?: ProjectState): Promise<StoryBible>;
30
49
  /** Plan volumes from an outline. */
31
50
  export declare function planVolumes(ctx: Context, config: NovelConfig, outline: string): Promise<Volume[]>;
32
51
  /**
33
52
  * Plan chapters from an outline (optionally for one volume).
34
53
  */
35
- export declare function planChapters(ctx: Context, config: NovelConfig, project: ProjectState, chapterCount: number, volumeNo?: number): Promise<ChapterPlan[]>;
54
+ export declare function planChapters(ctx: Context, config: NovelConfig, project: ProjectState, chapterCount: number, volumeNo?: number, outputDir?: string): Promise<ChapterPlan[]>;
36
55
  /** Run the AI review on one chapter. */
37
56
  export declare function reviewChapter(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<ReviewReport>;
57
+ /**
58
+ * 审查「任意正文文本」(作者手动编辑后的草稿,不落盘)。
59
+ * 复用审稿提示词与红线/道藏/反AI规则;仅返回报告,不改文件不改状态。
60
+ */
61
+ export declare function reviewChapterText(ctx: Context, config: NovelConfig, project: ProjectState, text: string, previousReport?: ReviewReport): Promise<ReviewReport>;
62
+ /** 作者复盘:对一章做叙事结构复盘(钩子兑现/结尾钩子/推进/连续性/趋势)。 */
63
+ export declare function authorReviewChapter(ctx: Context, config: NovelConfig, project: ProjectState, chapterNo: number, body: string, prevTail: string): Promise<AuthorReview>;
64
+ /** 复盘后自动关联:把本章号写入复盘标记推进的剧情线(按名称匹配,去重)。 */
65
+ export declare function autoLinkPlotlines(project: ProjectState, chapterNo: number, advancedLines: string[]): void;
66
+ /** AI 建议剧情线:基于大纲/卷计划/已写章节/编年录,提炼候选线。 */
67
+ export declare function suggestPlotlines(ctx: Context, config: NovelConfig, project: ProjectState): Promise<Plotline[]>;
68
+ /** AI 刷新单条剧情线的进度:结合编年录与各章摘要分析该线推进到哪。 */
69
+ export declare function refreshPlotlineProgress(ctx: Context, config: NovelConfig, project: ProjectState, line: Plotline): Promise<string>;
70
+ /** ✨ AI 从全书提炼角色库:大纲 + 道藏 + 编年录 + 章节摘要 → 结构化角色清单。 */
71
+ export declare function extractRoles(ctx: Context, config: NovelConfig, project: ProjectState): Promise<RoleRecord[]>;
72
+ /** ✨ AI 从全书提炼场景库:正文/编年录 → 高频重要场景的结构化视觉锚点。 */
73
+ export declare function splitBookText(raw: string): Array<{
74
+ no: number;
75
+ title: string;
76
+ body: string;
77
+ }>;
78
+ /** 拆章预览(不落盘):章节编号/标题/字数 + 跳过清单。 */
79
+ export declare function previewBookText(raw: string): {
80
+ chapters: Array<{
81
+ no: number;
82
+ title: string;
83
+ chars: number;
84
+ }>;
85
+ skipped: string[];
86
+ };
87
+ /** 从全本文本导入(浏览器上传 / 服务器文件共用):建项目、写章节文件、保存。 */
88
+ export declare function importBookTextFromText(raw: string, outputDir: string, bookName: string): {
89
+ bookName: string;
90
+ chapters: number;
91
+ skipped: string[];
92
+ };
93
+ /** 从 txt/md 全本文件导入:编码自适应读取后拆章建项目,status=written(待审稿)。 */
94
+ export declare function importBookText(filePath: string, outputDir: string): {
95
+ bookName: string;
96
+ chapters: number;
97
+ skipped: string[];
98
+ };
99
+ /** 保证风格词块已内嵌(LLM 偶发漏嵌时兜底):zh 段首前缀,en 末尾追加。 */
100
+ export declare function suggestOutlines(ctx: Context, config: NovelConfig, idea: string, count?: number, exclude?: string[]): Promise<OutlineCandidate[]>;
101
+ /** 拆书分析:对已写章节做结构/人物/文风/卖点四维体检。
102
+ * 两阶段管道(借鉴 AI-Novel-Writing-Assistant):
103
+ * ① 源片段笔记:每章抽取结构化笔记(剧情/人物/设定/写法/卖点/短板信号)
104
+ * ② 分节分析:按维度各跑一次 LLM,输出可读分析稿 + 结构化数据 + 证据链。
105
+ * @param scope 'recent'(默认最近20章) | 'volume:N' | 'all'
106
+ * @param preset 'quick'(总览/剧情/人物/文风) | 'standard'(+卖点)
107
+ * @param budgetTokens token 预算上限(超过即截断章节取样)。
108
+ */
109
+ export declare function breakdownBook(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, scope?: string, preset?: 'quick' | 'standard', budgetTokens?: number): Promise<BreakdownResponse>;
110
+ /** 对选中的提供商/模型发一次最小真实调用(maxTokens=16),验证 Key / 端点 / 模型可用。 */
111
+ export declare function testLlmModel(ctx: Context, provider: string, model: string): Promise<LlmTestResponse>;
112
+ /** 运行时厂商目录:DSH pi-ai 可配置提供方 + 内置适配器,作为「添加模型」下拉。 */
113
+ export declare function listLlmVendors(ctx: Context): Promise<LlmVendorsResponse>;
114
+ /** 查询某个 provider 当前可用模型(添加成功后可即时刷新下拉)。 */
115
+ export declare function listLlmModels(ctx: Context, provider: string): Promise<LlmModelsResponse>;
116
+ /** 当前已注册的提供方路由列表(提供方管理卡片)。 */
117
+ export declare function listLlmProviders(ctx: Context): Promise<LlmProvidersResponse>;
118
+ /** 移除一个提供方:unset 凭据 ref + 移除 llm-pi-ai providers 路由。 */
119
+ export declare function removeLlmProvider(ctx: Context, req: RemoveProviderRequest): Promise<RemoveProviderResponse>;
120
+ /**
121
+ * 添加模型(DSH 同款体验):厂商直填 API Key,或自定义 OpenAI 兼容路由。
122
+ * 写入 DSH 凭据 refs,并(必要时)注册/更新 llm-pi-ai provider 路由。
123
+ */
124
+ export declare function registerLlmModel(ctx: Context, req: AddModelRequest): Promise<AddModelResponse>;
125
+ /** 🩺 剧情健康检查:基于已写章节数/各线状态/编年录,判断是否需要新线及添加时机。 */
126
+ export declare function analyzePlotlineHealth(ctx: Context, config: NovelConfig, project: ProjectState): Promise<PlotlineHealthReport>;
127
+ /** ✨ AI 剧情方案:基于健康检查结果设计下一阶段方向与建议新线。 */
128
+ export declare function designPlotlinePlan(ctx: Context, config: NovelConfig, project: ProjectState, health?: PlotlineHealthReport): Promise<PlotlinePlan>;
38
129
  /**
39
130
  * Stream a chapter rewrite. With `target` (a passage of the body), only that
40
131
  * passage's paragraph is rewritten and spliced back — everything else stays
@@ -47,20 +138,21 @@ export declare function rewriteChapterStream(ctx: Context, config: NovelConfig,
47
138
  frame: 'delta';
48
139
  text: string;
49
140
  } | {
50
- frame: 'done';
51
- file: string;
141
+ frame: 'drafted';
52
142
  chars: number;
143
+ draft: string;
53
144
  }, void, unknown>;
54
- /** Stream a chapter polish (de-AI-ify). */
145
+ /** Stream a chapter polish (de-AI-ify). Draft-mode: the polished body lands
146
+ * in `chapter.pendingDraft` and is only applied on draft/apply. */
55
147
  export declare function polishChapterStream(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): AsyncGenerator<{
56
148
  frame: 'start';
57
149
  } | {
58
150
  frame: 'delta';
59
151
  text: string;
60
152
  } | {
61
- frame: 'done';
62
- file: string;
153
+ frame: 'drafted';
63
154
  chars: number;
155
+ draft: string;
64
156
  }, void, unknown>;
65
157
  /** Generate one chapter (streaming). Yields progress frames; persists when done. */
66
158
  export declare function generateChapterStream(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): AsyncGenerator<{
@@ -72,9 +164,131 @@ export declare function generateChapterStream(ctx: Context, config: NovelConfig,
72
164
  frame: 'done';
73
165
  file: string;
74
166
  chars: number;
167
+ warn?: string;
75
168
  }, void, unknown>;
76
169
  /** Generate a chapter summary (narrative memory). */
77
170
  export declare function summarizeChapter(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<string>;
171
+ /**
172
+ * 反向推大纲:从已写章节正文反推出全书总纲(分卷 + 章节要点 + 主线/人物弧线/伏笔清单)。
173
+ * 两阶段:分批提取章节事件摘要 → 汇总生成大纲。不修改章节/设定,只返回大纲文本。
174
+ */
175
+ export declare function reverseOutlineFromChapters(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, onProgress?: (done: number, total: number, phase: string) => void): Promise<string>;
176
+ /**
177
+ * 改编模式 P0:全文分析 → 原文设定卡片 / 可改范围矩阵。
178
+ * 拆章统计 + 取样正文,让 LLM 一次输出结构化 JSON:
179
+ * { bookName, outline, dimensions: [{key,title,mutability,current,evidence,candidates,impact,risk}] }。
180
+ */
181
+ export declare function analyzeAdaptation(ctx: Context, config: NovelConfig, text: string): Promise<AdaptAnalyzeResponse>;
182
+ /** 改编方案:由用户勾选的维度与新值,生成 LLM 映射表/规则/影响清单。 */
183
+ export declare function proposeAdaptation(ctx: Context, config: NovelConfig, text: string, selections: Array<{
184
+ key: string;
185
+ title: string;
186
+ current: string;
187
+ target: string;
188
+ mutability: string;
189
+ }>, dimensions?: AdaptationDimension[]): Promise<AdaptProposeResponse>;
190
+ /** 剧本术语替换执行:按映射表做精确替换并统计命中。 */
191
+ export declare function applyAdaptationReplacements(text: string, mappings: AdaptationMapping[]): {
192
+ adaptedText: string;
193
+ hits: Array<{
194
+ source: string;
195
+ target: string;
196
+ count: number;
197
+ }>;
198
+ };
199
+ /** 改编模式 rewrite:逐章 LLM 重写(结构性改写,不只是换词)。
200
+ * @returns 改写后的全文 + 逐章结果 + 保留原章的章号。 */
201
+ export declare function rewriteAdaptationBook(ctx: Context, config: NovelConfig, text: string, mappings: AdaptationMapping[], rules?: AdaptationRules, options?: {
202
+ maxChapters?: number;
203
+ startNo?: number;
204
+ endNo?: number;
205
+ onProgress?: (info: {
206
+ completed: number;
207
+ total: number;
208
+ no: number;
209
+ title: string;
210
+ }) => void;
211
+ }): Promise<{
212
+ adaptedText: string;
213
+ rewritten: Array<{
214
+ no: number;
215
+ title: string;
216
+ chars: number;
217
+ }>;
218
+ skipped: number[];
219
+ hits: Array<{
220
+ source: string;
221
+ target: string;
222
+ count: number;
223
+ }>;
224
+ }>;
225
+ /**
226
+ * 改编模式 P3:从源全文 + 用户编辑后的改编方案,提炼新书资料并保存为「待写新书」。
227
+ * 流程:源文导入临时项目 → 复用 extractBible/extractRoles/extractWorld 提炼 →
228
+ * 按映射表把术语/人名/势力映射到新书命名层 → planVolumes/planChapters 生成待写计划 → 保存。
229
+ * @returns 提炼后的新书资料(不含书架 book,由路由负责登记书架)。
230
+ */
231
+ export declare function materializeAdaptedBook(ctx: Context, config: NovelConfig, args: Omit<AdaptMaterializeRequest, 'outputDir'> & {
232
+ outputDir: string;
233
+ }): Promise<Omit<AdaptMaterializeResponse, 'book'>>;
234
+ /** 把预览/微调后的新书资料写入输出目录并返回摘要(书架登记由路由负责)。 */
235
+ export declare function saveMaterializedBook(outDir: string, bookName: string, data: Omit<AdaptMaterializeSaveRequest, 'bookName' | 'outputDir'>): Omit<AdaptMaterializeSaveResponse, 'book'>;
236
+ export declare function summarizeAndExtractFacts(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<{
237
+ summary: string;
238
+ factCount: number;
239
+ }>;
240
+ /**
241
+ * 伏笔落地标记:检查刚生成的章节正文是否埋下了 planned 伏笔(关键词匹配),
242
+ * 命中则将该伏笔标记为 planted 并记录 plantedChapter——保证暗线管理页与正文同步。
243
+ * 纯关键词粗匹配,宁缺毋滥:仅处理「描述含可辨识关键词」的伏笔,无把握则不标。
244
+ */
245
+ export declare function markForeshadowPlanted(project: ProjectState, outputDir: string, chapterNo: number): number;
246
+ /**
247
+ * 抽取本章「已确立事实」追加到事实库/时间线(最多 300 条,最新优先)。
248
+ * 事实注入后续章节生成提示词,保证人物状态/境界/资源/关系长期一致。
249
+ * @returns 新增事实条数(失败返回 0,调用方 best-effort)。
250
+ */
251
+ export declare function extractFacts(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<number>;
252
+ /** 全书一致性质检:LLM 分批扫描已生成章节 + 设定 + 事实库,聚合矛盾清单。 */
253
+ export declare function auditBook(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, onProgress?: (completedBatches: number, totalBatches: number) => void): Promise<AuditIssue[]>;
254
+ /** 小说简介:AI 生成或按已写开头补全(面向读者的作品门面)。 */
255
+ export declare function generateBlurb(ctx: Context, config: NovelConfig, project: ProjectState, partial?: string): Promise<string>;
256
+ /**
257
+ * 组装全书上下文包(AI 助手 book_overview 工具)。
258
+ * 分片策略:章节要点默认只给最近 30 章(避免超长后爆上下文);
259
+ * scope='full' 全量;scope=数字 只给该卷章节。
260
+ */
261
+ export declare function bookOverview(project: ProjectState, scope?: 'recent' | 'full' | number): string;
262
+ /** 一条影响分析结果(改动波及处)。 */
263
+ export interface ImpactItem {
264
+ /** 位置:章节号 / 大纲 / 道藏 / 大世界 / 事实库 / 简介。 */
265
+ location: string;
266
+ /** 原文片段(定位用)。 */
267
+ quote: string;
268
+ /** 修改建议。 */
269
+ suggestion: string;
270
+ /** must = 必须同步改;optional = 建议改;note = 备注(如保留旧称作古称)。 */
271
+ kind: 'must' | 'optional' | 'note';
272
+ }
273
+ /**
274
+ * 影响分析:LLM 扫描全书(大纲/设定/大世界/事实库/已写章节),
275
+ * 定位一次改动波及的所有位置。助手在修改后主动调用,做连锁维护。
276
+ */
277
+ export declare function analyzeImpact(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, change: string): Promise<ImpactItem[]>;
278
+ /** 把大世界结构化数据渲染成提示词块(境界体系按顺序强约束)。 */
279
+ export declare function renderWorld(world: WorldState | undefined): string;
280
+ /** AI 提炼大世界:从大纲 + 道藏生成结构化境界体系/区域/势力。 */
281
+ export declare function extractWorld(ctx: Context, config: NovelConfig, project: ProjectState): Promise<WorldState>;
282
+ /**
283
+ * 事实库回填:对历史已生成章节批量抽取事实(无事实记录的旧章节)。
284
+ * @returns 回填的章节数。
285
+ */
286
+ export declare function backfillFacts(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string): Promise<number>;
287
+ /**
288
+ * 角色卡刷新:出场统计由服务端从正文精确计算(角色名出现过的章节数、
289
+ * 最近出现章节),LLM 只负责聚合「当前状态」一句话。
290
+ */
291
+ export declare function refreshCharacters(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string): Promise<RoleStatusCard[]>;
78
292
  /** Suggest foreshadows from the outline + plan. */
79
293
  export declare function suggestForeshadows(ctx: Context, config: NovelConfig, project: ProjectState): Promise<Foreshadow[]>;
80
294
  /**
@@ -86,7 +300,35 @@ export declare function extractStyleAsset(ctx: Context, config: NovelConfig, sam
86
300
  dialogueRules: string[];
87
301
  descriptionRules: string[];
88
302
  boundaries: string[];
303
+ preset?: 'imitate' | 'balanced' | 'transfer';
304
+ fingerprintRisk?: 'low' | 'medium' | 'high';
305
+ writingGuidance?: string[];
306
+ forbiddenEntities?: string[];
307
+ }>;
308
+ /** 分层提取写作公式(basic/standard/deep)。 */
309
+ export declare function extractStyleFormula(ctx: Context, config: NovelConfig, sampleText: string, depth: 'basic' | 'standard' | 'deep'): Promise<{
310
+ name: string;
311
+ focusAreas: string[];
312
+ formula: string;
313
+ applyGuidance: string;
89
314
  }>;
315
+ /** 题材雷达:输入平台/题材/榜单文本 → 信号 + 生产底座 + 开书创意。 */
316
+ export declare function runMarketRadar(ctx: Context, config: NovelConfig, req: MarketRadarRequest): Promise<MarketRadarResult>;
317
+ /** 开书创意简报:用选中的市场信号 + 影响模式生成可执行 constraint / creative seed。 */
318
+ export declare function runMarketCreativeBrief(ctx: Context, config: NovelConfig, req: MarketRadarBriefRequest): Promise<MarketCreativeBrief>;
319
+ /** 书分析/拆书:输入一本书/章节文本 → 卖点/结构/可借鉴点/风险。 */
320
+ export declare function runBookAnalysis(ctx: Context, config: NovelConfig, req: BookAnalysisRequest): Promise<BookAnalysisResult>;
321
+ /** 创意灵感:一句话/题材 → 多方向开书灵感。 */
322
+ export declare function runIdeaInspiration(ctx: Context, config: NovelConfig, req: IdeaInspirationRequest): Promise<IdeaInspirationResult>;
323
+ /** 雷达→灵感:基于市场信号/生产底座/创意简报,生成贴合市场的开书灵感。 */
324
+ export declare function runMarketIdeaInspiration(ctx: Context, config: NovelConfig, req: {
325
+ signals?: MarketRadarSignal[];
326
+ foundation?: ProductionFoundation;
327
+ brief?: MarketCreativeBrief;
328
+ count?: number;
329
+ }): Promise<IdeaInspirationResult>;
330
+ /** 自动导演编排建议:基于全书上下文,给出下一卷/阶段编排 + 修复再平衡。 */
331
+ export declare function runDirectorAdvice(ctx: Context, config: NovelConfig, project: ProjectState, req: DirectorRequest): Promise<DirectorAdvice>;
90
332
  /** Export the whole book as one txt/md file. */
91
333
  export declare function exportBook(outputDir: string, project: ProjectState, format: 'txt' | 'md'): {
92
334
  file: string;
@@ -0,0 +1,6 @@
1
+ import type { GenreNode, ProgressionMode } from './protocol.ts';
2
+ export declare function globalGenreLibrary(): GenreNode[];
3
+ export declare function globalProgressionLibrary(): ProgressionMode[];
4
+ /** 新增/已有则跳过;返回 true=新增。 */
5
+ export declare function addGlobalGenre(g: GenreNode): boolean;
6
+ export declare function addGlobalMode(m: ProgressionMode): boolean;
@@ -18,7 +18,7 @@ export declare const inject: string[];
18
18
  * settings surface edits. Spelled here rather than imported: the browser half
19
19
  * spells the same value and must not depend on a Host package.
20
20
  */
21
- export declare const NOVEL_SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
21
+ export declare const NOVEL_SETTINGS_NAMESPACE: "dsh-novel-forge";
22
22
  /** Plugin config, validated by the same-named schemastery schema. */
23
23
  export interface Config {
24
24
  /** When true (default), a system-prompt section announces the plugin to every agent. */
@@ -33,6 +33,16 @@ export interface Config {
33
33
  provider?: string;
34
34
  /** LLM model id. */
35
35
  model?: string;
36
+ /** 任务级模型路由:正文生成模型(留空则跟随 model)。 */
37
+ generateModel?: string;
38
+ /** 任务级模型路由:审稿模型(留空则跟随 model)。 */
39
+ reviewModel?: string;
40
+ /** 任务级模型路由:AI 复核/质检模型(留空则跟随 model)。 */
41
+ auditModel?: string;
42
+ /** LLM reasoning effort (off/low/high/max). */
43
+ reasoningEffort?: 'off' | 'low' | 'high' | 'max';
44
+ /** 分析类任务(提炼/拆书/反推大纲等)的推理档位;默认 low。 */
45
+ analysisReasoning?: 'off' | 'low' | 'high' | 'max';
36
46
  /** Target characters per chapter. */
37
47
  chapterChars?: number;
38
48
  /** Max output tokens per chapter call. */
@@ -41,10 +51,22 @@ export interface Config {
41
51
  reviewPassScore?: number;
42
52
  /** Whether generation auto-runs review after writing. */
43
53
  autoReview?: boolean;
54
+ /** Whether generation auto-runs the author review (hook/continuity/trend). */
55
+ autoAuthorReview?: boolean;
56
+ /** 修订/润色产出草稿后自动附带一次 AI 审查(默认开,可在设置页关闭省 token)。 */
57
+ autoReviewAfterRevise?: boolean;
58
+ /** 自定义背景图(URL / dataURL / 服务端路径引用)。 */
59
+ themeBackground?: string;
60
+ /** 自定义背景遮罩/模糊强度 0-80。 */
61
+ themeBackgroundBlur?: number;
62
+ /** 玻璃透明度 0-100(100=当前原样)。 */
63
+ themeOpacity?: number;
64
+ /** 是否启用改编模式(默认关闭)。 */
65
+ enableAdaptMode?: boolean;
44
66
  }
45
67
  export declare const Config: z<Config>;
46
68
  /** Model-facing announcement: plugin presence, capabilities, and limits. */
47
- export declare const NOVEL_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-novel-forge \u63D2\u4EF6\uFF08AI \u7F16\u8BD1\u5C0F\u8BF4\u5DE5\u4F5C\u53F0\uFF09\uFF1A\u4FA7\u8FB9\u680F\u300C\u5C0F\u8BF4\u5DE5\u574A\u300D\u5165\u53E3\u3002\u80FD\u529B\uFF1A\u8BFB\u53D6 docx \u5927\u7EB2\uFF08\u9ED8\u8BA4\u684C\u9762\u300A\u5F52\u589F\u7389\u4E3B\u300B\u5927\u7EB2\uFF09\u6216\u7C98\u8D34\u5927\u7EB2\u6587\u672C\uFF1B\u7528 LLM \u63D0\u70BC\u8BBE\u5B9A\u5723\u7ECF\uFF08\u4EBA\u8BBE/\u4E16\u754C\u89C2/\u91D1\u624B\u6307\u89C4\u5219/\u5199\u4F5C\u7EA2\u7EBF\uFF09\uFF1B\u751F\u6210\u5377\u8BA1\u5212\u4E0E\u7AE0\u8282\u8BA1\u5212\uFF1B\u9010\u7AE0\u8C03\u7528 LLM \u751F\u6210 3000-4000 \u5B57\u6B63\u6587\u5E76\u4FDD\u5B58\u4E3A Markdown\uFF08\u9ED8\u8BA4\u8F93\u51FA\u5230 \u684C\u9762\\\u5F52\u589F\u7389\u4E3B\uFF09\uFF1B\u6BCF\u7AE0\u81EA\u52A8\u751F\u6210\u6458\u8981\uFF08\u53D9\u4E8B\u8BB0\u5FC6\uFF09\u3001\u81EA\u52A8 AI \u5BA1\u7A3F\uFF08\u4EBA\u8BBE/\u8BBE\u5B9A/\u7EA2\u7EBF/\u6587\u7B14/\u723D\u70B9/\u903B\u8F91\uFF09\uFF0C\u652F\u6301\u6309\u5BA1\u7A3F\u610F\u89C1\u91CD\u5199\u3001\u53BB AI \u5473\u6DA6\u8272\u3001\u4F0F\u7B14\u7BA1\u7406\u3001\u6279\u91CF\u8FDE\u5199\u4E0E\u5168\u672C\u5BFC\u51FA\uFF08txt/md\uFF09\u3002\u9650\u5236\uFF1A\u751F\u6210\u6D88\u8017 LLM API \u989D\u5EA6\uFF1B\u8F93\u51FA\u76EE\u5F55\u4E0E\u6A21\u578B\u53EF\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u4FEE\u6539\uFF1B\u7AE0\u8282\u6B63\u6587\u8D28\u91CF\u53D6\u51B3\u4E8E\u5927\u7EB2\u5B8C\u6574\u5EA6\u3002\u7528\u6237\u63D0\u5230\u300C\u5C0F\u8BF4 / \u5927\u7EB2 / \u5199\u5C0F\u8BF4 / \u7AE0\u8282 / \u5BA1\u7A3F / \u4F0F\u7B14 / \u6DA6\u8272 / \u5F52\u589F\u7389\u4E3B\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
69
+ export declare const NOVEL_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-novel-forge \u63D2\u4EF6\uFF08AI \u7F16\u8BD1\u5C0F\u8BF4\u5DE5\u4F5C\u53F0\uFF09\uFF1A\u4FA7\u8FB9\u680F\u300C\u5C0F\u8BF4\u5DE5\u574A\u300D\u5165\u53E3\u3002\u80FD\u529B\uFF1A\u8BFB\u53D6 docx \u5927\u7EB2\u6216\u7C98\u8D34\u5927\u7EB2\u6587\u672C\uFF1B\u7528 LLM \u63D0\u70BC\u9053\u85CF\uFF08\u4EBA\u8BBE/\u4E16\u754C\u89C2/\u91D1\u624B\u6307\u89C4\u5219/\u5199\u4F5C\u7EA2\u7EBF\uFF09\uFF1B\u751F\u6210\u5377\u8BA1\u5212\u4E0E\u7AE0\u8282\u8BA1\u5212\uFF1B\u9010\u7AE0\u8C03\u7528 LLM \u751F\u6210 3000-4000 \u5B57\u6B63\u6587\u5E76\u4FDD\u5B58\u4E3A Markdown\uFF08\u9ED8\u8BA4\u8F93\u51FA\u5230\u7528\u6237\u4E3B\u76EE\u5F55 ~/.dsh/novels\uFF09\uFF1B\u6BCF\u7AE0\u81EA\u52A8\u751F\u6210\u6458\u8981\uFF08\u53D9\u4E8B\u8BB0\u5FC6\uFF09\u3001\u81EA\u52A8 AI \u5BA1\u7A3F\uFF08\u4EBA\u8BBE/\u8BBE\u5B9A/\u7EA2\u7EBF/\u6587\u7B14/\u723D\u70B9/\u903B\u8F91\uFF09\uFF0C\u652F\u6301\u6309\u5BA1\u7A3F\u610F\u89C1\u91CD\u5199\u3001\u53BB AI \u5473\u6DA6\u8272\u3001\u6697\u7EBF\uFF08\u4F0F\u7B14\uFF09\u7BA1\u7406\u3001\u6279\u91CF\u8FDE\u5199\u4E0E\u5168\u672C\u5BFC\u51FA\uFF08txt/md\uFF09\u3002\u9650\u5236\uFF1A\u751F\u6210\u6D88\u8017 LLM API \u989D\u5EA6\uFF1B\u8F93\u51FA\u76EE\u5F55\u4E0E\u6A21\u578B\u53EF\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u4FEE\u6539\uFF1B\u7AE0\u8282\u6B63\u6587\u8D28\u91CF\u53D6\u51B3\u4E8E\u5927\u7EB2\u5B8C\u6574\u5EA6\u3002\u7528\u6237\u63D0\u5230\u300C\u5C0F\u8BF4 / \u5927\u7EB2 / \u5199\u5C0F\u8BF4 / \u7AE0\u8282 / \u5BA1\u7A3F / \u6DA6\u8272\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
48
70
  /** Resolve a config-like value into the full runtime config. */
49
71
  export declare function resolveConfig(value: Partial<Config> | undefined): NovelConfig;
50
72
  /**
@@ -0,0 +1,44 @@
1
+ /**
2
+ * LLM 实况 feed(对齐上游「AI 创作实况 / LIVE LOG」的轻量实现)。
3
+ *
4
+ * 以「每次 LLM 调用」为粒度,把生命周期事件(开始/流式正文/阶段变化/完成)推给订阅者,
5
+ * 并提供环形缓冲供新连上的客户端重放。不持久化(与上游缓存不同,如需成 cache 再扩展)。
6
+ */
7
+ export type LlmLivePhase = 'requesting' | 'streaming' | 'completed' | 'failed';
8
+ export interface LlmLiveFrame {
9
+ type: 'session_started' | 'output_delta' | 'reasoning_delta' | 'phase_changed' | 'session_completed';
10
+ /** 由服务端生成,形如 ll-<n>。 */
11
+ sessionId: string;
12
+ /** 本次调用用途(如 正文生成/审稿/章节规划)。 */
13
+ label?: string;
14
+ /** 使用模型(用于展示)。 */
15
+ model?: string;
16
+ /** 事件时间(ISO)。 */
17
+ at: string;
18
+ /** session_started / 部分帧:交互上下文。 */
19
+ context?: {
20
+ taskId?: string;
21
+ interactionId: string;
22
+ };
23
+ /** output_delta / reasoning_delta:本次增量文本。 */
24
+ content?: string;
25
+ /** session 累计字符数。 */
26
+ totalChars?: number;
27
+ /** reasoning 累计字符数。 */
28
+ totalReasoningChars?: number;
29
+ /** phase_changed:新阶段。 */
30
+ phase?: LlmLivePhase;
31
+ /** phase_changed:阶段描述。 */
32
+ phaseMessage?: string;
33
+ /** session_completed:最终预览(截断)。 */
34
+ preview?: string;
35
+ /** session_completed:失败信息。 */
36
+ error?: string;
37
+ }
38
+ type Listener = (frame: LlmLiveFrame) => void;
39
+ export declare function nextSessionId(): string;
40
+ export declare function subscribeLiveFeed(listener: Listener): () => void;
41
+ export declare function emitLive(frame: LlmLiveFrame): void;
42
+ export declare function liveLatest(): LlmLiveFrame[];
43
+ export declare function clearLiveFeed(): void;
44
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 题材规则库(可插拔)—— 漫剧分镜/提示词生成的「题材专用规则」。
3
+ * 参考短剧工业导演规范:不同题材用不同的视觉语言 / 打斗 / 特效规则,
4
+ * 按漫剧方案的 genre 注入 generateStoryboardPrompts,避免「一套模板跑所有题材」。
5
+ * 每个题材给一组「生成提示词时必须遵守的题材规则」;未选题材则不注入(走通用规则)。
6
+ */
7
+ export interface GenreRule {
8
+ /** 题材 id。 */
9
+ id: string;
10
+ /** 题材名(展示)。 */
11
+ label: string;
12
+ /** 该题材的生成提示词核心规则(每行一条,注入生成时)。 */
13
+ rules: string[];
14
+ }
15
+ /** 内置题材(通用题材 default 为空规则)。 */
16
+ export declare const GENRES: GenreRule[];
17
+ /** 通用题材(空规则,走通用生成)。 */
18
+ export declare const DEFAULT_GENRE: GenreRule;
19
+ /** 按题材 id 取规则(未找到返回通用)。 */
20
+ export declare function getGenreRules(id?: string): string[];
21
+ /** 取题材 label(展示用)。 */
22
+ export declare function getGenreLabel(id?: string): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 热门题材雷达:真实榜单扫榜(聚合各平台榜单源,容错)。
3
+ */
4
+ import { type CollectedRankingItem, type MarketRadarPlatform } from './market-radar-sources.ts';
5
+ export interface MarketRadarGroup {
6
+ platform: MarketRadarPlatform;
7
+ platformLabel: string;
8
+ listKey: string;
9
+ listLabel: string;
10
+ status: 'ok' | 'error';
11
+ error?: string;
12
+ items: CollectedRankingItem[];
13
+ }
14
+ export interface MarketScanResult {
15
+ scannedAt: string;
16
+ groups: MarketRadarGroup[];
17
+ }
18
+ export declare function getLastMarketScan(): MarketScanResult | null;
19
+ export declare function scanMarketRanking(platforms?: string[]): Promise<MarketScanResult>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 「热门题材雷达」真实榜单抓取源(移植自 AI-Novel-Writing-Assistant marketRadarSources)。
3
+ * 用全局 fetch 抓取公开榜单移动版页面,正则抽取元数据;无第三方依赖。
4
+ */
5
+ export type MarketRadarPlatform = 'fanqie' | 'qidian' | 'jinjiang';
6
+ export interface MarketRadarListSource {
7
+ platform: MarketRadarPlatform;
8
+ platformLabel: string;
9
+ listKey: string;
10
+ listLabel: string;
11
+ channel: string;
12
+ sourceUrl: string;
13
+ }
14
+ export interface CollectedRankingItem {
15
+ rank: number;
16
+ title: string;
17
+ author?: string;
18
+ category?: string;
19
+ tags: string[];
20
+ synopsis?: string;
21
+ heatLabel?: string;
22
+ serialStatus?: string;
23
+ sourceUrl: string;
24
+ }
25
+ export declare const MARKET_RADAR_SOURCES: MarketRadarListSource[];
26
+ export declare function hasPrivateUseCharacters(value: string | null | undefined): boolean;
27
+ export declare function parseFanqieRanking(html: string, source: MarketRadarListSource): CollectedRankingItem[];
28
+ export declare function parseFanqieDetail(html: string, item: CollectedRankingItem): CollectedRankingItem;
29
+ export declare function parseQidianRanking(html: string, source: MarketRadarListSource): CollectedRankingItem[];
30
+ export declare function parseJinjiangRanking(html: string, source: MarketRadarListSource): CollectedRankingItem[];
31
+ export declare function collectMarketSource(source: MarketRadarListSource): Promise<CollectedRankingItem[]>;