@waterwx/dsh-novel-forge 1.10.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +287 -281
  2. package/lib/client.js +19572 -18127
  3. package/lib/index.js +12171 -6932
  4. package/lib/types/action-guard.d.ts +61 -0
  5. package/lib/types/ai-scan.d.ts +30 -0
  6. package/lib/types/assets.d.ts +20 -9
  7. package/lib/types/assistant.d.ts +29 -0
  8. package/lib/types/author-assets.d.ts +1 -3
  9. package/lib/types/bookshelf.d.ts +13 -3
  10. package/lib/types/client/api.d.ts +137 -21
  11. package/lib/types/client/chip-prefs.d.ts +36 -0
  12. package/lib/types/client/docx.d.ts +2 -2
  13. package/lib/types/client/index.d.ts +1 -1
  14. package/lib/types/client/llmLive.d.ts +31 -0
  15. package/lib/types/client/locales.d.ts +15 -70
  16. package/lib/types/client/mount.d.ts +0 -2
  17. package/lib/types/client/panel/AiTag.d.ts +1 -0
  18. package/lib/types/client/panel/AssistantTab.d.ts +4 -1
  19. package/lib/types/client/panel/AuthorHome.d.ts +13 -9
  20. package/lib/types/client/panel/BookAnalysisView.d.ts +4 -0
  21. package/lib/types/client/panel/CmdPalette.d.ts +12 -0
  22. package/lib/types/client/panel/CreateBookView.d.ts +5 -1
  23. package/lib/types/client/panel/DirectorView.d.ts +7 -0
  24. package/lib/types/client/panel/IdeaInspirationView.d.ts +6 -0
  25. package/lib/types/client/panel/KnowledgeBaseView.d.ts +4 -0
  26. package/lib/types/client/panel/LiveFeedLog.d.ts +13 -0
  27. package/lib/types/client/panel/MarketRadarView.d.ts +5 -0
  28. package/lib/types/client/panel/ModelManager.d.ts +2 -2
  29. package/lib/types/client/panel/NovelPanel.d.ts +6 -1
  30. package/lib/types/client/panel/PageHeader.d.ts +18 -0
  31. package/lib/types/client/panel/PromptSlotsView.d.ts +11 -0
  32. package/lib/types/client/panel/SettingsView.d.ts +12 -7
  33. package/lib/types/client/panel/ShelfView.d.ts +10 -1
  34. package/lib/types/client/panel/SubPage.d.ts +27 -0
  35. package/lib/types/client/panel/TensionView.d.ts +18 -0
  36. package/lib/types/client/panel/TimelineView.d.ts +18 -0
  37. package/lib/types/client/panel/helpers.d.ts +5 -3
  38. package/lib/types/client/panel/market-radar-state.d.ts +56 -0
  39. package/lib/types/client/panel/toast.d.ts +2 -0
  40. package/lib/types/client/panel/views.d.ts +21 -35
  41. package/lib/types/client/run-status.d.ts +21 -0
  42. package/lib/types/client/sidebar-entry.d.ts +0 -2
  43. package/lib/types/docx-core.d.ts +16 -0
  44. package/lib/types/docx.d.ts +2 -3
  45. package/lib/types/engine.d.ts +83 -79
  46. package/lib/types/global-assets.d.ts +6 -0
  47. package/lib/types/home.d.ts +11 -0
  48. package/lib/types/index.d.ts +27 -13
  49. package/lib/types/llm-live.d.ts +70 -0
  50. package/lib/types/llm-retry.d.ts +38 -0
  51. package/lib/types/market-radar-scan.d.ts +18 -0
  52. package/lib/types/market-radar-sources.d.ts +31 -0
  53. package/lib/types/migrate-output.d.ts +25 -0
  54. package/lib/types/model-capability.d.ts +93 -0
  55. package/lib/types/novel-context.d.ts +80 -0
  56. package/lib/types/output-budget.d.ts +86 -0
  57. package/lib/types/prompt-slots.d.ts +57 -0
  58. package/lib/types/prompting.d.ts +10 -0
  59. package/lib/types/protocol.d.ts +829 -522
  60. package/lib/types/revision.d.ts +76 -0
  61. package/lib/types/routes.d.ts +9 -3
  62. package/lib/types/run.d.ts +23 -1
  63. package/lib/types/settings-persist.d.ts +59 -0
  64. package/lib/types/snapshots.d.ts +46 -0
  65. package/lib/types/stage-contract.d.ts +58 -0
  66. package/lib/types/tension.d.ts +53 -0
  67. package/lib/types/timeline.d.ts +37 -0
  68. package/package.json +50 -28
  69. package/src/action-guard.ts +127 -0
  70. package/src/ai-scan.ts +155 -0
  71. package/src/assets.ts +1801 -535
  72. package/src/assistant.ts +1098 -770
  73. package/src/author-assets.ts +131 -147
  74. package/src/bookshelf.ts +193 -167
  75. package/src/client/api.ts +767 -607
  76. package/src/client/chip-prefs.ts +121 -0
  77. package/src/client/docx.ts +32 -69
  78. package/src/client/index.ts +3 -1
  79. package/src/client/llmLive.ts +111 -0
  80. package/src/client/locales.ts +15 -274
  81. package/src/client/mount.tsx +4 -3
  82. package/src/client/panel/AdaptModeView.tsx +535 -520
  83. package/src/client/panel/AiTag.tsx +7 -0
  84. package/src/client/panel/AssetsTab.tsx +448 -458
  85. package/src/client/panel/AssistantTab.tsx +355 -301
  86. package/src/client/panel/AuthorAssetsView.tsx +205 -207
  87. package/src/client/panel/AuthorHome.tsx +309 -202
  88. package/src/client/panel/BookAnalysisView.tsx +63 -0
  89. package/src/client/panel/CmdPalette.tsx +102 -0
  90. package/src/client/panel/CreateBookView.tsx +366 -352
  91. package/src/client/panel/DirectorView.tsx +200 -0
  92. package/src/client/panel/GlobalAssetLibraryView.tsx +168 -172
  93. package/src/client/panel/IdeaInspirationView.tsx +76 -0
  94. package/src/client/panel/ImportModal.tsx +302 -302
  95. package/src/client/panel/KnowledgeBaseView.tsx +125 -0
  96. package/src/client/panel/LiveFeedLog.tsx +204 -0
  97. package/src/client/panel/MarketRadarView.tsx +415 -0
  98. package/src/client/panel/ModelManager.tsx +205 -205
  99. package/src/client/panel/NovelPanel.tsx +5559 -4655
  100. package/src/client/panel/PageHeader.tsx +37 -0
  101. package/src/client/panel/ProgressConsole.tsx +63 -64
  102. package/src/client/panel/PromptSlotsView.tsx +97 -0
  103. package/src/client/panel/ReaderView.tsx +306 -306
  104. package/src/client/panel/RunPanel.tsx +56 -24
  105. package/src/client/panel/SettingsView.tsx +175 -112
  106. package/src/client/panel/ShelfView.tsx +63 -39
  107. package/src/client/panel/SubPage.tsx +42 -0
  108. package/src/client/panel/TensionView.tsx +212 -0
  109. package/src/client/panel/TimelineView.tsx +208 -0
  110. package/src/client/panel/WorldTab.tsx +202 -202
  111. package/src/client/panel/helpers.ts +7 -5
  112. package/src/client/panel/market-radar-state.ts +79 -0
  113. package/src/client/panel/panel.module.css +5767 -4199
  114. package/src/client/panel/toast.ts +51 -0
  115. package/src/client/panel/views.tsx +316 -314
  116. package/src/client/run-status.ts +171 -0
  117. package/src/client/sidebar-entry.ts +3 -3
  118. package/src/docx-core.ts +53 -0
  119. package/src/docx.ts +44 -83
  120. package/src/engine.ts +1610 -1541
  121. package/src/global-assets.ts +58 -0
  122. package/src/home.ts +33 -0
  123. package/src/index.ts +184 -103
  124. package/src/llm-live.ts +245 -0
  125. package/src/llm-retry.ts +77 -0
  126. package/src/market-radar-scan.ts +35 -0
  127. package/src/market-radar-sources.ts +173 -0
  128. package/src/migrate-output.ts +76 -0
  129. package/src/model-capability.ts +215 -0
  130. package/src/novel-context.ts +286 -0
  131. package/src/output-budget.ts +147 -0
  132. package/src/prompt-slots.ts +125 -0
  133. package/src/prompting.ts +26 -0
  134. package/src/protocol.ts +2454 -2148
  135. package/src/revision.ts +283 -0
  136. package/src/routes.ts +3795 -3359
  137. package/src/run.ts +113 -17
  138. package/src/settings-persist.ts +114 -0
  139. package/src/snapshots.ts +174 -0
  140. package/src/stage-contract.ts +186 -0
  141. package/src/tension.ts +251 -0
  142. package/src/timeline.ts +159 -0
  143. package/assets/styles/arcane-thick-3d.webp +0 -0
  144. package/assets/styles/chinese-ink.webp +0 -0
  145. package/assets/styles/clay-stopmotion-3d.webp +0 -0
  146. package/assets/styles/dark-ghibli.webp +0 -0
  147. package/assets/styles/dark-gothic-3d.webp +0 -0
  148. package/assets/styles/film-photo.webp +0 -0
  149. package/assets/styles/guofeng-heavy.webp +0 -0
  150. package/assets/styles/horror-game-3d.webp +0 -0
  151. package/assets/styles/japan-cel-dark.webp +0 -0
  152. package/assets/styles/korean-webtoon.webp +0 -0
  153. package/assets/styles/low-cyberpunk-3d.webp +0 -0
  154. package/assets/styles/nextgen-cg.webp +0 -0
  155. package/assets/styles/noir-film.webp +0 -0
  156. package/assets/styles/openworld-survival.webp +0 -0
  157. package/assets/styles/paper-cut-3d.webp +0 -0
  158. package/assets/styles/pixar-adult-3d.webp +0 -0
  159. package/assets/styles/pop-marvel-2d.webp +0 -0
  160. package/assets/styles/shinkai-anime.webp +0 -0
  161. package/assets/styles/tactical-stealth.webp +0 -0
  162. package/assets/styles/vaporwave-3d.webp +0 -0
  163. package/assets/styles/vhs90.webp +0 -0
  164. package/lib/types/client/panel/BookshelfBar.d.ts +0 -11
  165. package/lib/types/client/panel/FlowGuide.d.ts +0 -21
  166. package/lib/types/client/panel/MangaRoleLibrary.d.ts +0 -18
  167. package/lib/types/client/panel/MangaWorkspace.d.ts +0 -15
  168. package/lib/types/client/panel/ModelPicker.d.ts +0 -11
  169. package/lib/types/client/panel/ProgressHomeView.d.ts +0 -5
  170. package/lib/types/client/panel/SceneLibrary.d.ts +0 -14
  171. package/lib/types/client/panel/StoryboardTab.d.ts +0 -19
  172. package/lib/types/client/panel/StyleCard.d.ts +0 -8
  173. package/lib/types/client/panel/StyleGallery.d.ts +0 -1
  174. package/lib/types/comic-presets.d.ts +0 -12
  175. package/lib/types/shot-language.d.ts +0 -46
  176. package/lib/types/story-beat-language.d.ts +0 -35
  177. package/lib/types/style-library.d.ts +0 -33
  178. package/skills/chapter-batch/SKILL.md +0 -81
  179. package/src/client/mount.tsx._new +0 -97
  180. package/src/client/mount.tsx._nf +0 -97
  181. package/src/client/mount.tsx._tmp +0 -97
  182. package/src/client/panel/BookshelfBar.tsx +0 -170
  183. package/src/client/panel/FlowGuide.tsx +0 -83
  184. package/src/client/panel/MangaRoleLibrary.tsx +0 -810
  185. package/src/client/panel/MangaWorkspace.tsx +0 -359
  186. package/src/client/panel/ProgressHomeView.tsx +0 -87
  187. package/src/client/panel/SceneLibrary.tsx +0 -396
  188. package/src/client/panel/StoryboardTab.tsx +0 -466
  189. package/src/client/panel/StyleCard.tsx +0 -90
  190. package/src/client/panel/StyleGallery.tsx +0 -58
  191. package/src/comic-presets.ts +0 -67
  192. package/src/shot-language.ts +0 -181
  193. package/src/story-beat-language.ts +0 -130
  194. package/src/style-library.ts +0 -78
@@ -1,170 +0,0 @@
1
- /**
2
- * 书架条:显示所有书,点击切换当前书(继续编译),+ 新建。
3
- * 新建 = 开书向导:书名 + 大纲(拖拽/选择 docx 或粘贴文本),创建即建项目。
4
- */
5
- import { useRef, useState } from 'react'
6
- import type { NovelApi } from '../api.ts'
7
- import { extractDocxTextFromBuffer } from '../docx.ts'
8
- import type { BookshelfSnapshot } from '../../protocol.ts'
9
- import css from './panel.module.css'
10
-
11
- /** Props. */
12
- export interface BookshelfBarProps {
13
- api: NovelApi
14
- shelf: BookshelfSnapshot
15
- /** 刷新整个面板(切换书后重新拉状态)。 */
16
- onSwitch: () => void
17
- }
18
-
19
- /** 书架条。 */
20
- export function BookshelfBar({ api, shelf, onSwitch }: BookshelfBarProps) {
21
- const [creating, setCreating] = useState(false)
22
- const [name, setName] = useState('')
23
- const [outlineText, setOutlineText] = useState('')
24
- const [outlineName, setOutlineName] = useState('')
25
- const [busy, setBusy] = useState(false)
26
- const [error, setError] = useState('')
27
- const outlineFileRef = useRef<HTMLInputElement | null>(null)
28
-
29
- const handlePickOutlineFile = async (file: File | undefined): Promise<void> => {
30
- if (file === undefined) return
31
- try {
32
- const buffer = await file.arrayBuffer()
33
- const text = extractDocxTextFromBuffer(buffer)
34
- if (text.length < 50) {
35
- setError('大纲内容过短(<50 字符),请检查文件')
36
- return
37
- }
38
- setOutlineText(text)
39
- setOutlineName(file.name)
40
- setError('')
41
- } catch (err) {
42
- setError(`读取大纲失败:${(err as Error).message}`)
43
- }
44
- }
45
-
46
- const handleCreate = async (): Promise<void> => {
47
- const bookName = name.trim()
48
- if (bookName === '') return
49
- setBusy(true)
50
- setError('')
51
- try {
52
- await api.bookCreate(bookName, undefined, outlineText.trim() !== '' ? outlineText.trim() : undefined)
53
- setCreating(false)
54
- setName('')
55
- setOutlineText('')
56
- setOutlineName('')
57
- onSwitch()
58
- } catch (err) {
59
- setError((err as Error).message)
60
- } finally {
61
- setBusy(false)
62
- }
63
- }
64
-
65
- const handleActivate = async (id: string): Promise<void> => {
66
- if (id === shelf.activeBookId) return
67
- setBusy(true)
68
- try {
69
- await api.bookActivate(id)
70
- onSwitch()
71
- } catch (err) {
72
- setError((err as Error).message)
73
- } finally {
74
- setBusy(false)
75
- }
76
- }
77
-
78
- const handleRemove = async (id: string): Promise<void> => {
79
- setBusy(true)
80
- try {
81
- await api.bookRemove(id)
82
- onSwitch()
83
- } catch (err) {
84
- setError((err as Error).message)
85
- } finally {
86
- setBusy(false)
87
- }
88
- }
89
-
90
- return (
91
- <div className={css.bookshelf}>
92
- <span className={css.bookshelfLabel}>书架</span>
93
- <div className={css.bookshelfList}>
94
- {shelf.books.map(book => (
95
- <div
96
- key={book.id}
97
- className={`${css.bookChip} ${book.id === shelf.activeBookId ? css.bookChipActive : ''}`}
98
- onClick={() => { void handleActivate(book.id) }}
99
- title={book.outputDir}
100
- >
101
- <span className={css.bookChipName}>{book.bookName}</span>
102
- <span className={css.bookChipMeta}>{book.hasProject ? `${book.done}/${book.total} 章` : '未开书'}</span>
103
- <button
104
- type="button"
105
- className={css.bookChipRemove}
106
- title="从书架移除"
107
- onClick={(e) => { e.stopPropagation(); void handleRemove(book.id) }}
108
- >
109
- ×
110
- </button>
111
- </div>
112
- ))}
113
- {!creating ? (
114
- <button type="button" className={css.bookAdd} onClick={() => { setCreating(true) }}>
115
- + 新书
116
- </button>
117
- ) : (
118
- <div className={css.bookCreateForm}>
119
- <input
120
- className={css.input}
121
- style={{ width: 140 }}
122
- placeholder="书名"
123
- value={name}
124
- onChange={e => { setName(e.target.value) }}
125
- onKeyDown={e => { if (e.key === 'Enter') void handleCreate() }}
126
- autoFocus
127
- />
128
- {/* 开书向导:大纲(可选,推荐) */}
129
- <div className={css.bookCreateOutline}>
130
- <button
131
- type="button"
132
- className={`${css.button} ${css.buttonSmall}`}
133
- onClick={() => { outlineFileRef.current?.click() }}
134
- >
135
- {outlineName !== '' ? `✓ ${outlineName}` : '📄 选择大纲 docx'}
136
- </button>
137
- <input
138
- ref={outlineFileRef}
139
- type="file"
140
- accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
141
- style={{ display: 'none' }}
142
- onChange={e => {
143
- void handlePickOutlineFile(e.target.files?.[0])
144
- e.target.value = ''
145
- }}
146
- />
147
- <textarea
148
- className={css.input}
149
- style={{ width: 280, minHeight: 64, resize: 'vertical' }}
150
- placeholder="或直接粘贴大纲文本(提供大纲后开书即建立项目,书名自动从大纲首行识别)"
151
- value={outlineText}
152
- onChange={e => { setOutlineText(e.target.value) }}
153
- />
154
- </div>
155
- <div className={css.row}>
156
- <button type="button" className={`${css.button} ${css.buttonSmall} ${css.buttonPrimary}`} disabled={busy || name.trim() === ''} onClick={() => { void handleCreate() }}>
157
- 开书
158
- </button>
159
- <button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => { setCreating(false) }}>
160
- 取消
161
- </button>
162
- <span className={css.meta}>{outlineText.length > 0 ? `大纲 ${outlineText.length} 字` : '未提供大纲(稍后在大纲页导入)'}</span>
163
- </div>
164
- </div>
165
- )}
166
- </div>
167
- {error !== '' && <span style={{ color: 'var(--nf-error)', fontSize: 'var(--nf-fs-12)' }}>{error}</span>}
168
- </div>
169
- )
170
- }
@@ -1,83 +0,0 @@
1
- /**
2
- * 漫剧工作台·全流程步骤条(唯一导航,方案X):
3
- * ①创建方案 → ②视觉规则 → ③剧情骨架 → ④分镜表 → ⑤导入角色 → ⑥角色定妆 → ⑦视频提示词 → ⑧场景库 → ⑨导出使用。
4
- * 每个步骤对应一个独立页面主体;完成度自动判定(读 project 现有字段)。
5
- */
6
- import type { ProjectState } from '../../protocol.ts'
7
- import css from './panel.module.css'
8
-
9
- /** 步骤 → 页面主体的一一对应目标。 */
10
- export type FlowTarget =
11
- | 'plan' // ① 创建方案页
12
- | 'rules' // ② 视觉规则页
13
- | 'skeleton' // ③ 剧情骨架页(分镜·骨架)
14
- | 'table' // ④ 分镜表页(分镜·分镜表)
15
- | 'import' // ⑤ 导入角色页(角色·导入)
16
- | 'makeup' // ⑥ 角色定妆页(角色·卡片)
17
- | 'prompts' // ⑦ 视频提示词页(分镜·提示词)
18
- | 'scenes' // ⑧ 场景库页
19
- | 'export' // ⑨ 导出使用页
20
-
21
- export interface FlowStep {
22
- no: number
23
- label: string
24
- hint: string
25
- done: boolean
26
- target: FlowTarget
27
- }
28
-
29
- /** 依据 project 数据计算 9 步完成度(与存储顺序无关,按生产顺序排列)。 */
30
- export function computeFlowSteps(project: ProjectState | null): FlowStep[] {
31
- const plans = project?.mangaPlans ?? []
32
- const rules = project?.visualRules ?? []
33
- const sbs = project?.storyboards ?? []
34
- const manga = project?.mangaRoles ?? []
35
- const scenes = project?.scenes ?? []
36
- const hasSkeleton = sbs.some(e => e.skeleton !== undefined)
37
- const hasTable = sbs.some(e => e.table !== undefined)
38
- const hasPrompts = sbs.some(e => (e.prompts ?? []).length > 0)
39
- return [
40
- { no: 1, label: '创建方案', hint: '选基底风格+可选滤镜并命名;此后所有提示词按此风格生成', done: plans.length > 0, target: 'plan' },
41
- { no: 2, label: '视觉规则', hint: '从道藏提炼 3-6 条视觉世界观规则,自动注入所有生图/生视频提示词', done: rules.length > 0, target: 'rules' },
42
- { no: 3, label: '剧情骨架', hint: '分镜①:本章弧线+节拍链+出场角色(characters 提名地基)', done: hasSkeleton, target: 'skeleton' },
43
- { no: 4, label: '分镜表', hint: '分镜②:骨架展开为镜头级画面(景别/机位/台词/每镜头角色)', done: hasTable, target: 'table' },
44
- { no: 5, label: '导入角色', hint: '从本集分镜提名→小说库匹配(规则+LLM 两段式)→导入为漫剧卡', done: manga.length > 0, target: 'import' },
45
- { no: 6, label: '角色定妆', hint: '生成形象锚点→精修提示词→上传/生成定妆图(status=已定妆)', done: manga.some(c => c.status === 'anchored'), target: 'makeup' },
46
- { no: 7, label: '视频提示词', hint: '分镜③:每镜头一段即梦可粘贴提示词,带风格词块与定妆绑定', done: hasPrompts, target: 'prompts' },
47
- { no: 8, label: '场景库', hint: '(选做)从正文提炼场景卡并采纳,分镜表会标注使用场景', done: scenes.length > 0, target: 'scenes' },
48
- { no: 9, label: '导出使用', hint: '复制提示词到即梦/豆包/ComfyUI 出图生视频;定妆卡按 mangaRoleIds 绑定参考图', done: hasPrompts, target: 'export' },
49
- ]
50
- }
51
-
52
- export function FlowGuide({
53
- project,
54
- onNavigate,
55
- }: {
56
- project: ProjectState | null
57
- onNavigate: (target: FlowTarget) => void
58
- }) {
59
- const steps = computeFlowSteps(project)
60
- const doneCount = steps.filter(s => s.done).length
61
- return (
62
- <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--nf-space-6)', marginTop: 'var(--nf-space-8)' }}>
63
- <div className={css.row} style={{ justifyContent: 'space-between', flexWrap: 'wrap' }}>
64
- <span className={css.meta}>🧭 全流程({doneCount}/{steps.length}):每步一个页面,完成自动打勾</span>
65
- <span className={css.meta}>点击步骤打开对应页面</span>
66
- </div>
67
- <div style={{ display: 'flex', flexWrap: 'wrap', gap: 'var(--nf-space-6)' }}>
68
- {steps.map(s => (
69
- <button
70
- key={s.no}
71
- type="button"
72
- title={s.hint}
73
- className={css.button + ' ' + css.buttonSmall + (s.done ? ' ' + css.buttonPrimary : '')}
74
- style={{ minWidth: 0 }}
75
- onClick={() => { onNavigate(s.target) }}
76
- >
77
- {s.done ? '✓ ' : s.no + '. '}{s.label}
78
- </button>
79
- ))}
80
- </div>
81
- </div>
82
- )
83
- }