@waterwx/dsh-novel-forge 1.1.9 → 1.2.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 (125) hide show
  1. package/README.md +231 -349
  2. package/lib/client.js +54772 -10278
  3. package/lib/index.js +12057 -5069
  4. package/lib/types/action-guard.d.ts +61 -0
  5. package/lib/types/ai-scan.d.ts +36 -0
  6. package/lib/types/assets.d.ts +18 -3
  7. package/lib/types/assistant.d.ts +29 -0
  8. package/lib/types/author-assets.d.ts +25 -0
  9. package/lib/types/bookshelf.d.ts +11 -1
  10. package/lib/types/client/api.d.ts +147 -9
  11. package/lib/types/client/docx.d.ts +2 -0
  12. package/lib/types/client/index.d.ts +1 -1
  13. package/lib/types/client/llmLive.d.ts +33 -0
  14. package/lib/types/client/locales.d.ts +34 -9
  15. package/lib/types/client/panel/AdaptModeView.d.ts +5 -0
  16. package/lib/types/client/panel/AiTag.d.ts +1 -0
  17. package/lib/types/client/panel/AssistantTab.d.ts +4 -1
  18. package/lib/types/client/panel/AuthorAssetsView.d.ts +4 -0
  19. package/lib/types/client/panel/AuthorHome.d.ts +34 -0
  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/GlobalAssetLibraryView.d.ts +4 -0
  25. package/lib/types/client/panel/IdeaInspirationView.d.ts +6 -0
  26. package/lib/types/client/panel/ImportModal.d.ts +7 -0
  27. package/lib/types/client/panel/KnowledgeBaseView.d.ts +4 -0
  28. package/lib/types/client/panel/LiveFeedLog.d.ts +8 -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/NovelPanel.d.ts +6 -1
  32. package/lib/types/client/panel/PageHeader.d.ts +18 -0
  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/ReasoningSection.d.ts +10 -0
  36. package/lib/types/client/panel/SettingsView.d.ts +19 -0
  37. package/lib/types/client/panel/ShelfView.d.ts +12 -1
  38. package/lib/types/client/panel/SubPage.d.ts +27 -0
  39. package/lib/types/client/panel/toast.d.ts +2 -0
  40. package/lib/types/client/panel/views.d.ts +25 -7
  41. package/lib/types/client/run-status.d.ts +19 -0
  42. package/lib/types/client/text.d.ts +9 -0
  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 +147 -41
  46. package/lib/types/global-assets.d.ts +6 -0
  47. package/lib/types/index.d.ts +20 -2
  48. package/lib/types/llm-live.d.ts +44 -0
  49. package/lib/types/market-radar-scan.d.ts +19 -0
  50. package/lib/types/market-radar-sources.d.ts +31 -0
  51. package/lib/types/migrate-output.d.ts +25 -0
  52. package/lib/types/novel-context.d.ts +80 -0
  53. package/lib/types/prompt-utils.d.ts +35 -0
  54. package/lib/types/prompting.d.ts +10 -0
  55. package/lib/types/protocol.d.ts +1054 -123
  56. package/lib/types/review-policy.d.ts +97 -0
  57. package/lib/types/routes.d.ts +4 -0
  58. package/lib/types/run.d.ts +3 -1
  59. package/lib/types/stage-contract.d.ts +60 -0
  60. package/package.json +51 -27
  61. package/scripts/patch-schemastery.mjs +47 -0
  62. package/src/action-guard.ts +127 -0
  63. package/src/ai-scan.ts +179 -0
  64. package/src/assets.ts +1774 -520
  65. package/src/assistant.ts +1082 -770
  66. package/src/author-assets.ts +149 -0
  67. package/src/bookshelf.ts +187 -151
  68. package/src/client/api.ts +684 -410
  69. package/src/client/docx.ts +37 -69
  70. package/src/client/index.ts +3 -1
  71. package/src/client/llmLive.ts +101 -0
  72. package/src/client/locales.ts +418 -367
  73. package/src/client/mount.tsx +1 -1
  74. package/src/client/panel/AdaptModeView.tsx +535 -0
  75. package/src/client/panel/AiTag.tsx +7 -0
  76. package/src/client/panel/AssetsTab.tsx +448 -439
  77. package/src/client/panel/AssistantTab.tsx +355 -301
  78. package/src/client/panel/AuthorAssetsView.tsx +206 -0
  79. package/src/client/panel/AuthorHome.tsx +309 -0
  80. package/src/client/panel/BookAnalysisView.tsx +63 -0
  81. package/src/client/panel/CmdPalette.tsx +102 -0
  82. package/src/client/panel/CreateBookView.tsx +366 -348
  83. package/src/client/panel/DirectorView.tsx +200 -0
  84. package/src/client/panel/GlobalAssetLibraryView.tsx +168 -0
  85. package/src/client/panel/IdeaInspirationView.tsx +76 -0
  86. package/src/client/panel/ImportModal.tsx +303 -0
  87. package/src/client/panel/KnowledgeBaseView.tsx +125 -0
  88. package/src/client/panel/LiveFeedLog.tsx +67 -0
  89. package/src/client/panel/MarketRadarView.tsx +377 -0
  90. package/src/client/panel/ModelManager.tsx +205 -0
  91. package/src/client/panel/NovelPanel.tsx +5403 -4300
  92. package/src/client/panel/PageHeader.tsx +37 -0
  93. package/src/client/panel/ProgressConsole.tsx +63 -0
  94. package/src/client/panel/ReaderView.tsx +306 -306
  95. package/src/client/panel/ReasoningSection.tsx +31 -0
  96. package/src/client/panel/RunPanel.tsx +223 -204
  97. package/src/client/panel/SettingsView.tsx +305 -0
  98. package/src/client/panel/ShelfView.tsx +266 -235
  99. package/src/client/panel/SubPage.tsx +42 -0
  100. package/src/client/panel/WorldTab.tsx +202 -202
  101. package/src/client/panel/panel.module.css +5764 -2817
  102. package/src/client/panel/toast.ts +51 -0
  103. package/src/client/panel/views.tsx +401 -314
  104. package/src/client/run-status.ts +143 -0
  105. package/src/client/sidebar-entry.ts +1 -1
  106. package/src/client/text.ts +28 -0
  107. package/src/docx-core.ts +53 -0
  108. package/src/docx.ts +44 -83
  109. package/src/engine.ts +4231 -2779
  110. package/src/global-assets.ts +59 -0
  111. package/src/index.ts +311 -246
  112. package/src/llm-live.ts +68 -0
  113. package/src/market-radar-scan.ts +41 -0
  114. package/src/market-radar-sources.ts +173 -0
  115. package/src/migrate-output.ts +76 -0
  116. package/src/novel-context.ts +286 -0
  117. package/src/prompting.ts +26 -0
  118. package/src/protocol.ts +2072 -1156
  119. package/src/review-policy.ts +161 -0
  120. package/src/routes.ts +3405 -2124
  121. package/src/run.ts +342 -330
  122. package/src/stage-contract.ts +189 -0
  123. package/lib/client.js.map +0 -1
  124. package/lib/index.js.map +0 -1
  125. package/src/client/panel/BookshelfBar.tsx +0 -170
package/README.md CHANGED
@@ -1,349 +1,231 @@
1
- # dsh-novel-forge — AI 编译小说工作台 / AI Novel Writing Workbench
2
-
3
- **中文** | [English](#english)
4
-
5
- 你的专属 AI 小说写作插件:把一份大纲"编译"成一本完整的小说。
6
- Your personal AI novel-writing plugin for DSH: turn an outline into a complete novel.
7
-
8
- ---
9
-
10
- ## 功能一览 / Features
11
-
12
- | 中文 | English |
13
- |---|---|
14
- | **创作工作流仪表盘**:主行动卡(推荐下一步)+ 创作旅程进度条 + 状态条 + 待办队列 + 资产健康 | **Workflow dashboard**: next-action hero card, journey progress bar, status strip, todo queue, asset health |
15
- | **书架首页**:书卡网格(封面/简介/进度)+ 开书向导独立页,进入工坊先选书 | **Bookshelf home**: book card grid with covers, blurbs and progress, plus a dedicated book-wizard page |
16
- | **正文编辑 + AI 审查 + 保存**:章节工作区直接改文,审查草稿不落盘,保存即审稿(沿用报告不重复审) | **Edit → AI check → save**: edit chapter text, review the draft without persisting, save-with-review reuses the report |
17
- | **按意见修订**:审稿未通过时一键按意见自动修订(指令自动预填 high 优先问题) | **Revise by review**: one click to revise with the review feedback pre-filled |
18
- | **国风模块**:总纲 / 道藏 / 大世界 / 人物志 / 暗线 / 编年录 / 文戒 / 笔法帖 / 心法 | **Wuxia-flavored modules**: outline, story bible, world, characters, foreshadows, fact ledger, anti-AI rules, style templates, custom style |
19
- | **规模化加固**:上下文分片、相关事实注入、质检/影响分析分批、status 瘦身、按卷折叠、token 优化(摘要+事实合并省 25%) | **Scale hardening**: sharded contexts, related-fact injection, batched audit/impact, slim status, volume folding, token optimizations |
20
- | **开书向导**:书架新建书时直接导入大纲(docx/粘贴),开书即建项目,书名自动识别 | **Book wizard**: create a book with its outline in one step — project is built immediately |
21
- | **大纲只读化**:开书后大纲页只读展示;「更新大纲」可选仅改文本(保留进度)或重置项目重来 | **Read-only outline**: after opening a book the outline is read-only; update offers keep-progress or full reset |
22
- | **章节计划结构化**:每章含 本章目标 / 剧情要点 / 爽点·钩子 / 结尾钩子 | **Structured chapter beats**: goal / plot points / payoff-hook / ending hook per chapter |
23
- | **章节计划续写模式**:已有章节时自动续写规划(上一章结尾原文 + 编年录锚点 + 已发生情节禁令),不再重头生成;追加自动去重 | **Continuation planning**: with existing chapters the planner continues from the last chapter's ending (tail text + fact anchors + banned-repeat list), never restarts; duplicate titles are dropped on append |
24
- | **事实库 / 时间线**:每章自动抽取已确立事实,注入后续生成,保证长期一致 | **Fact ledger**: auto-extracted per-chapter facts injected into later chapters for consistency |
25
- | **全书一致性质检**:LLM 扫描全本,输出矛盾清单(定位到章),一键去修订 | **Book audit**: LLM scans all chapters for contradictions, locates them, one-click to revise |
26
- | **角色卡**:出场统计精确计算 + LLM 聚合当前状态,历史章节可回填事实库 | **Character cards**: precise appearance stats + LLM-aggregated status; backfill for old chapters |
27
- | **润色/修订工作区**:左栏原文(选中即局部修订)+ 右栏指令/预览/应用,草稿制不覆盖原稿,自动备份 .bak | **Revision workspace**: editable original + selection-targeted local edits, draft-apply flow with auto-backup |
28
- | **章节编辑独立页**:点「编辑」进入独占整页(左导航保留),原文|对比左右各半、原稿新稿并排高亮,默认即对比模式 | **Full-page chapter editor**: opening a chapter takes over the content pane; original vs draft side by side with highlighted changes, diff view by default |
29
- | **审稿问题勾选修复**:审查报告每条问题可勾选,一键按所选问题修订(默认勾 high) | **Selective review fixes**: check any review issues (high pre-checked) and fix them in one click |
30
- | **编辑器字号可调**:设置页 12-24px + 编辑页 A−/A+ 快捷调整(localStorage 记忆) | **Adjustable editor font size**: 12-24px in settings plus A−/A+ in the editor toolbar (localStorage) |
31
- | **AI 助手悬浮窗**:可拖动、可拉大小、位置记忆;「编辑老师」全量知情 + 影响分析 + 步骤卡片 + 思考计时 + 清空聊天 | **Floating AI assistant**: draggable, resizable, position remembered; full-context "editor" persona with impact analysis and live step cards |
32
- | **剧情线管理**:主线/支线/人物线/悬念线,目标与进度追踪、章节关联;生成时强制每章推进至少一条活跃线,工作台实时进度 | **Plotline management**: main/branch/character/mystery arcs with goals, progress and linked chapters; generation must advance an active arc, live progress on the workbench |
33
- | **AI 剧情规划**:健康检查(是否需要新线/多少章后加/各线健康度)+ 一键设计剧情方案(下一阶段方向 + 建议新线可采纳)+ 单线 AI 刷新进度 | **AI plotline planning**: health check (need new arcs? when?) + one-click design plan (next-stage direction + adoptable arcs) + per-arc progress refresh |
34
- | **角色库**:独立页签——AI 从全书提炼角色(自动分级主角/女主/女配/配角/反派/路人)、候选逐条采纳、定位/关系网/成长线/知情度编辑;生成时按定位规格刻画互动 | **Role library**: dedicated tab — AI extracts all characters with auto-tiering (protagonist/female lead/female support/support/antagonist/extra), adopt per candidate, edit identity/relations/arc/knowledge; generation follows the role tier |
35
- | **人物志持久化**:角色当前状态(编年录聚合)落盘存档,打开即显示;状态卡带「查看档案」跳转角色库 | **Persistent character status**: aggregated status from the chronicle is saved to disk and shown on open; each card links to the role library |
36
- | **作者复盘**:每章自动复盘(钩子兑现/结尾钩子强度/剧情线推进/连续性/节奏趋势),按卷分组的复盘记录页,复盘自动关联推进的剧情线 | **Author review**: per-chapter structural review (hook payoff / ending hook / arc progress / continuity / pacing), volume-grouped records page, auto-links advanced arcs |
37
- | **工作进度悬浮窗**:工具组入口,可拖拽/缩放/位置记忆;当前任务大进度条 + 全量活动记录,任务开始自动弹出 | **Floating progress console**: draggable/resizable window from the tools nav with live task progress bar + full activity log, auto-opens on task start |
38
- | **角色知情度**:每个角色"已知信息"清单,生成与审稿严格维护信息差(未列出的信息角色一律不知道) | **Character knowledge**: per-character known-info lists; writing & review enforce information asymmetry strictly |
39
- | **助手写操作守卫**:AI 助手只在作者明确指令下执行写操作(生成/修订/删除),随口提问不会误触发生成章节 | **Assistant write guard**: the AI assistant only performs write actions (generate/revise/delete) on explicit author instruction — casual questions can never trigger chapter generation |
40
- | **相关事实全量检索**:生成时按本章剧情要点对全量编年录检索(角色名加权 + 近因加权 + 去重),长篇连载旧设定不因窗口滑出而丢失 | **Full-ledger fact retrieval**: chapter generation retrieves relevant facts across the entire chronicle (character-name + recency weighting, dedup) — old settings survive in long serials |
41
- | **并发安全保存**:计划/生成/审稿落盘前自动合并磁盘最新设定(道藏/角色库/剧情线/知情度),多窗口操作互不覆盖 | **Concurrency-safe saves**: plan/generate/review merge the latest on-disk settings (bible/roles/plotlines/knowledge) before saving — parallel windows never clobber each other |
42
- | **敏感词检查**:内置违禁词库(政治/擦边/暴力/辱骂/广告)全书一键扫描,命中定位到章并一键去修订 | **Sensitive-word check**: built-in banned-word library scans all chapters, hits located per chapter with one-click fix |
43
- | **编年录独立页**:事实库从设置页移入数据库导航,支持一键回填历史章节 | **Chronicle tab**: the fact ledger moved into the database nav with one-click backfill |
44
- | **三套主题**:iOS 液态玻璃(绿)/ 经典毛玻璃(蓝)/ 新拟物双阴影,设置页即时切换(localStorage) | **Three themes**: iOS Liquid Glass (green) / classic frosted (blue) / neumorphism, instant switching in settings |
45
- | **活动输出控制台**:工作流页实时记录生成/审稿/润色/质检等全部活动,自动滚动 + 一键清空 | **Activity console**: dashboard records every action (writing/review/polish/audit), auto-scrolls, one-click clear |
46
- | **iOS 字体统一**:SF Pro + 苹方/冬青黑体/微软雅黑全站统一,编辑区不再等宽 | **iOS font stack**: SF Pro + PingFang/Hiragino/YaHei unified across the panel; editor no longer monospace |
47
- | **分组导航 + 状态角标**:创作/工具/数据库分组,章节待办/伏笔/进度角标 | **Grouped nav + badges**: creation/tools/database groups with live badges |
48
- | **iOS 风格毛玻璃 UI**(浅色/深色) | **iOS-style frosted glass UI** (light/dark) |
49
- | **书架 / 伏笔管理 / 写作资产(题材·推进·写法·反AI规则·自定义引擎)/ 全本导出(TXT/MD)/ 卷首语与封面** | **Bookshelf / foreshadowing / writing assets / full-book export (TXT/MD) / blurb & cover** |
50
-
51
- ## 快速开始 / Quick Start
52
-
53
- ```sh
54
- pnpm install # 安装依赖 / install dependencies
55
- pnpm build # 重新构建 lib/ / rebuild lib/
56
- ```
57
-
58
- 挂载到 dsh web profile / Mount into the dsh web profile:
59
-
60
- ```sh
61
- dsh plugin --profile web add link:"<此目录绝对路径>"
62
- ```
63
-
64
- 或 / or in `~/.dsh/profiles/web/cordis.patch.yml`:
65
-
66
- ```yaml
67
- - insert:
68
- - id: novel-forge
69
- name: '@waterwx/dsh-novel-forge'
70
- ```
71
-
72
- 重启 dsh web 后,侧边栏出现「小说工坊」。
73
- Restart dsh web and the "Novel Forge" entry appears in the sidebar.
74
-
75
- ## 安装方式 / Installation
76
-
77
- ### 从 GitHub 安装 / Install from GitHub
78
-
79
- ```sh
80
- dsh plugin --profile web add github:watersxya/dsh-novel-forge
81
- ```
82
-
83
- > 注意:pnpm ≥10 默认拒绝运行 git 依赖的 `prepare` 构建脚本。首次安装失败时,把 pnpm 提示的包键加入该 profile 的 `pnpm-workspace.yaml`:
84
- > Note: pnpm ≥10 refuses to run `prepare` build scripts of git dependencies by default. On first failure, add the package key pnpm prints to the profile's `pnpm-workspace.yaml`:
85
- >
86
- > ```yaml
87
- > allowBuilds:
88
- > '@waterwx/dsh-novel-forge': true
89
- > ```
90
- >
91
- > 然后重新执行 `add`。只对源码可信的包授权。
92
- > Then re-run `add`. Only allow packages whose source you trust.
93
-
94
- ### 从 npm 安装 / Install from npm(推荐 / recommended)
95
-
96
- ```sh
97
- dsh plugin --profile web add @waterwx/dsh-novel-forge
98
- ```
99
-
100
- npm 分发的是预构建产物,无需任何构建授权。
101
- npm distribution ships prebuilt artifacts — no build authorization needed.
102
-
103
- ### 本地开发 / Local development
104
-
105
- ```sh
106
- pnpm install && pnpm build
107
- dsh plugin --profile web add link:"<本目录绝对路径>"
108
- ```
109
-
110
- ## 工作流程 / Workflow
111
-
112
- 一条主线:**开书 → 立设定 → 排章节 → 逐章编译 → 质检定稿 → 导出**。所有步骤都在侧边栏「小说工坊」面板内完成。
113
-
114
- ```
115
- ① 开书(书架 → 开书向导:粘贴大纲文本 / 导入 docx,书名自动识别)
116
- ↓
117
- ② 立设定(总纲只读 → ✨ 提炼道藏【人设/世界观/金手指规则/写作红线】→ 大世界【境界/区域/势力】→ 写作资产【题材/推进/笔法帖/文戒/心法】)
118
- ↓
119
- ③ 排章节(卷计划 → 章节计划:AI 按大纲生成每章 目标/剧情要点/爽点钩子/结尾钩子;
120
- 已有章节时自动进入「续写模式」——读取上一章结尾原文 + 编年录锚点,不会重头生成)
121
- ↓
122
- ④ 逐章编译(生成正文 3000-4000 字 → 自动抽取摘要 + 编年录事实 → 自动 AI 审稿打分)
123
- ↓
124
- ⑤ 修订循环(审稿未过 → 按意见一键修订 / 工作区选中局部修改 / 润色去 AI 味 → 重审;
125
- 不满意可「✔ 直接通过」行使作者终审权)
126
- ↓
127
- ⑥ 全书定稿(全书质检【矛盾清单】→ 敏感词扫描 → 编年录/剧情线/角色库/复盘定期维护)
128
- ↓
129
- ⑦ 导出(全本 TXT / MD,含卷首语与封面)
130
- ```
131
-
132
- **辅助旁路(任意阶段可用)**:💬 AI 助手悬浮窗(问设定/改文/影响分析)、🧵 剧情线管理(健康检查/设计剧情方案)、👥 角色库(AI 提炼/知情度维护)、📊 工作进度悬浮窗(任务实时进度与活动记录)、书架多书切换。
133
-
134
- **推荐节奏**:先让 ②③ 完整落地(设定越全,章节质量越高);④ 建议逐章或小批生成,便于在 ⑤ 及时修正;长篇小说每写 20-30 章跑一次 ⑥ 全书质检,防止设定漂移。
135
-
136
- ## 目录结构 / Directory Layout
137
-
138
- ```
139
- src/ 插件源码(宿主半 + 浏览器半)/ plugin source (host + browser)
140
- lib/ 构建产物(lib/index.js 宿主 / lib/client.js 浏览器)/ build output
141
- scripts/ 工具脚本 / utility scripts
142
- package.json 包定义(dsh.bundle.patch + dsh.client 声明)/ package definition
143
- cordis.patch.yml profile 挂载补丁 / profile mount patch
144
- tsdown.config.ts 双面打包配置 / dual-face bundling config
145
- ```
146
-
147
- ## 数据位置 / Data Locations
148
-
149
- - 书架 / Bookshelf:`~/.dsh/dsh-novel-forge-bookshelf.json`
150
- - 每本书一个输出目录(含 `novel-project.json` + 各章 Markdown + 润色备份 `.bak.md`)/ each book owns an output directory
151
- - AI 助手对话记录 / assistant log:`<输出目录>/novel-assistant.jsonl`
152
-
153
- ## 相关影响 / Impact & Notes
154
-
155
- 使用本插件会对你的账号、磁盘与 LLM 额度产生以下影响,请知悉:
156
-
157
- - **LLM 额度消耗**:生成/审稿/润色/质检/提炼/复盘等所有 AI 操作都调用 LLM(默认 `deepseek-official / deepseek-v4-flash`)。量级参考:一章 3000-4000 字正文 ≈ 1-2 万 token(含推理);审稿约 2000-3000 token;全书质检与角色提炼更贵(数万 token)。批量操作(如一次生成多章、全书质检、复盘补齐)会连续消耗额度,建议分小批执行。
158
- - **写操作守卫**:AI 助手只在作者**明确要求**时执行写操作(生成/修订/删除章节、改设定等)。你只是提问、查信息时,助手只会回答、不会擅自改文——防止"随口一问"误触发生成。
159
- - **并发安全**:计划/生成/审稿落盘前会自动合并磁盘上的最新设定(道藏/角色库/剧情线/知情度),多窗口同时操作不会互相覆盖。
160
- - **数据落盘**:每本书一个输出目录(默认 `D:\ryan work\harness\novels\<书名>`),正文为 Markdown 文件、项目状态为 `novel-project.json`、助手对话为 `novel-assistant.jsonl`;润色/重写应用草稿前自动生成 `.bak.md` 备份原稿。
161
- - **设置持久化**:面板「设置」页的修改(输出目录/模型/审稿阈值等)写入 `~/.dsh/settings.yaml` 的 `dsh-novel-forge` 段;界面偏好(主题/字号/面板宽度)存在浏览器 localStorage。
162
- - **token 优化**:生成与审稿已做上下文分片、相关事实注入与摘要合并,长篇连载下批量成本约省 25%,但单章仍受模型上下文窗口限制(超长设定会按需检索注入,而非全量塞入)。
163
-
164
- ## 限制 / Limitations
165
-
166
- - 生成消耗 LLM API 额度(默认 deepseek-official / deepseek-v4-flash)/ generation consumes LLM API quota
167
- - 章节质量取决于大纲完整度 / chapter quality depends on outline completeness
168
- - 设置写入 `~/.dsh/settings.yaml` 的 `dsh-novel-forge` 段 / settings persist in `~/.dsh/settings.yaml`
169
-
170
- ---
171
-
172
- <a id="english"></a>
173
-
174
- ## English
175
-
176
- # My Personal AI Novel Forge
177
-
178
- This is the working copy of the `dsh-novel-forge` plugin. All
179
- source code, build artifacts, and configuration are included — install, build,
180
- and mount it any time.
181
-
182
- ## Feature Overview
183
-
184
- - **Workflow dashboard**: next-action hero card with a reason, a 6-stage journey
185
- progress bar, a status strip, a todo queue, and asset health
186
- - **Bookshelf home**: book card grid with covers, blurbs and progress; a
187
- dedicated book-wizard page opens a new book with its outline in one step
188
- - **Edit → AI check → save**: edit chapter text in the workspace, review the
189
- draft without persisting, and save-with-review reuses the report (never
190
- double-review); one-click "revise by review" pre-fills the feedback
191
- - **Wuxia-flavored modules**: 总纲 (outline), 道藏 (story bible), 大世界 (world),
192
- 人物志 (characters), 暗线 (foreshadows), 编年录 (fact ledger), 文戒 (anti-AI
193
- rules), 笔法帖 (style templates), 心法 (custom style)
194
- - **Read-only outline**: after opening a book the outline page is read-only;
195
- "Update outline" offers either keep-progress text update or full project reset
196
- - **Structured chapter beats**: every planned chapter carries goal / plot points /
197
- payoff-hook / ending hook sections
198
- - **Continuation planning**: with existing chapters the planner continues from the
199
- last chapter's ending — it injects the previous chapter's tail text, fact-ledger
200
- anchors and a banned-repeat list (e.g. no re-entering the xu-jing), and trims the
201
- outline to settings-only, so regenerating a plan never restarts the story;
202
- duplicate titles are dropped on append
203
- - **Fact ledger**: each chapter auto-extracts established facts (character state,
204
- resources, relations, foreshadow landings); the latest 20 are injected into
205
- later chapters to keep the long story consistent
206
- - **Book audit**: one click scans all written chapters against the bible, fact
207
- ledger and red lines, reporting located contradictions with one-click revision
208
- - **Character cards**: appearance statistics are computed precisely from the
209
- chapter bodies, status is LLM-aggregated; historical chapters can be backfilled
210
- - **Revision workspace**: editable original on the left (select text for
211
- targeted local edits), instruction + preview + apply/cancel on the right;
212
- drafts never overwrite until applied, and applying auto-backs-up the original
213
- - **Full-page chapter editor**: clicking "Edit" takes over the content pane
214
- (left nav stays); original vs draft side by side 1:1 with highlighted
215
- changes, diff view on by default
216
- - **Selective review fixes**: every review issue gets a checkbox (high issues
217
- pre-checked) and one click fixes exactly the checked ones
218
- - **Adjustable editor font size**: 12-24px in settings plus A−/A+ shortcuts in
219
- the editor toolbar, remembered in localStorage
220
- - **Floating AI assistant**: draggable, resizable, position-remembered dialog
221
- with a full-context "editor" persona, impact analysis, live step cards and
222
- conversation clearing
223
- - **Grouped navigation with live badges**: creation / tools / database groups,
224
- badges for chapter todos, foreshadows and journey progress
225
- - **Scale hardening**: sharded book contexts, related-fact injection, batched
226
- audit/impact analysis, slim status payload, volume folding and token
227
- optimizations (summary+facts merged into one call, ~25% cheaper batches)
228
- - **iOS-style frosted glass UI** with light & dark palettes
229
- - Bookshelf, foreshadowing management, writing assets (genre / progression /
230
- style templates / anti-AI rules / custom style engine), full-book export,
231
- blurb & cover
232
-
233
- ## Getting Started
234
-
235
- ```sh
236
- pnpm install # install dependencies
237
- pnpm build # rebuild lib/
238
- ```
239
-
240
- Mount into the dsh web profile:
241
-
242
- ```sh
243
- dsh plugin --profile web add link:"<absolute path to this directory>"
244
- ```
245
-
246
- Or insert into `~/.dsh/profiles/web/cordis.patch.yml`:
247
-
248
- ```yaml
249
- - insert:
250
- - id: novel-forge
251
- name: '@waterwx/dsh-novel-forge'
252
- ```
253
-
254
- Restart dsh web, and the "Novel Forge" entry appears in the sidebar.
255
-
256
- ## Workflow
257
-
258
- One main pipeline — **open a book → build the setting → plan chapters →
259
- compile chapter by chapter → audit & finalize → export**. Everything happens
260
- inside the "Novel Forge" panel in the sidebar.
261
-
262
- ```
263
- ① Open a book (bookshelf → book wizard: paste outline text / import docx; book name auto-detected)
264
- ↓
265
- ② Build the setting (read-only outline → ✨ extract story bible [characters/world/golden-finger rules/
266
- red lines] → world [realms/regions/factions] → writing assets [genre/progression/templates/rules/style])
267
- ↓
268
- ③ Plan chapters (volume plan → chapter plan: AI generates goal / plot points / payoff hook / ending
269
- hook per chapter; with existing chapters it auto-enters "continuation mode" — reads the previous
270
- chapter's ending + fact anchors, never restarts from scratch)
271
- ↓
272
- ④ Compile chapter by chapter (generate 3000-4000 chars → auto extract summary + fact ledger → auto AI review)
273
- ↓
274
- ⑤ Revision loop (review failed → one-click revise per feedback / select-targeted local edits / polish
275
- to remove AI flavor → re-review; or use "✔ approve directly" as the author's final say)
276
- ↓
277
- ⑥ Book-wide finalization (book audit [contradiction list] → sensitive-word scan → periodic maintenance
278
- of chronicle/plotlines/role library/reviews)
279
- ↓
280
- ⑦ Export (full book as TXT / MD, with blurb & cover)
281
- ```
282
-
283
- **Side paths (usable at any stage)**: 💬 floating AI assistant (ask about the
284
- setting / revise text / impact analysis), 🧵 plotline management (health check /
285
- design plans), 👥 role library (AI extraction / knowledge tracking), 📊 floating
286
- progress console (live task progress & activity log), multi-book bookshelf.
287
-
288
- **Suggested cadence**: fully land steps ②③ first (the richer the setting, the
289
- better the chapters); generate step ④ one chapter or small batches at a time so
290
- step ⑤ can correct early; run the step ⑥ book audit every 20-30 chapters on long
291
- serials to prevent setting drift.
292
-
293
- ## Impact & Notes
294
-
295
- Using this plugin has the following effects on your account, disk and LLM quota:
296
-
297
- - **LLM quota consumption**: all AI operations (generate/review/polish/audit/
298
- extract/review-backfill) call the LLM (default `deepseek-official` /
299
- `deepseek-v4-flash`). Rough scale: one 3000-4000 char chapter ≈ 10-20k tokens
300
- including reasoning; a review ≈ 2-3k tokens; book-wide audit and role
301
- extraction are more expensive (tens of thousands of tokens). Batch operations
302
- (multi-chapter generation, book audit, review backfill) consume quota
303
- continuously — prefer small batches.
304
- - **Write guard**: the AI assistant only performs write actions (generate/revise/
305
- delete chapters, change settings) when the author explicitly asks. If you are
306
- just asking questions, it answers in prose and never modifies anything — casual
307
- questions can never trigger chapter generation.
308
- - **Concurrency safety**: plan/generate/review merge the latest on-disk settings
309
- (bible/roles/plotlines/knowledge) before saving, so parallel windows never
310
- clobber each other.
311
- - **Data on disk**: each book owns an output directory (default `D:\ryan work\harness\novels\<book name>`)
312
- with per-chapter Markdown, `novel-project.json` project state, and
313
- `novel-assistant.jsonl` assistant log; applying polish/rewrite drafts auto-backs-up
314
- the original as `.bak.md`.
315
- - **Settings persistence**: panel "Settings" changes (output dir/model/review
316
- threshold etc.) are written to the `dsh-novel-forge` section of
317
- `~/.dsh/settings.yaml`; UI preferences (theme/font size/panel width) live in
318
- browser localStorage.
319
- - **Token optimization**: generation and review use sharded contexts, related-fact
320
- injection and merged summaries (~25% cheaper batches on long serials), but each
321
- chapter is still bounded by the model context window — long settings are
322
- retrieved on demand rather than injected in full.
323
-
324
- ## Directory Layout
325
-
326
- ```
327
- src/ Plugin source (host half + browser half)
328
- lib/ Build output (lib/index.js host / lib/client.js browser)
329
- scripts/ Utility scripts
330
- package.json Package definition (dsh.bundle.patch + dsh.client declaration)
331
- cordis.patch.yml Profile mount patch
332
- tsdown.config.ts Dual-face bundling config
333
- ```
334
-
335
- ## Data Locations
336
-
337
- - Bookshelf: `~/.dsh/dsh-novel-forge-bookshelf.json`
338
- - Each book owns an output directory (containing `novel-project.json` project state,
339
- per-chapter Markdown, and polish backups `.bak.md`)
340
- - AI assistant conversation log: `<output-dir>/novel-assistant.jsonl`
341
-
342
- ## Limitations
343
-
344
- - Generation consumes LLM API quota (provider/model default: `deepseek-official` /
345
- `deepseek-v4-flash`)
346
- - Chapter quality depends on outline completeness; batch generation is serial
347
- - Settings (output directory, model, review threshold, etc.) are edited in the
348
- panel's "Settings" tab and written to the `dsh-novel-forge` section of
349
- `~/.dsh/settings.yaml`
1
+ # dsh-novel-forge — AI 编译小说工作台 / AI Novel Writing Workbench
2
+
3
+ <p align="center">
4
+ <img alt="version" src="https://img.shields.io/badge/version-1.1.0--alpha-blue" />
5
+ <img alt="DSH" src="https://img.shields.io/badge/DSH-%E2%89%A50.1.3--alpha.1-blue" />
6
+ <img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue" />
7
+ <a href="https://github.com/watersxya/dsh-novel-forge/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/watersxya/dsh-novel-forge/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <img alt="纯文本小说" src="https://img.shields.io/badge/%E5%88%9B%E4%BD%9C%E5%B7%A5%E4%BD%9C%E6%B5%81-%E2%9C%93-blue" />
12
+ <img alt="AI 编辑 Agent" src="https://img.shields.io/badge/AI%20%E7%BC%96%E8%BE%91%20Agent-%E2%9C%93-blue" />
13
+ <img alt="自动编辑" src="https://img.shields.io/badge/%E8%87%AA%E5%8A%A8%E7%BC%96%E8%BE%91-%E2%9C%93-blue" />
14
+ <img alt="知识库 RAG" src="https://img.shields.io/badge/%E7%9F%A5%E8%AF%86%E5%BA%93%20RAG-%E2%9C%93-blue" />
15
+ <img alt="题材雷达→灵感" src="https://img.shields.io/badge/%E9%A2%98%E6%9D%90%E9%9B%B7%E8%BE%BE%E2%86%92%E7%81%B5%E6%84%9F-%E2%9C%93-blue" />
16
+ <img alt="生产单" src="https://img.shields.io/badge/%E7%94%9F%E4%BA%A7%E5%8D%95-%E2%9C%93-blue" />
17
+ <img alt="三套主题" src="https://img.shields.io/badge/%E4%B8%89%E5%A5%97%E4%B8%BB%E9%A2%98-%E2%9C%93-blue" />
18
+ <img alt="全本导出" src="https://img.shields.io/badge/%E5%85%A8%E6%9C%AC%E5%AF%BC%E5%87%BA-%E2%9C%93-blue" />
19
+ </p>
20
+
21
+ 你的专属 AI 小说写作插件:把一份大纲"编译"成一本完整的小说。
22
+
23
+ **版本:`1.1.0-alpha`** · 定位:**纯文本小说创作**。所有环节(写作、设定、规划、审校、质检、导出)均在侧边栏「小说工坊」面板内完成。
24
+
25
+ ---
26
+
27
+ ## 功能一览 / Features
28
+
29
+ | 中文 | English |
30
+ |---|---|
31
+ | **创作工作流仪表盘**:主行动卡(推荐下一步)+ 创作旅程进度条 + 状态条 + 待办队列 + 资产健康 | **Workflow dashboard**: next-action hero card, journey progress bar, status strip, todo queue, asset health |
32
+ | **书架首页 + 开书向导**:书卡网格(封面/简介/进度),新建书一步导入大纲(docx / 粘贴),书名自动识别;另支持「想法 → AI 大纲」多方案 | **Bookshelf home + book wizard**: book card grid, one-step outline import, auto book-name; idea → AI outline suggestions |
33
+ | **开书即立项**:导入大纲自动建项目,书名以大纲首行为准;纳入书架并激活 | **Open-to-project**: outline import builds the project, registers on the shelf and activates it |
34
+ | **国风模块**:总纲 / 道藏 / 大世界 / 人物志 / 暗线 / 编年录 / 文戒 / 笔法帖 / 心法 | **Wuxia-flavored modules**: outline, story bible, world, characters, foreshadows, fact ledger, anti-AI rules, style templates, custom style |
35
+ | **道藏提炼**:从大纲与已写章节提炼人设 / 世界观 / 金手指规则 / 写作红线,注入生成与审稿 | **Story bible**: extract personas / world rules / golden-finger rules / red lines from the outline & chapters |
36
+ | **大世界**:境界体系 / 区域 / 势力结构化编辑 + AI 提炼,注入每章生成与审稿 | **World**: realms / regions / factions structured editing + AI extraction, injected per chapter |
37
+ | **卷计划 / 章节计划(结构化)**:每章含 本章目标 / 剧情要点 / 爽点·钩子 / 结尾钩子;**续写模式**自动读上一章结尾 + 编年录锚点 + 已发生情节禁令,不重头生成,重复标题自动去重 | **Volume / chapter planning (structured)**: goal / plot points / payoff-hook / ending hook per chapter; continuation mode reads the previous ending + fact anchors + banned-repeat list, never restarts |
38
+ | **逐章编译**:调用 LLM 生成 3000–4000 字正文并保存为 Markdown,流式输出实时进度 | **Chapter-by-chapter compile**: LLM writes 3000–4000-char bodies to Markdown with live stream |
39
+ | **摘要 + 编年录事实库**:每章自动抽取剧情摘要与已确立事实(人物状态/资源/关系/线索落地),注入后续章节,保证长期一致 | **Summary + fact ledger**: per-chapter auto-summary & extracted facts injected into later chapters for consistency |
40
+ | **相关事实全量检索**:生成时按本章剧情要点对全量编年录检索(角色名加权 + 近因加权 + 去重),旧设定不因窗口滑出而丢失 | **Full-ledger fact retrieval**: chapter-plot-based retrieval across the whole chronicle (character + recency weighting, dedup) |
41
+ | **自动 AI 审稿**:人设 / 设定 / 红线 / 文笔 / 节奏·爽点 / 逻辑 / 反 AI / 呈现 / 合规 九维打分,输出可勾选问题清单与建议 | **AI review**: 9-dimension scoring with a checkable issue list and suggestions |
42
+ | **修订循环**:审稿未过 → 按意见一键修订 / 选中局部改 / 去 AI 味润色 → 重审;「✔ 直接通过」行使作者终审权;未过章节自动按意见修订 + 验证模式 | **Revise loop**: revise by review / targeted local edits / de-AI polish → re-review; or approve directly |
43
+ | **审稿问题勾选修复**:每条问题可勾选(high 默认选),一键按所选问题修订 | **Selective review fixes**: check any issues (high pre-checked) and fix in one click |
44
+ | **作者复盘**:每章结构复盘(钩子兑现 / 结尾钩子 / 剧情线推进 / 连续性 / 节奏趋势),按卷分组,自动关联推进的剧情线 | **Author review**: per-chapter structural review (hook payoff / ending hook / arc progress / continuity / pacing), grouped by volume |
45
+ | **剧情线与神秘线管理**:主线 / 支线 / 人物线 / 悬念线,目标与进度追踪、章节关联;生成强制至少推进一条活跃线;健康检查 + AI 剧情方案 | **Plotlines**: main / branch / character / mystery arcs with goals, progress & linked chapters; generation must advance a line; health check + AI plan |
46
+ | **角色库(纯文本)**:AI 从全书提炼角色并自动分级(主角/女主/女配/配角/反派/路人),候选逐条采纳;定位 / 关系网 / 成长线 / 知情度编辑;**角色知情度**严格维护信息差 | **Role library (text)**: AI extraction with auto-tiering, adopt per candidate; edit identity / relations / arc / knowledge; strict information asymmetry |
47
+ | **人物志持久化**:角色当前状态(编年录聚合结果)落盘,打开即显示,可一键回填历史章节 | **Persistent character status**: aggregated status saved to disk, shown on open, backfill old chapters |
48
+ | **全书一致性质检**:LLM 扫描全本输出矛盾清单(定位到章),一键去修订 | **Book audit**: LLM scans all chapters for contradictions, locates them, one-click to revise |
49
+ | **敏感词检查**:内置违禁词库(政治/擦边/暴力/辱骂/广告/其他)全书一键扫描,命中定位到章并一键去修订 | **Sensitive-word check**: built-in banned-word library, scanned across the book, located per chapter with one-click fix |
50
+ | **知识库 / RAG**:书内自由参考文档,生成时按章节检索注入 | **Knowledge base / RAG**: in-book reference docs, retrieved & injected per chapter |
51
+ | **AI 编辑 Agent**:一句话代办——拆书、自动编辑、知识库(增/查/列)、剧情线、编辑待办、全书质检、简介、章节生成/审稿/修订、大纲/道藏/暗线/资产、导出;写操作有守卫 + 收敛规则 | **AI Editor Agent**: one line to delegate teardown / director / KB / plotlines / todos / audit / blurb / chapter ops / outline / bible / foreshadow / assets / export; write-guard + convergence |
52
+ | **题材雷达 → 灵感**:扫榜(番茄/起点/晋江)→ 题材信号 / 生产底座 / 开书简报 → 一键生成贴合市场的开书灵感 | **Market radar → inspiration**: scan public leaderboards → signals / production foundation / creative brief → generate market-fit book ideas |
53
+ | **自动编辑**:基于本书分卷/剧情线/伏笔/事实给出下一阶段节点、节奏板、风险与修复,可一键采纳为剧情线或待办 | **Auto-director**: next-arc nodes, pacing board, risks & fixes, adoptable into plotlines or todos |
54
+ | **书分析 / 拆书**:输入任意文本 → 卖点 / 结构 / 可借鉴 / 风险 | **Book analysis / teardown**: paste text → selling points / structure / lessons / risks |
55
+ | **创意灵感**:一句话/题材 → 多个差异化开书灵感,可「以此方向开书」 | **Creative inspiration**: one idea/genre → several differentiated book ideas, "start a book this way" |
56
+ | **生产单(批量连写)**:区间/新增 N 章一键下单,计划补足 + 逐章生成 + 被拒分级处理(豁免/修订+验证/待人工),支持暂停/继续/停止与断点续跑 | **Production run (batch)**: line up a range, auto-plan, generate chapter-by-chapter, tiered declined handling, pause/resume/stop & resume |
57
+ | **改编模式**:上传全文 → 设定卡片/可改范围 → 确认改编维度 → 生成映射表/规则/影响清单 → 替换/重写 → 保存为新书(原书保留) | **Adaptation mode**: upload full text → setting cards / mutability → confirm dimensions → mappings / rules / impacts → replace or rewrite → save as a new book |
58
+ | **全本导出**:TXT / MD(含卷首语与封面) | **Full-book export**: TXT / MD (with blurb & cover) |
59
+ | **并发安全保存**:计划/生成/审稿落盘前自动合并磁盘最新设定(道藏/角色库/剧情线/知情度) | **Concurrency-safe saves**: merge latest on-disk settings before save |
60
+ | **三套主题 + 玻璃 UI**:iOS 液态玻璃(绿)/ 经典毛玻璃(蓝)/ 新拟物双阴影,即时切换;分组导航 + 实时状态角标 | **Themes + frosted UI**: iOS liquid glass / classic frosted / neumorphism, grouped nav with live badges |
61
+ | **活动输出控制台**:实时记录生成/审稿/润色/质检等全部活动,自动滚动 + 一键清空 | **Activity console**: records every action, auto-scrolls, one-click clear |
62
+
63
+ ---
64
+
65
+ ## 工作流程 / Workflow
66
+
67
+ 一条主线:**开书 → 立设定 → 排章节 → 逐章编译 → 质检定稿 → 导出**。所有步骤都在侧边栏「小说工坊」面板内完成。
68
+
69
+ ```mermaid
70
+ flowchart TD
71
+ A[① 开书<br/>粘贴大纲 / 导入 docx] --> B[② 立设定<br/>道藏 · 大世界 · 写作资产]
72
+ B --> C[③ 排章节<br/>卷计划 · 章节计划 / 续写模式]
73
+ C --> D[④ 逐章编译<br/>生成正文 → 摘要·事实 → 审稿]
74
+ D --> E{审稿通过?}
75
+ E -->|否| F[⑤ 修订循环<br/>按意见修订 / 局部改 / 润色]
76
+ F --> D
77
+ E -->|是| G[⑥ 全书定稿<br/>全书质检 · 敏感词 · 维护]
78
+ G --> H[⑦ 导出<br/>全本 TXT / MD]
79
+
80
+ R1[💬 AI 编辑 Agent<br/>拆书 / 自动编辑 / 知识库 / 质检 / 简介 / 待办] -.-> B
81
+ R1 -.-> C
82
+ R1 -.-> D
83
+ R1 -.-> G
84
+ R2[🧵 剧情线 · 👥 角色库 · 📊 进度] -.-> D
85
+ R2 -.-> G
86
+ ```
87
+
88
+ ```
89
+ ① 开书(书架 → 开书向导:粘贴大纲文本 / 导入 docx,书名自动识别)
90
+ ↓
91
+ ② 立设定(总纲只读 → ✨ 提炼道藏【人设/世界观/金手指规则/写作红线】→ 大世界【境界/区域/势力】→ 写作资产【题材/推进/笔法帖/文戒/心法】)
92
+ ↓
93
+ ③ 排章节(卷计划 → 章节计划:AI 按大纲生成每章 目标/剧情要点/爽点钩子/结尾钩子;
94
+ 已有章节时自动进入「续写模式」——读取上一章结尾原文 + 编年录锚点,不会重头生成)
95
+ ↓
96
+ ④ 逐章编译(生成正文 3000-4000 字 → 自动抽取摘要 + 编年录事实 → 自动 AI 审稿打分 → 作者复盘)
97
+ ↓
98
+ ⑤ 修订循环(审稿未过 → 按意见一键修订 / 工作区选中局部修改 / 润色去 AI 味 → 重审;
99
+ 不满意可「✔ 直接通过」行使作者终审权)
100
+ ↓
101
+ ⑥ 全书定稿(全书质检【矛盾清单】→ 敏感词扫描 → 编年录/剧情线/角色库/复盘定期维护)
102
+ ↓
103
+ ⑦ 导出(全本 TXT / MD,含卷首语与封面)
104
+ ```
105
+
106
+ **辅助旁路(任意阶段可用)**:💬 AI 编辑 Agent(拆书/自动编辑/知识库/质检/简介/待办)、🧵 剧情线管理(健康检查/设计剧情方案)、👥 角色库(AI 提炼/知情度维护)、📊 工作进度悬浮窗(任务实时进度与活动记录)、书架多书切换。
107
+
108
+ **推荐节奏**:先让 ②③ 完整落地(设定越全,章节质量越高);④ 建议逐章或小批生成,便于在 ⑤ 及时修正;长篇小说每写 20-30 章跑一次 ⑥ 全书质检,防止设定漂移。
109
+
110
+ ---
111
+
112
+ ## 安装 / Installation
113
+
114
+ ```sh
115
+ pnpm install # 安装依赖 / install dependencies
116
+ pnpm build # 重新构建 lib/ / rebuild lib/
117
+ ```
118
+
119
+ 挂载到 dsh web profile / Mount into the dsh web profile:
120
+
121
+ ```sh
122
+ dsh plugin --profile web add link:"<此目录绝对路径>"
123
+ ```
124
+
125
+ 或 / or in `~/.dsh/profiles/web/cordis.patch.yml`:
126
+
127
+ ```yaml
128
+ - insert:
129
+ - id: novel-forge
130
+ name: '@waterwx/dsh-novel-forge'
131
+ ```
132
+
133
+ 重启 dsh web 后,侧边栏出现「小说工坊」。
134
+
135
+ ### 从 npm 安装(推荐)
136
+
137
+ ```sh
138
+ dsh plugin --profile web add @waterwx/dsh-novel-forge
139
+ ```
140
+
141
+ npm 分发的是预构建产物,无需任何构建授权。
142
+ 从 GitHub 安装需为 git 依赖的 `prepare` 构建授权(`pnpm-workspace.yaml` 的 `allowBuilds`)。
143
+
144
+ ---
145
+
146
+ ## 数据位置 / Data Locations
147
+
148
+ - 书架 / Bookshelf:`~/.dsh/dsh-novel-forge-bookshelf.json`
149
+ - 作者资产库 / Author assets:`~/.dsh/dsh-novel-forge-author-assets.json`
150
+ - 全局写作资产 / Global assets:`~/.dsh/novel-forge-global-assets.json`
151
+ - 每本书一个输出目录(含 `novel-project.json` + 各章 Markdown + 润色备份 `.bak.md`)
152
+ - AI 编辑 Agent 对话记录:`<输出目录>/novel-assistant.jsonl`
153
+ - 生产单状态:`<输出目录>/run-state.json`
154
+ - 设置:`~/.dsh/settings.yaml` 的 `dsh-novel-forge` 段;界面偏好(主题/字号/面板宽度)在浏览器 localStorage
155
+
156
+ ---
157
+
158
+ ## 影响与限制 / Impact & Limitations
159
+
160
+ - **LLM 额度消耗**:生成/审稿/润色/质检/提炼/复盘等所有 AI 操作都调用 LLM(默认 `deepseek-official / deepseek-v4-flash`)。参考:一章 3000-4000 字正文 ≈ 1-2 万 token(含推理);审稿约 2000-3000 token;全书质检与角色提炼更贵(数万 token)。建议分小批执行。
161
+ - **写操作守卫**:AI 编辑 Agent 只在作者**明确要求**时执行写操作(生成/修订/删除章节、改设定等);只提问不会误触发。
162
+ - **并发安全**:计划/生成/审稿落盘前会自动合并磁盘上的最新设定(道藏/角色库/剧情线/知情度),多窗口同时操作互不覆盖。
163
+ - **纯文本定位**:本插件不负责图片/视频生成;设定均为文字数据(角色卡仅含定位/性格/目标/关系/成长线/知情度等字段)。
164
+ - **章节质量**取决于大纲完整度;批量生成串行执行。
165
+ - **数据落盘**:每本书一个输出目录(默认 `~/.dsh/novels/<书名>`,可在设置页修改);正文为 Markdown、项目状态为 `novel-project.json`。
166
+
167
+ ---
168
+
169
+ ## 目录结构 / Directory Layout
170
+
171
+ ```
172
+ src/ 插件源码(宿主半 + 浏览器半)
173
+ lib/ 构建产物(lib/index.js 宿主 / lib/client.js 浏览器)
174
+ scripts/ 工具脚本
175
+ package.json 包定义(dsh.bundle.patch + dsh.client 声明)
176
+ cordis.patch.yml profile 挂载补丁
177
+ tsdown.config.ts 双面打包配置
178
+ ```
179
+
180
+ ---
181
+
182
+ ## English
183
+
184
+ # AI Novel Forge
185
+
186
+ An AI novel-writing plugin for DeepSeek Harness (DSH). Feed it an outline (docx or pasted text) and it compiles it into a complete novel: open a book → build the setting → plan chapters → compile chapter by chapter → audit & finalize → export.
187
+
188
+ **Version `1.0.0-alpha` · Scope: pure-text novel writing.** Everything (writing, setting, planning, review, audit, export) happens inside the "Novel Forge" sidebar panel; no comic/storyboard/video or image generation.
189
+
190
+ ## Main pipeline
191
+
192
+ 1. **Open a book** (bookshelf → wizard): paste an outline or import docx; book name auto-detected; idea → AI outline supported.
193
+ 2. **Build the setting** (read-only outline → extract story bible [personas / world rules / golden-finger rules / red lines] → world [realms / regions / factions] → writing assets [genre / progression / style templates / anti-AI rules / custom style]).
194
+ 3. **Plan chapters** (volume plan → structured chapter plan with goal / plot points / payoff-hook / ending hook; continuation mode with existing chapters never restarts).
195
+ 4. **Compile chapter by chapter** (generate 3000–4000 chars → auto summary + fact ledger → AI review → author review).
196
+ 5. **Revise loop** (revise by review / targeted edits / de-AI polish → re-review; or approve directly).
197
+ 6. **Finalize** (book audit for contradictions → sensitive-word scan → maintain chronicle / plotlines / roles / reviews).
198
+ 7. **Export** (full book TXT / MD, with blurb & cover).
199
+
200
+ ## Highlights
201
+
202
+ - **Story bible & world**: personas / world rules / golden-finger rules / red lines; realms / regions / factions.
203
+ - **Fact ledger (chronicle)**: per-chapter extracted facts injected into later chapters; full-ledger retrieval relevance for long serials.
204
+ - **Structured chapter plans + continuation planning**.
205
+ - **AI review** (9 dimensions) + one-click revise / local edits / de-AI polish; selective issue fixes.
206
+ - **Plotlines** (main / branch / character / mystery) with health check & AI plan; **role library** (text) with knowledge asymmetry; **persistent character status**.
207
+ - **Book audit** (contradiction list), **sensitive-word check**, **knowledge base / RAG**.
208
+ - **AI Editor Agent** with write-guard + convergence.
209
+ - **Market radar → inspiration**, **auto-director**, **book analysis / teardown**, **creative inspiration**.
210
+ - **Production run** (batch, resume).
211
+ - **Adaptation mode** (upload a full text, remap/rewrite, save as a new book).
212
+ - **Full-book export** TXT / MD.
213
+
214
+ ## Install
215
+
216
+ ```sh
217
+ dsh plugin --profile web add @waterwx/dsh-novel-forge
218
+ ```
219
+ or link a local checkout and restart dsh web; the "Novel Forge" entry appears in the sidebar.
220
+
221
+ ## Data
222
+
223
+ - Bookshelf: `~/.dsh/dsh-novel-forge-bookshelf.json`
224
+ - Per book: an output directory with `novel-project.json`, chapter Markdown, `.bak.md` backups, `novel-assistant.jsonl`
225
+ - Settings: `dsh-novel-forge` section of `~/.dsh/settings.yaml`
226
+
227
+ ## Limitations
228
+
229
+ - All AI operations consume LLM quota (default `deepseek-official / deepseek-v4-flash`).
230
+ - Chapter quality depends on outline completeness; batch generation is serial.
231
+ - The plugin writes text only — no image/video generation.