@waterwx/dsh-novel-forge 1.0.0-alpha → 1.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 (148) hide show
  1. package/README.md +231 -231
  2. package/lib/client.js +9118 -7818
  3. package/lib/index.js +316 -112
  4. package/lib/types/bookshelf.d.ts +5 -0
  5. package/lib/types/client/api.d.ts +6 -2
  6. package/lib/types/client/docx.d.ts +2 -0
  7. package/lib/types/client/locales.d.ts +5 -5
  8. package/lib/types/client/panel/AiTag.d.ts +1 -0
  9. package/lib/types/client/panel/AuthorHome.d.ts +11 -11
  10. package/lib/types/client/panel/CmdPalette.d.ts +12 -0
  11. package/lib/types/client/panel/LiveFeedLog.d.ts +3 -0
  12. package/lib/types/client/panel/NovelPanel.d.ts +5 -0
  13. package/lib/types/client/panel/PageHeader.d.ts +18 -0
  14. package/lib/types/client/panel/SettingsView.d.ts +12 -9
  15. package/lib/types/client/panel/ShelfView.d.ts +10 -1
  16. package/lib/types/client/panel/SubPage.d.ts +27 -0
  17. package/lib/types/client/panel/toast.d.ts +2 -0
  18. package/lib/types/client/panel/views.d.ts +25 -7
  19. package/lib/types/docx-core.d.ts +16 -0
  20. package/lib/types/docx.d.ts +2 -3
  21. package/lib/types/engine.d.ts +9 -9
  22. package/lib/types/index.d.ts +1 -1
  23. package/lib/types/migrate-output.d.ts +25 -0
  24. package/lib/types/prompting.d.ts +1 -26
  25. package/lib/types/protocol.d.ts +76 -31
  26. package/lib/types/routes.d.ts +4 -0
  27. package/lib/types/run.d.ts +2 -0
  28. package/package.json +120 -120
  29. package/src/assistant.ts +3 -3
  30. package/src/author-assets.ts +149 -147
  31. package/src/bookshelf.ts +187 -167
  32. package/src/client/api.ts +12 -3
  33. package/src/client/docx.ts +37 -69
  34. package/src/client/llmLive.ts +101 -101
  35. package/src/client/locales.ts +418 -418
  36. package/src/client/panel/AdaptModeView.tsx +535 -535
  37. package/src/client/panel/AiTag.tsx +7 -0
  38. package/src/client/panel/AssetsTab.tsx +448 -458
  39. package/src/client/panel/AssistantTab.tsx +35 -35
  40. package/src/client/panel/AuthorAssetsView.tsx +205 -207
  41. package/src/client/panel/AuthorHome.tsx +309 -234
  42. package/src/client/panel/BookAnalysisView.tsx +63 -60
  43. package/src/client/panel/CmdPalette.tsx +102 -0
  44. package/src/client/panel/CreateBookView.tsx +366 -371
  45. package/src/client/panel/DirectorView.tsx +23 -23
  46. package/src/client/panel/GlobalAssetLibraryView.tsx +168 -172
  47. package/src/client/panel/IdeaInspirationView.tsx +76 -71
  48. package/src/client/panel/ImportModal.tsx +302 -302
  49. package/src/client/panel/KnowledgeBaseView.tsx +125 -73
  50. package/src/client/panel/LiveFeedLog.tsx +67 -67
  51. package/src/client/panel/MarketRadarView.tsx +377 -374
  52. package/src/client/panel/ModelManager.tsx +205 -205
  53. package/src/client/panel/NovelPanel.tsx +2761 -2100
  54. package/src/client/panel/PageHeader.tsx +37 -0
  55. package/src/client/panel/ProgressConsole.tsx +63 -63
  56. package/src/client/panel/ReaderView.tsx +306 -306
  57. package/src/client/panel/RunPanel.tsx +223 -204
  58. package/src/client/panel/SettingsView.tsx +305 -265
  59. package/src/client/panel/ShelfView.tsx +266 -242
  60. package/src/client/panel/SubPage.tsx +42 -0
  61. package/src/client/panel/WorldTab.tsx +202 -202
  62. package/src/client/panel/panel.module.css +5764 -4693
  63. package/src/client/panel/toast.ts +51 -0
  64. package/src/client/panel/views.tsx +401 -346
  65. package/src/client/run-status.ts +143 -100
  66. package/src/docx-core.ts +53 -0
  67. package/src/docx.ts +44 -83
  68. package/src/engine.ts +15 -90
  69. package/src/index.ts +311 -298
  70. package/src/migrate-output.ts +76 -0
  71. package/src/novel-context.ts +286 -287
  72. package/src/prompting.ts +26 -159
  73. package/src/protocol.ts +79 -31
  74. package/src/routes.ts +123 -9
  75. package/src/run.ts +341 -338
  76. package/lib/types/client/panel/FlowGuide.d.ts +0 -22
  77. package/lib/types/client/panel/MangaRoleLibrary.d.ts +0 -20
  78. package/lib/types/client/panel/MangaWorkspace.d.ts +0 -12
  79. package/lib/types/client/panel/ModelPicker.d.ts +0 -11
  80. package/lib/types/client/panel/PropLibrary.d.ts +0 -8
  81. package/lib/types/client/panel/SceneLibrary.d.ts +0 -16
  82. package/lib/types/client/panel/StoryboardTab.d.ts +0 -19
  83. package/lib/types/client/panel/StyleCard.d.ts +0 -8
  84. package/lib/types/client/panel/StyleGallery.d.ts +0 -1
  85. package/lib/types/comic-presets.d.ts +0 -12
  86. package/lib/types/manga-genre-rules.d.ts +0 -22
  87. package/lib/types/shot-language.d.ts +0 -46
  88. package/lib/types/src/ai-scan.d.ts +0 -36
  89. package/lib/types/src/assets.d.ts +0 -37
  90. package/lib/types/src/assistant.d.ts +0 -45
  91. package/lib/types/src/author-assets.d.ts +0 -25
  92. package/lib/types/src/bookshelf.d.ts +0 -42
  93. package/lib/types/src/client/api.d.ts +0 -234
  94. package/lib/types/src/client/docx.d.ts +0 -15
  95. package/lib/types/src/client/index.d.ts +0 -14
  96. package/lib/types/src/client/locales.d.ts +0 -212
  97. package/lib/types/src/client/mount.d.ts +0 -9
  98. package/lib/types/src/client/panel/AdaptModeView.d.ts +0 -5
  99. package/lib/types/src/client/panel/AssetsTab.d.ts +0 -12
  100. package/lib/types/src/client/panel/AssistantTab.d.ts +0 -7
  101. package/lib/types/src/client/panel/AuthorAssetsView.d.ts +0 -4
  102. package/lib/types/src/client/panel/AuthorHome.d.ts +0 -32
  103. package/lib/types/src/client/panel/BookshelfBar.d.ts +0 -11
  104. package/lib/types/src/client/panel/CreateBookView.d.ts +0 -9
  105. package/lib/types/src/client/panel/FlowGuide.d.ts +0 -22
  106. package/lib/types/src/client/panel/GlobalAssetLibraryView.d.ts +0 -4
  107. package/lib/types/src/client/panel/ImportModal.d.ts +0 -7
  108. package/lib/types/src/client/panel/MangaRoleLibrary.d.ts +0 -20
  109. package/lib/types/src/client/panel/MangaWorkspace.d.ts +0 -12
  110. package/lib/types/src/client/panel/ModelManager.d.ts +0 -14
  111. package/lib/types/src/client/panel/NovelPanel.d.ts +0 -13
  112. package/lib/types/src/client/panel/ProgressConsole.d.ts +0 -17
  113. package/lib/types/src/client/panel/ProgressHomeView.d.ts +0 -5
  114. package/lib/types/src/client/panel/PropLibrary.d.ts +0 -8
  115. package/lib/types/src/client/panel/ReaderView.d.ts +0 -8
  116. package/lib/types/src/client/panel/ReasoningSection.d.ts +0 -10
  117. package/lib/types/src/client/panel/RunPanel.d.ts +0 -5
  118. package/lib/types/src/client/panel/SceneLibrary.d.ts +0 -16
  119. package/lib/types/src/client/panel/SettingsView.d.ts +0 -16
  120. package/lib/types/src/client/panel/ShelfView.d.ts +0 -15
  121. package/lib/types/src/client/panel/StoryboardTab.d.ts +0 -19
  122. package/lib/types/src/client/panel/StyleCard.d.ts +0 -8
  123. package/lib/types/src/client/panel/StyleGallery.d.ts +0 -1
  124. package/lib/types/src/client/panel/WorldTab.d.ts +0 -10
  125. package/lib/types/src/client/panel/controller.d.ts +0 -19
  126. package/lib/types/src/client/panel/helpers.d.ts +0 -18
  127. package/lib/types/src/client/panel/views.d.ts +0 -77
  128. package/lib/types/src/client/sidebar-entry.d.ts +0 -13
  129. package/lib/types/src/client/text.d.ts +0 -9
  130. package/lib/types/src/comic-presets.d.ts +0 -12
  131. package/lib/types/src/docx.d.ts +0 -19
  132. package/lib/types/src/engine.d.ts +0 -402
  133. package/lib/types/src/index.d.ts +0 -79
  134. package/lib/types/src/manga-genre-rules.d.ts +0 -22
  135. package/lib/types/src/novel-context.d.ts +0 -80
  136. package/lib/types/src/prompt-utils.d.ts +0 -35
  137. package/lib/types/src/protocol.d.ts +0 -2176
  138. package/lib/types/src/review-policy.d.ts +0 -97
  139. package/lib/types/src/routes.d.ts +0 -29
  140. package/lib/types/src/run.d.ts +0 -32
  141. package/lib/types/src/shot-language.d.ts +0 -46
  142. package/lib/types/src/story-beat-language.d.ts +0 -35
  143. package/lib/types/src/style-library.d.ts +0 -33
  144. package/lib/types/story-beat-language.d.ts +0 -35
  145. package/lib/types/style-library.d.ts +0 -33
  146. package/src/client/panel/BookshelfBar.tsx +0 -170
  147. package/src/client/panel/ProgressHomeView.tsx +0 -87
  148. package/src/prompt-utils.ts +0 -73
@@ -37,6 +37,11 @@ export declare function activateBook(id: string): BookEntry | undefined;
37
37
  export declare function removeBook(id: string): boolean;
38
38
  /** 当前书输出目录(无书架则 undefined,回退 settings)。 */
39
39
  export declare function activeBookOutputDir(): string | undefined;
40
+ /**
41
+ * 书目录重指向:把 outputDir 等于 from 的书条目全部改为 to(目录迁移联动)。
42
+ * @returns 重指向的条目数。
43
+ */
44
+ export declare function repointBookDirs(from: string, to: string): number;
40
45
  /** 默认输出目录推断:~/.dsh/novels/书名。 */
41
46
  export declare function defaultOutputDirFor(bookName: string): string;
42
47
  export {};
@@ -44,6 +44,10 @@ export declare class NovelApi {
44
44
  patchConfig(patch: ConfigPatch): Promise<{
45
45
  config: NovelConfig;
46
46
  }>;
47
+ /** 输出目录迁移:dryRun=true 仅预览目录内容;确认时传 to 搬迁。 */
48
+ moveOutputDir(to?: string, dryRun?: boolean): Promise<import('../protocol.ts').MoveOutputDirResponse>;
49
+ /** 本书参数:不带 patch 读取;带 patch 合并保存(字段传 null = 回退全局)。 */
50
+ bookSettings(patch?: Record<string, unknown>): Promise<import('../protocol.ts').BookSettingsResponse>;
47
51
  openFolder(): Promise<void>;
48
52
  /** 插件自更新:在 DSH profile 目录拉取最新 npm 版(需重启 DSH 生效)。 */
49
53
  pluginUpdate(): Promise<PluginUpdateResponse>;
@@ -193,7 +197,7 @@ export declare class NovelApi {
193
197
  /** 移除一个提供方(unset key + 移除 llm-pi-ai 路由)。 */
194
198
  removeProvider(req: RemoveProviderRequest): Promise<RemoveProviderResponse>;
195
199
  roles(req: import('../protocol.ts').RolesRequest): Promise<import('../protocol.ts').RolesResponse>;
196
- /** 小说简介:AI 生成/补全(partial 留空 = 全量),或手动保存。 */
200
+ /** 小说简介:生成/补全(partial 留空 = 全量),或手动保存。 */
197
201
  blurb(action: 'generate' | 'save', text?: string, partial?: string): Promise<{
198
202
  blurb: string;
199
203
  }>;
@@ -208,7 +212,7 @@ export declare class NovelApi {
208
212
  rename(bookName: string): Promise<{
209
213
  bookName: string;
210
214
  }>;
211
- /** 大世界:AI 提炼(generate)或手动保存(save)。 */
215
+ /** 大世界:提炼(generate)或手动保存(save)。 */
212
216
  world(action: 'generate' | 'save', world?: import('../protocol.ts').WorldState): Promise<{
213
217
  world: import('../protocol.ts').WorldState;
214
218
  }>;
@@ -8,6 +8,8 @@
8
8
  * the Node build (esm/index.mjs), which calls module.createRequire() for the
9
9
  * optional worker_threads path — inlining that into the browser bundle leaves
10
10
  * a bare require("module") the client-modules table cannot answer.
11
+ *
12
+ * XML 解析共享核心在 ../docx-core.ts(与服务端同源)。
11
13
  */
12
14
  /** Extract plain text from a docx buffer: one line per <w:p> paragraph. */
13
15
  export declare function extractDocxTextFromBuffer(buffer: ArrayBuffer | Uint8Array): string;
@@ -79,7 +79,7 @@ export declare const zh: {
79
79
  readonly 'plan.volumes': "卷";
80
80
  readonly 'plan.noVolume': "未分卷";
81
81
  readonly 'bible.title': "道藏";
82
- readonly 'bible.gen': "AI 提炼道藏";
82
+ readonly 'bible.gen': "提炼道藏";
83
83
  readonly 'bible.genre': "题材基调";
84
84
  readonly 'bible.worldRules': "世界规则";
85
85
  readonly 'bible.characters': "人物志";
@@ -87,7 +87,7 @@ export declare const zh: {
87
87
  readonly 'bible.style': "风格要求";
88
88
  readonly 'bible.none': "尚未生成道藏。生成后写作会严格遵守人设与金手指规则,审稿也会按红线检查。";
89
89
  readonly 'foreshadow.title': "暗线管理";
90
- readonly 'foreshadow.suggest': "AI 建议暗线";
90
+ readonly 'foreshadow.suggest': "建议暗线";
91
91
  readonly 'foreshadow.none': "暂无暗线";
92
92
  readonly 'foreshadow.status': "状态";
93
93
  readonly 'foreshadow.planned': "计划中";
@@ -126,9 +126,9 @@ export declare const zh: {
126
126
  readonly 'plotlines.workflowTitle': "剧情线进度";
127
127
  readonly 'plotlines.workflowEmpty': "未建剧情线(去「剧情线」页创建)";
128
128
  readonly 'sensitive.title': "敏感词检查";
129
- readonly 'sensitive.scanAll': "🔞 全书敏感词检查";
129
+ readonly 'sensitive.scanAll': " 全书敏感词检查";
130
130
  readonly 'sensitive.hint': "内置违禁词库硬匹配(政治/擦边/暴力/辱骂/广告/其他),发布前建议检查;只做提示,是否修改由你判断。";
131
- readonly 'sensitive.clean': "✅ 未命中任何违禁词(扫描 {n} 章)";
131
+ readonly 'sensitive.clean': " 未命中任何违禁词(扫描 {n} 章)";
132
132
  readonly 'sensitive.hits': "命中 {n} 处({chapters} 章受影响)";
133
133
  readonly 'sensitive.goFix': "去修订";
134
134
  readonly 'sensitive.fixPrefill': "请删除或替换正文中的违禁表达「{word}」(类别:{category}),用含蓄/间接的写法替代。";
@@ -198,7 +198,7 @@ export declare const zh: {
198
198
  readonly 'assistant.hint': "和 AI 编辑 Agent 讨论剧情、人设、暗线;达成一致后可让它直接修改总纲、道藏、章节内容。";
199
199
  readonly 'assistant.placeholder': "例如:我想让第 2 章结尾加一个悬念——墟境里传来爷爷的声音…";
200
200
  readonly 'assistant.send': "发送";
201
- readonly 'assistant.toolStart': "⚙ 执行操作:{name}…";
201
+ readonly 'assistant.toolStart': " 执行操作:{name}…";
202
202
  readonly 'assistant.toolDone': "✓ {name} 完成:{detail}";
203
203
  readonly 'assistant.toolError': "✗ {name} 失败:{detail}";
204
204
  readonly 'assistant.empty': "还没有对话。和 AI 编辑 Agent 聊聊剧情吧。";
@@ -0,0 +1 @@
1
+ export declare function AiTag(): JSX.Element;
@@ -1,7 +1,17 @@
1
1
  import type { NovelApi } from '../api.ts';
2
2
  import type { BookshelfSnapshot } from '../../protocol.ts';
3
3
  import { type ProgressLine } from './ProgressConsole.tsx';
4
- export declare function AuthorHome({ api, shelf, onOpenBook, onReadBook, onAddBook, onImportBook, onOpenSettings, onTheme, onBackground, onOpacity, onEndfieldAccent, adaptEnabled, progress, busy, busyLabel, liveBar, onClearProgress, onUseIdea }: {
4
+ export declare function AuthorHome({ api, shelf, onOpenBook, onReadBook, onAddBook, onImportBook, onBackground, progress, busy, busyLabel, liveBar, onClearProgress, onUseIdea, themeMode, themeDensity, onToggleMode, onChangeThemeMode, onChangeThemeDensity }: {
5
+ /** 当前显示模式(顶栏「墨纸 / 纸白」切换用)。 */
6
+ themeMode?: 'system' | 'light' | 'dark';
7
+ /** 当前界面密度。 */
8
+ themeDensity?: 'comfort' | 'compact' | 'spacious';
9
+ /** 切换墨纸 / 纸白(由 NovelPanel 落 localStorage)。 */
10
+ onToggleMode?: () => void;
11
+ /** 改变全局显示模式(联动整个面板)。 */
12
+ onChangeThemeMode: (m: 'system' | 'light' | 'dark') => void;
13
+ /** 改变全局界面密度(联动整个面板)。 */
14
+ onChangeThemeDensity: (d: 'comfort' | 'compact' | 'spacious') => void;
5
15
  api: NovelApi;
6
16
  shelf: BookshelfSnapshot;
7
17
  onOpenBook: (id: string) => void;
@@ -10,18 +20,8 @@ export declare function AuthorHome({ api, shelf, onOpenBook, onReadBook, onAddBo
10
20
  onImportBook: () => void;
11
21
  /** 创意灵感 → 采纳某个灵感带入开书向导。 */
12
22
  onUseIdea?: (idea: import('../../protocol.ts').IdeaInspirationResult['ideas'][number]) => void;
13
- /** 兼容旧入口:首页设置现为独立设置页,此回调保留但不再使用。 */
14
- onOpenSettings?: () => void;
15
- /** 主题/模式/密度变化回调(供面板根容器实时生效)。 */
16
- onTheme?: (theme: 'liquid' | 'neumorph' | 'macos' | 'clay' | 'endfield', mode: 'system' | 'light' | 'dark', density: 'comfort' | 'compact' | 'spacious') => void;
17
23
  /** 自定义背景变化回调。 */
18
24
  onBackground?: (bg: string | undefined, blur: number) => void;
19
- /** 玻璃透明度变化回调。 */
20
- onOpacity?: (n: number) => void;
21
- /** 终末地强调色变化回调。 */
22
- onEndfieldAccent?: (accent: 'valley' | 'wuling') => void;
23
- /** 是否启用改编模式(默认 false=隐藏入口)。 */
24
- adaptEnabled?: boolean;
25
25
  /** AI 进度实时状态(与书内共享同一份)。 */
26
26
  progress?: ProgressLine[];
27
27
  busy?: boolean;
@@ -0,0 +1,12 @@
1
+ import type { ReactElement } from 'react';
2
+ export interface CmdAction {
3
+ icon: string;
4
+ label: string;
5
+ hint?: string;
6
+ run: () => void;
7
+ }
8
+ export declare function CmdPalette({ open, onClose, actions }: {
9
+ open: boolean;
10
+ onClose: () => void;
11
+ actions: CmdAction[];
12
+ }): ReactElement | null;
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * 「实时调用 / LIVE」—— 内嵌到 AI 进度窗的下半区(详情层),不再独立浮窗。
3
3
  * 连接 /llm-live/stream,按 LLM 调用分组展示模型实时输出。
4
+ *
5
+ * 状态色全部走 panel.module.css 的 .lfPill / .lfDot(主题令牌 + --nf-streaming),
6
+ * 不再内联硬编码色;布局性 inline style 保留(均为令牌引用或动态值)。
4
7
  */
5
8
  export default function LiveFeedLog(): JSX.Element;
@@ -1,5 +1,10 @@
1
1
  import type { NovelApi } from '../api.ts';
2
2
  import type { PanelController } from './controller.ts';
3
+ /**
4
+ * 面板宽度低于此值时自动折叠左侧导航。
5
+ * 依据:.panelNav 占 216px,内容区留到 ~680px 才不至于把正文挤成竖排。
6
+ * 宿主中列宽度 ≠ 视口宽度(用户可拖拽侧边栏),所以必须用实测宽度而非媒体查询。
7
+ */
3
8
  /** The panel's tab identifiers. */
4
9
  export type NovelTab = 'workflow' | 'overview' | 'blurb' | 'plan' | 'bible' | 'world' | 'foreshadow' | 'assistant' | 'settings' | 'characters' | 'roles' | 'facts' | 'plotlines' | 'reviews' | 'progress' | 'breakdown' | 'director' | 'knowledge' | 'assetsGenre' | 'assetsProgression' | 'assetsTemplates' | 'assetsRules' | 'assetsStyle' | 'run' | 'book' | 'assets';
5
10
  /** Panel shell props. */
@@ -0,0 +1,18 @@
1
+ /** 墨案统一页头:eyebrow(11 大写窄) + 衬线大标题 + 一句说明 + 主/次动作。
2
+ * 每个视图只用一个 PageHeader,消灭"各自为政"的页面标题。
3
+ * 图标用 lucide 16 (单色),标题旁禁止 emoji;标题用衬线 Display(书卷感)。 */
4
+ import type { ReactNode } from 'react';
5
+ export declare function PageHeader({ eyebrow, title, icon, sub, actions, right }: {
6
+ /** 页眉小标(大写窄,可选,如 "BOOKSHELF")。 */
7
+ eyebrow?: string;
8
+ /** 页面大标题(衬线 Display)。 */
9
+ title: string;
10
+ /** lucide 图标(单色,16px),可选。 */
11
+ icon?: ReactNode;
12
+ /** 一句话辅助说明(meta)。 */
13
+ sub?: string;
14
+ /** 右侧主/次按钮组。 */
15
+ actions?: ReactNode;
16
+ /** 标题右上(如 AI 微签)。 */
17
+ right?: ReactNode;
18
+ }): JSX.Element;
@@ -1,16 +1,19 @@
1
1
  import type { NovelApi } from '../api.ts';
2
- type SettingsTab = 'model' | 'writing' | 'files' | 'appearance';
3
- type ThemeMode = 'system' | 'light' | 'dark';
4
- type ThemeName = 'liquid' | 'neumorph' | 'macos' | 'clay' | 'endfield';
5
- type EndfieldAccent = 'valley' | 'wuling';
6
- type ThemeDensity = 'comfort' | 'compact' | 'spacious';
7
- export declare function SettingsView({ api, onTheme, onSettingsTab, onEditorFontSize, onBackground, onOpacity, onEndfieldAccent }: {
2
+ type SettingsTab = 'model' | 'files' | 'appearance';
3
+ export declare function SettingsView({ api, variant, onSettingsTab, onEditorFontSize, onBackground, themeMode, themeDensity, onChangeThemeMode, onChangeThemeDensity }: {
8
4
  api: NovelApi;
9
- onTheme?: (theme: ThemeName, mode: ThemeMode, density: ThemeDensity) => void;
5
+ /** page = 全屏 SubPage(保留给旧入口);drawer = 右滑抽屉内容(无壳)。 */
6
+ variant?: 'page' | 'drawer';
10
7
  onSettingsTab?: (tab: SettingsTab) => void;
11
8
  onEditorFontSize?: (n: number) => void;
12
9
  onBackground?: (bg: string | undefined, blur: number) => void;
13
- onOpacity?: (n: number) => void;
14
- onEndfieldAccent?: (accent: EndfieldAccent) => void;
10
+ /** 全局显示模式(联动整个面板,NovelPanel 落 localStorage)。 */
11
+ themeMode: 'system' | 'light' | 'dark';
12
+ /** 全局界面密度。 */
13
+ themeDensity: 'comfort' | 'compact' | 'spacious';
14
+ /** 改变全局显示模式。 */
15
+ onChangeThemeMode: (m: 'system' | 'light' | 'dark') => void;
16
+ /** 改变全局界面密度。 */
17
+ onChangeThemeDensity: (d: 'comfort' | 'compact' | 'spacious') => void;
15
18
  }): import("react").JSX.Element;
16
19
  export {};
@@ -1,9 +1,16 @@
1
+ /**
2
+ * 书架首页视图:书卡网格(封面/书名/简介/进度)+ 搜索筛选 + 开书入口。
3
+ * 进入小说工坊默认展示;点击书卡进入该书工作台,+ 进入开书向导页。
4
+ */
5
+ import { type ReactNode } from 'react';
1
6
  import type { NovelApi } from '../api.ts';
2
7
  import type { BookshelfSnapshot } from '../../protocol.ts';
3
8
  /** 书架首页。 */
4
- export declare function ShelfView({ api, shelf, onOpenBook, onReadBook, onAddBook, onImportBook, }: {
9
+ export declare function ShelfView({ api, shelf, onOpenBook, onReadBook, onAddBook, onImportBook, onOpenAdapt, toolbarExtra, }: {
5
10
  api: NovelApi;
6
11
  shelf: BookshelfSnapshot;
12
+ /** 书架工具行右端插槽:组入口按钮由 AuthorHome 下放(创作 / 灵感策划 / 资产)。 */
13
+ toolbarExtra?: ReactNode;
7
14
  /** 点击书卡:激活该书并进入工作台。 */
8
15
  onOpenBook: (id: string) => void;
9
16
  /** 点击「阅读」:激活该书并进入沉浸式阅读页。 */
@@ -12,4 +19,6 @@ export declare function ShelfView({ api, shelf, onOpenBook, onReadBook, onAddBoo
12
19
  onAddBook: () => void;
13
20
  /** 点击「导入」:打开导入弹窗(已有项目目录 / txt/md 全本)。 */
14
21
  onImportBook: () => void;
22
+ /** 点击「改编模式」:进入改编六步向导(入口收在书架页头,与导入并排)。 */
23
+ onOpenAdapt?: () => void;
15
24
  }): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 统一子页骨架(1:1 对齐 demo-subpages.html 的 .subpage / .subpage-head / .subpage-body)。
3
+ *
4
+ * 所有作者级与书内子页都应套这层壳:
5
+ * - head:返回钮(可选)+ 大标题 + meta + 右侧操作区
6
+ * - body:页面内容(内部按 demo 用 .card / .box / .grid / .row 等块)
7
+ * 业务逻辑继续留在各自的 View 组件里,这里只负责「壳」。
8
+ */
9
+ import type { ReactNode } from 'react';
10
+ export declare function SubPage(props: {
11
+ /** 页面大标题(衬线 display 档)。 */
12
+ title: string;
13
+ /** 标题右侧的说明行(如「4 本书 · 当前书《X》」)。 */
14
+ meta?: ReactNode;
15
+ /** 返回钮:作者级返回书架,书内返回总编台。 */
16
+ back?: {
17
+ label: string;
18
+ onClick: () => void;
19
+ };
20
+ /** 页头右侧操作区(主 CTA 放最右)。 */
21
+ actions?: ReactNode;
22
+ /** 主题系统局部模式(透传到根 div 的 data-nf-mode,供设置页等预览明暗)。 */
23
+ dataNfMode?: 'light' | 'dark';
24
+ /** 主题系统局部密度(透传到根 div 的 data-nf-density)。 */
25
+ dataNfDensity?: 'comfort' | 'compact' | 'spacious';
26
+ children: ReactNode;
27
+ }): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** 弹一条 toast。kind: 'done'(翡翠勾)/ 'error'(红叉)/ 'info'(中性)。 */
2
+ export declare function showToast(text: string, kind?: 'done' | 'error' | 'info'): void;
@@ -1,9 +1,15 @@
1
- /**
2
- * 纯展示组件(views):所有状态与事件处理器都留在 NovelPanel,
3
- * 这里只接收 props 渲染。便于单独维护与复用。
4
- */
5
1
  import type { ReactElement } from 'react';
6
2
  import type { AuditIssue, Plotline, PlotlineHealthReport, PlotlinePlan, RoleRecord, RoleStatusCard } from '../../protocol.ts';
3
+ /** 滑轨胶囊导航(B5-5):active 高亮为滑动指示块,随选中项平移。 */
4
+ export declare function SlideNav<T extends string>(props: {
5
+ ariaLabel: string;
6
+ items: ReadonlyArray<{
7
+ id: T;
8
+ label: ReactElement | string;
9
+ }>;
10
+ active: T;
11
+ onSelect: (id: T) => void;
12
+ }): JSX.Element;
7
13
  /** 统计格:状态摘要条 / 资产健康通用。 */
8
14
  export declare function StatCell(props: {
9
15
  label: string;
@@ -54,24 +60,36 @@ export declare function RoleCard(props: {
54
60
  onEdit: () => void;
55
61
  onRemove: () => void;
56
62
  }): ReactElement;
57
- /** 🩺 剧情健康检查报告面板。 */
63
+ /** 剧情健康检查报告面板。 */
58
64
  export declare function PlotlineHealthPanel(props: {
59
65
  report: PlotlineHealthReport;
60
66
  disabled: boolean;
61
67
  onPlan: () => void;
62
68
  onClose: () => void;
63
69
  }): ReactElement;
64
- /** ✨ AI 剧情方案面板。 */
70
+ /** 剧情方案面板。 */
65
71
  export declare function PlotlinePlanPanel(props: {
66
72
  plan: PlotlinePlan;
67
73
  disabled: boolean;
68
74
  onAdopt: (suggestion: Plotline) => void;
69
75
  onClose: () => void;
70
76
  }): ReactElement;
71
- /** ✨ AI 建议剧情线面板。 */
77
+ /** 建议剧情线面板。 */
72
78
  export declare function PlotlineSuggestionPanel(props: {
73
79
  suggestions: Plotline[];
74
80
  disabled: boolean;
75
81
  onAdopt: (suggestion: Plotline) => void;
76
82
  onClose: () => void;
77
83
  }): ReactElement;
84
+ /** 空状态基元:图标 + 标题 + 可选提示。compact 变体用于列表/卡片内嵌场景。 */
85
+ export declare function EmptyState(props: {
86
+ icon?: string;
87
+ title: string;
88
+ hint?: string;
89
+ compact?: boolean;
90
+ }): ReactElement;
91
+ /** 骨架屏基元:rows 条微光占位行;widths 指定各行宽度档位,循环取用。 */
92
+ export declare function SkeletonLines(props: {
93
+ rows?: number;
94
+ widths?: Array<'full' | 'wide' | 'half'>;
95
+ }): ReactElement;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * docx 文本提取共享核心:服务端(src/docx.ts)与浏览器端(src/client/docx.ts)
3
+ * 共用 XML → 纯文本的解析逻辑,避免两份实现漂移。
4
+ * zip 解压入口因运行时不同(fflate vs fflate/browser,浏览器端必须走 browser
5
+ * 入口以避开 node:module 的 require 探测)留在两端各自处理。
6
+ */
7
+ /** 解码 docx 正文实际会用到的少量 XML 实体。 */
8
+ export declare function decodeEntities(text: string): string;
9
+ /**
10
+ * 从 word/document.xml 的 XML 字符串提取纯文本:每个 <w:p> 段落一行,
11
+ * <w:tab>/<w:br> 保留为空白符;表格与嵌套结构按文档顺序拍平
12
+ * (它们的段落同样是 <w:p>)。
13
+ * @param xml - document.xml 解码后的字符串。
14
+ * @returns 正文文本(空文本时抛错)。
15
+ */
16
+ export declare function extractDocxTextFromXml(xml: string): string;
@@ -2,11 +2,10 @@
2
2
  * docx outline extraction: a .docx is a zip whose word/document.xml holds the
3
3
  * body text in <w:t> runs inside <w:p> paragraphs. We unzip with fflate and
4
4
  * walk the XML with a tiny tokenizer — no heavyweight XML/DOM dependency.
5
+ * XML 解析共享核心在 ./docx-core.ts(与浏览器端同源)。
5
6
  */
6
7
  /**
7
- * Extract plain text from a docx buffer: one line per <w:p> paragraph, with
8
- * <w:tab>/<w:br> preserved as whitespace. Tables and nested structures are
9
- * flattened in document order (their paragraphs are just <w:p> too).
8
+ * Extract plain text from a docx buffer: one line per <w:p> paragraph.
10
9
  * @param buffer - the raw .docx bytes.
11
10
  * @returns the body text.
12
11
  */
@@ -63,13 +63,13 @@ export declare function reviewChapterText(ctx: Context, config: NovelConfig, pro
63
63
  export declare function authorReviewChapter(ctx: Context, config: NovelConfig, project: ProjectState, chapterNo: number, body: string, prevTail: string): Promise<AuthorReview>;
64
64
  /** 复盘后自动关联:把本章号写入复盘标记推进的剧情线(按名称匹配,去重)。 */
65
65
  export declare function autoLinkPlotlines(project: ProjectState, chapterNo: number, advancedLines: string[]): void;
66
- /** AI 建议剧情线:基于大纲/卷计划/已写章节/编年录,提炼候选线。 */
66
+ /** 建议剧情线:基于大纲/卷计划/已写章节/编年录,提炼候选线。 */
67
67
  export declare function suggestPlotlines(ctx: Context, config: NovelConfig, project: ProjectState): Promise<Plotline[]>;
68
- /** AI 刷新单条剧情线的进度:结合编年录与各章摘要分析该线推进到哪。 */
68
+ /** 刷新单条剧情线的进度:结合编年录与各章摘要分析该线推进到哪。 */
69
69
  export declare function refreshPlotlineProgress(ctx: Context, config: NovelConfig, project: ProjectState, line: Plotline): Promise<string>;
70
- /** ✨ AI 从全书提炼角色库:大纲 + 道藏 + 编年录 + 章节摘要 → 结构化角色清单。 */
70
+ /** AI 从全书提炼角色库:大纲 + 道藏 + 编年录 + 章节摘要 → 结构化角色清单。 */
71
71
  export declare function extractRoles(ctx: Context, config: NovelConfig, project: ProjectState): Promise<RoleRecord[]>;
72
- /** ✨ AI 从全书提炼场景库:正文/编年录 → 高频重要场景的结构化视觉锚点。 */
72
+ /** AI 从全书提炼场景库:正文/编年录 → 高频重要场景的结构化视觉锚点。 */
73
73
  export declare function splitBookText(raw: string): Array<{
74
74
  no: number;
75
75
  title: string;
@@ -122,9 +122,9 @@ export declare function removeLlmProvider(ctx: Context, req: RemoveProviderReque
122
122
  * 写入 DSH 凭据 refs,并(必要时)注册/更新 llm-pi-ai provider 路由。
123
123
  */
124
124
  export declare function registerLlmModel(ctx: Context, req: AddModelRequest): Promise<AddModelResponse>;
125
- /** 🩺 剧情健康检查:基于已写章节数/各线状态/编年录,判断是否需要新线及添加时机。 */
125
+ /** 剧情健康检查:基于已写章节数/各线状态/编年录,判断是否需要新线及添加时机。 */
126
126
  export declare function analyzePlotlineHealth(ctx: Context, config: NovelConfig, project: ProjectState): Promise<PlotlineHealthReport>;
127
- /** ✨ AI 剧情方案:基于健康检查结果设计下一阶段方向与建议新线。 */
127
+ /** 剧情方案:基于健康检查结果设计下一阶段方向与建议新线。 */
128
128
  export declare function designPlotlinePlan(ctx: Context, config: NovelConfig, project: ProjectState, health?: PlotlineHealthReport): Promise<PlotlinePlan>;
129
129
  /**
130
130
  * Stream a chapter rewrite. With `target` (a passage of the body), only that
@@ -180,7 +180,7 @@ export declare function reverseOutlineFromChapters(ctx: Context, config: NovelCo
180
180
  */
181
181
  export declare function analyzeAdaptation(ctx: Context, config: NovelConfig, text: string): Promise<AdaptAnalyzeResponse>;
182
182
  /** 改编方案:由用户勾选的维度与新值,生成 LLM 映射表/规则/影响清单。 */
183
- export declare function proposeAdaptation(ctx: Context, config: NovelConfig, text: string, selections: Array<{
183
+ export declare function proposeAdaptation(ctx: Context, config: NovelConfig, _text: string, selections: Array<{
184
184
  key: string;
185
185
  title: string;
186
186
  current: string;
@@ -251,7 +251,7 @@ export declare function markForeshadowPlanted(project: ProjectState, outputDir:
251
251
  export declare function extractFacts(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<number>;
252
252
  /** 全书一致性质检:LLM 分批扫描已生成章节 + 设定 + 事实库,聚合矛盾清单。 */
253
253
  export declare function auditBook(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, onProgress?: (completedBatches: number, totalBatches: number) => void): Promise<AuditIssue[]>;
254
- /** 小说简介:AI 生成或按已写开头补全(面向读者的作品门面)。 */
254
+ /** 小说简介:生成或按已写开头补全(面向读者的作品门面)。 */
255
255
  export declare function generateBlurb(ctx: Context, config: NovelConfig, project: ProjectState, partial?: string): Promise<string>;
256
256
  /**
257
257
  * 组装全书上下文包(AI 助手 book_overview 工具)。
@@ -277,7 +277,7 @@ export interface ImpactItem {
277
277
  export declare function analyzeImpact(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, change: string): Promise<ImpactItem[]>;
278
278
  /** 把大世界结构化数据渲染成提示词块(境界体系按顺序强约束)。 */
279
279
  export declare function renderWorld(world: WorldState | undefined): string;
280
- /** AI 提炼大世界:从大纲 + 道藏生成结构化境界体系/区域/势力。 */
280
+ /** 提炼大世界:从大纲 + 道藏生成结构化境界体系/区域/势力。 */
281
281
  export declare function extractWorld(ctx: Context, config: NovelConfig, project: ProjectState): Promise<WorldState>;
282
282
  /**
283
283
  * 事实库回填:对历史已生成章节批量抽取事实(无事实记录的旧章节)。
@@ -37,7 +37,7 @@ export interface Config {
37
37
  generateModel?: string;
38
38
  /** 任务级模型路由:审稿模型(留空则跟随 model)。 */
39
39
  reviewModel?: string;
40
- /** 任务级模型路由:AI 复核/质检模型(留空则跟随 model)。 */
40
+ /** 任务级模型路由:质检模型(留空则跟随 model)。 */
41
41
  auditModel?: string;
42
42
  /** LLM reasoning effort (off/low/high/max). */
43
43
  reasoningEffort?: 'off' | 'low' | 'high' | 'max';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 输出目录迁移(Migrate Output Dir)— 把一本书/默认输出目录的内容搬到新位置。
3
+ *
4
+ * 安全纪律(数据零丢失排序):
5
+ * 1. copy 全部内容到新目录(源目录始终原样保留);
6
+ * 2. 调用方完成配置写入 / 书架重指向后,最后一步才删源目录;
7
+ * 3. 中途任何失败,最坏情况只是新目录多一份副本,源数据零丢失。
8
+ */
9
+ /** 目录内容清单(相对路径 + 总字节)。 */
10
+ export interface DirContents {
11
+ files: string[];
12
+ bytes: number;
13
+ }
14
+ /** 规范化路径用于比较(统一分隔符,Windows 忽略大小写)。 */
15
+ export declare function normalizeDir(dir: string): string;
16
+ /** 列出目录全部内容(递归;子目录以 `name/` 形式占位列出)。 */
17
+ export declare function listDirContents(dir: string): DirContents;
18
+ /**
19
+ * 把 from 全部内容复制到 to(源目录保留,删除由调用方在收尾执行)。
20
+ * 目标必须不存在或为空目录(防覆盖无关数据);禁止互相嵌套的目录对。
21
+ * @returns 复制的顶层条目数。
22
+ */
23
+ export declare function copyDirContents(from: string, to: string): number;
24
+ /** 删除源目录(仅复制 + 配置/书架重指向全部成功后调用)。 */
25
+ export declare function removeDir(dir: string): void;
@@ -1,29 +1,4 @@
1
- /**
2
- * 官方提示模板注册表(对齐上游 officialTemplates.ts 的轻量版)。
3
- *
4
- * 目标:把高频提示词从内联字符串升级为「可定位、可版本化、可诊断缺组」的资产,
5
- * 同时保留 writeSystemPrompt 的现有大段上下文注入(道藏/世界观/大纲/资产/伏笔/剧情线),
6
- * 只在其基础上补充「官方渲染骨架」的必达/禁止/自查块。
7
- */
8
- export interface OfficialTemplate {
9
- id: string;
10
- version: string;
11
- /** 需要的 slot 变量(跨层注入点)。 */
12
- slots: string[];
13
- /** 需要的上下文分组(缺组时可诊断)。 */
14
- contextGroups: string[];
15
- /** system 提示模板(可用 {{slot.*}} 占位,运行时替换)。 */
16
- system: string[];
17
- /** human 提示模板(可用 {{context.*}} / {{input.*}} 占位)。 */
18
- human: string[];
19
- }
20
- export declare const OFFICIAL_TEMPLATES: Record<string, OfficialTemplate>;
21
- export declare function getOfficialPromptTemplate(id: string): OfficialTemplate | null;
22
- export declare function getOfficialPromptTemplateVersion(id: string): string | null;
23
- /** 轻量稳定哈希(与上游 sha1 对齐精神:内容变化→版本变化)。 */
24
- export declare function hashPromptTemplate(id: string): string;
25
- export declare function getRequiredTemplateContextGroups(id: string): string[];
26
- /** 把官方 writer 骨架渲染成可附加到现有系统提示词末尾的约束/自查块。 */
1
+ /** 章节写作约束:官方 writer 骨架渲染成可附加到现有系统提示词末尾的必达/禁止/自查块。 */
27
2
  export declare function renderOfficialChapterWriterSkeleton(meta: {
28
3
  targetChars: number;
29
4
  minChars: number;