dsh-novel-writer 6.5.0 → 6.5.5
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.
- package/README.en.md +5 -2
- package/README.md +5 -2
- package/lib/brief.js +32 -4
- package/lib/client.js +492 -1
- package/lib/core.js +280 -1
- package/lib/fixplan.js +34 -5
- package/lib/index.js +130 -16
- package/package.json +1 -1
- package/server.json +2 -2
package/README.en.md
CHANGED
|
@@ -39,6 +39,7 @@ Full version history: see [CHANGELOG.md](./CHANGELOG.md).
|
|
|
39
39
|
| Your pain | What you get here |
|
|
40
40
|
|---|---|
|
|
41
41
|
| "This passage I just wrote doesn't sound like me" | **Six-metric style baseline**: μ±σ of the original measured per chapter across syntactic complexity / modifier density / abstraction / action density / hedging / gap index; a new chapter is compared dimension by dimension and flagged ⚠ when out of band |
|
|
42
|
+
| "The AI keeps writing, and a few chapters in it sounds like the AI, not like my novel" | **Baseline scope (whole book / selected chapters)**: the baseline no longer has to be sampled from the whole book — tick the chapters you treat as the yardstick (say, the first 30 you wrote yourself) and the style check, chapter brief, fix plan, style report and new-chapter baseline will use **only** those chapters as the baseline; the chapter being checked is always excluded. **The plugin never decides "you have drifted" — it tells you "how far this chapter sits from the yardstick you chose"** (answers issue #1, "style drift") |
|
|
42
43
|
| "The AI says my style changed but can't say where" | **Style check**: similarity score + a deviation list (which sentence types increased, how far sentence length drifted, whether the dominant emotion changed) |
|
|
43
44
|
| "I have to poke six or seven tools before writing, and I still miss one" | **Chapter brief**: 16 inputs in one call; whatever can't be found is explained in `degraded` — **missing an input is the number one source of style drift and setting contradictions** |
|
|
44
45
|
| "I can see the chapter has problems but not which one to fix first" | **Fix plan**: to-dos sorted by severity → effort → line, each with line-anchored text, current vs. target values, a reference passage and a rewrite direction; re-checkable in three states after editing |
|
|
@@ -83,6 +84,8 @@ Then ask, in order (this is one complete chapter):
|
|
|
83
84
|
3. **"check chapter 7"** → `novel_style_check` returns similarity, a deviation list and the six-metric comparison
|
|
84
85
|
4. **"turn chapter 7 into a fix list"** → `novel_fix_plan` returns the prioritised to-dos; run `verify` afterwards to re-check the three states
|
|
85
86
|
|
|
87
|
+
> Want the baseline to follow **the chapters you wrote yourself** instead of the whole book? In the panel's **Style baseline** view, set **Baseline scope** to **selected chapters** and tick them: the check, the chapter brief, the fix plan and the style report all switch to those chapters as the baseline (**per book**; the default **whole book** is the old behaviour — leave it alone and nothing changes). Creating a chapter (`novel_new_chapter`) uses the same scope for the μ summary and the anchor pack it attaches.
|
|
88
|
+
|
|
86
89
|
To just look at the baseline first, ask **"run novel_style_report on my novel"** and you get:
|
|
87
90
|
|
|
88
91
|
```text
|
|
@@ -104,7 +107,7 @@ To just look at the baseline first, ask **"run novel_style_report on my novel"**
|
|
|
104
107
|
- [mu5kjla…] 琥珀色齿轮怀表的来历与停摆的指针(high|第 1 章埋下,已过 6 章)
|
|
105
108
|
【相关人物】- 林昭:守码头的女人,父亲失踪后回到旧宅
|
|
106
109
|
【世界观用语】欧式中世纪沿海城邦;点烛不烧香|禁用:上香、烧香、时辰、老夫
|
|
107
|
-
【风格基线】complexity μ=2.42 modifierDensity μ=22.2 abstractDensity μ=10.06
|
|
110
|
+
【风格基线】complexity μ=2.42 modifierDensity μ=22.2 abstractDensity μ=10.06 …(取样范围:全书除本章外的 7 章)
|
|
108
111
|
【原著锚段·照这个味道写】[对话] … [心理] …
|
|
109
112
|
【上一章自检】第 7 章六维对照:全部维度在容差带内 ✓
|
|
110
113
|
【本章禁用清单】- 禁词:上香(建议改用:点烛)
|
|
@@ -173,7 +176,7 @@ fixAnchors:3 条原著锚段(对话 / 心理 / 描写各一条,供逐句
|
|
|
173
176
|
7. **Worldview & pragmatics detection**: auto cultural-baseline detection with confidence; speechStyle title/honorifics/rituals/tone norms; genre & theme + webnovel signals.
|
|
174
177
|
8. **Writing toolkit**: plot tracking / five settings tables (characters·locations·items·timeline·worldview) / chapter summaries / continuity audit / batch import / style check / continuation writing.
|
|
175
178
|
9. **Per-tool UI toggles**: a 「写作助手功能」 ("Writing Assistant") entry in the left sidebar plus a main-column panel (**official DSH 0.2.0 seats**; hosts older than 0.2.0 fall back automatically) — master switch + grouped tool toggles + feature toggles + prompt mode/scene/**lean workflow**, plain-language labels, data-dir usage & semantic-engine status. All colors go through `--dsw-alias-*` semantic tokens (three themes in sync with the host), controls use the official UI primitives, DeepSeek-blue accents, a glow hero header with section kickers, and equal-width pages across every level.<br>**The UI goes further (Plan A)**: source split + build chain (assert-failed builds never write, `--check` verifies source==artifact), 6 unified components with a single row pattern (`PreferenceRow`), group cards across every switch page, 19+5 line icons, a slider as auxiliary input on the tolerance rows, and page-level push-pop transition animations (zero state / zero hook).
|
|
176
|
-
10. **Style Baseline**: Six writing metrics (syntactic complexity / modifier density / abstraction / action density / hedging / gap index) + per-chapter μ±σ baseline band; `novel_style_report` outputs the band, `novel_style_check` compares new chapters (in-band ✓ / out-of-band ⚠); per-metric ±% tolerance configurable in the panel's **Six-metric baseline** view (**recommended = 1.5× σ of the book's chapter variance**, rounded, clamped to ±10%~100%; leave blank to use recommended) — free theme, writing style kept inside the band.
|
|
179
|
+
10. **Style Baseline**: Six writing metrics (syntactic complexity / modifier density / abstraction / action density / hedging / gap index) + per-chapter μ±σ baseline band; `novel_style_report` outputs the band, `novel_style_check` compares new chapters (in-band ✓ / out-of-band ⚠); per-metric ±% tolerance configurable in the panel's **Six-metric baseline** view (**recommended = 1.5× σ of the book's chapter variance**, rounded, clamped to ±10%~100%; leave blank to use recommended) — free theme, writing style kept inside the band.<br>**Baseline scope (v6.5.5, configured per book)**: the baseline does not have to be the whole book — in the panel's **Style baseline** view choose **whole book** (default, = the old behaviour) or **selected chapters**, then tick the chapters you treat as the yardstick; the baseline then uses **only** those (it means "only these", not "prefer these and top up when short"). This exists for "the AI keeps writing and ends up sounding like the AI": from chapter 2 onward the model is really reading its own previous chapter for reference, and **a baseline sampled from the whole book drifts along with it** (the longer the book, the higher the AI share). Nail the yardstick to the chapters you wrote yourself and the plugin can answer "**relative to those chapters**, how far has this chapter moved" — it never judges whether you have drifted, which is not decidable in the first place. The chapter being checked is **always excluded** (otherwise it would be comparing itself with itself); when fewer than 3 chapters are ticked the recommended tolerance widens to **at least ±25%**, so even a single chapter can serve as the baseline; chapters that cannot be used (renamed / deleted, or **too short to measure**) are skipped and reported honestly, and if not one of them can be used it falls back to **whole book** and states the reason in the returned baseline description. The scope is stored per book (`<library root>/.novel-writer/baseline/<book>.json`), so books do not affect each other.
|
|
177
180
|
11. **Writing sentinels**: `novel_continuity_check` extended — ①**bridge check** (`chapter`: time jumps / semantic distance / character continuity / hook handoff, with quoted evidence) ②**OOC check** (`ooc`: per-character emotion baseline deviation) ③**outline drift** (`outline`: direction vs body keyword overlap); **brief mode** for report tools.
|
|
178
181
|
12. **Original mode & creation files**: fill in creation settings in the panel's **Original mode** view (worldview/characters/forbidden/main conflict/genre/extras, blank = model decides, per-book profile library); novel_outline maintains creation files (bible/characters/outline/hooks/status), enforcing the bible → outline → hook chain with dynamic batches (10→20→30 chapters) to prevent plot jumps and OOC.
|
|
179
182
|
13. **Experience & stats**: main panel **library stats** (per-book chapters/total chars/7-day active chars, 🔥 green), **🎬 demo** (built-in sample, no files, runs the 6-dim baseline), **📊 report history** (analysis/style-reports browsing); actionable error hints; slimmer tool descriptions.
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
| 你的困扰 | 这里给的答案 |
|
|
39
39
|
|---|---|
|
|
40
40
|
| "我续写的这段,读起来不像我自己写的" | **文笔六维基线**:从句法复杂度 / 修饰密度 / 抽象度 / 动作密度 / 不确定性 / 留白指数六个维度算出原著的 μ±σ,新章逐维对照,出带标 ⚠ |
|
|
41
|
+
| "AI 接着往下写,几章之后文风越来越像 AI 自己,不像原著了" | **基线范围(按全书 / 按部分)**:基线不必再从全书取样——勾出你认作标杆的那几章(比如你亲手写的前 30 章),自检 / 开写包 / 改稿台 / 风格画像 / 建章都**只用**这几章当基准,正在检查的那一章永远排除在外。**插件不判定「你漂移了」,只告诉你「相对你选的标杆,这章偏了多少」**(回应 issue #1「风格漂移」) |
|
|
41
42
|
| "AI 说文风变了,但说不清哪儿变了" | **风格自检**:相似度 + 偏差清单(哪类句式多了、句长偏了多少、主导情绪有没有换) |
|
|
42
43
|
| "动笔前要翻六七个工具,还老漏读一样" | **开写包**:一次调用取齐 16 项材料;取不到的在 `degraded` 里说明缺什么、怎么补——**漏读正是文风漂移与设定矛盾的头号来源** |
|
|
43
44
|
| "知道这章有问题,但不知道先改哪句" | **改稿台**:按「严重度 → 难度 → 行号」排好待办,每条给原句行号 / 当前值与目标值 / 原著锚段 / 改写方向;改完可三态复测 |
|
|
@@ -80,6 +81,8 @@ mkdir -p novels/我的小说 # 把章节文件放进去(第01章.md、第0
|
|
|
80
81
|
3. **「自检第 7 章」** → `novel_style_check` 给出相似度、偏差清单与六维对照
|
|
81
82
|
4. **「把第 7 章排成改稿清单」** → `novel_fix_plan` 给出按优先级排好的待办;改完再 `verify` 复测三态
|
|
82
83
|
|
|
84
|
+
> 想让基线对着**你亲手写的那些章**、而不是全书?面板「风格基线」→ **基线范围** 选 **按部分** 并勾章即可:上面这条链上的自检、开写包、改稿台与风格画像都会改用这几章当基线(**按书生效**;默认「按全书」=旧行为,不动它就跟以前完全一样)。建章(`novel_new_chapter`)时附的 μ 摘要与锚段用的是同一份范围。
|
|
85
|
+
|
|
83
86
|
只想先看看家底,就说 **「用 novel_style_report 给我的小说做一次风格画像」**:
|
|
84
87
|
|
|
85
88
|
```text
|
|
@@ -100,7 +103,7 @@ mkdir -p novels/我的小说 # 把章节文件放进去(第01章.md、第0
|
|
|
100
103
|
- [mu5kjlb…] 海图上红铅笔圈的礁区坐标(high|第 3 章埋下,已过 4 章)
|
|
101
104
|
【相关人物】- 林昭:守码头的女人,父亲失踪后回到旧宅 - 沈砚:随船出海的人
|
|
102
105
|
【世界观用语】欧式中世纪沿海城邦;点烛不烧香|禁用:上香、烧香、时辰、老夫
|
|
103
|
-
【风格基线】complexity μ=2.42 modifierDensity μ=22.2 abstractDensity μ=10.06 actionDensity μ=122.45
|
|
106
|
+
【风格基线】complexity μ=2.42 modifierDensity μ=22.2 abstractDensity μ=10.06 actionDensity μ=122.45 …(取样范围:全书除本章外的 7 章)
|
|
104
107
|
【原著锚段·照这个味道写】[对话] … [心理] …
|
|
105
108
|
【上一章自检】第 7 章六维对照:全部维度在容差带内 ✓
|
|
106
109
|
【本章禁用清单】- 禁词:上香(建议改用:点烛) - 禁词:时辰(建议改用:钟点)
|
|
@@ -169,7 +172,7 @@ fixAnchors:3 条原著锚段(对话 / 心理 / 描写各一条,供逐句
|
|
|
169
172
|
7. **世界观与语用检测**:文化基准自动判断(西/东/混合)+ 置信度;speechStyle 称谓/客套/仪式/语气规范;题材流派 + 网文信号。
|
|
170
173
|
8. **写作辅助全家桶**:伏笔登记表 / 设定五张表(人物·地点·道具·时间线·世界观)/ 章节摘要 / 连贯性审计 / 批量导入 / 风格自检 / 续写辅助。
|
|
171
174
|
9. **全工具 UI 开关**:左栏「写作助手功能」入口 + 主栏面板(**DSH 0.2.0 官方席位**;老宿主 < 0.2.0 自动回退旧挂载)——总开关 + 工具开关分组 + 功能开关 + 提示词档位/场景/**精简工作流**,大白话文案,显示数据目录占用与语义引擎状态。颜色全走 `--dsw-alias-*` 语义 token(三主题与官方同源)、控件用官方 UI primitives、品牌蓝强调、光晕头部与分区 kicker、各级页面等宽。<br>**界面再进一步(方案 A)**:源码分块 + 构建链装配(构建失败不写盘、`--check` 校验源与产物一致)、6 个统一组件与单一行模式(`PreferenceRow`)、分组卡片贯穿全部开关页、19+5 枚线图标、阈值 slider 辅助输入、页面级 push-pop 过渡动画(零 state / 零 hook)。
|
|
172
|
-
10. **风格基线**:文笔六维测量(句法复杂度/修饰密度/抽象度/动作密度/不确定性/留白指数)+ 按章节 μ±σ 基线带;`novel_style_report` 输出基线带,`novel_style_check` 对照新章偏差(带内 ✓ / 出带 ⚠);面板「六维基线」视图可自定义每维 ±% 容差(**推荐值 = 原著章节波动的 1.5 倍 σ**,自动取整、限 ±10%~100
|
|
175
|
+
10. **风格基线**:文笔六维测量(句法复杂度/修饰密度/抽象度/动作密度/不确定性/留白指数)+ 按章节 μ±σ 基线带;`novel_style_report` 输出基线带,`novel_style_check` 对照新章偏差(带内 ✓ / 出带 ⚠);面板「六维基线」视图可自定义每维 ±% 容差(**推荐值 = 原著章节波动的 1.5 倍 σ**,自动取整、限 ±10%~100%;输入框留空即用推荐)——原创/续写时主题自由、写法保持在基线带内。<br>**基线范围(v6.5.5,按书选择)**:基线不必永远是全书——面板「风格基线」里选**按全书**(默认,等于旧行为)/ **按部分**,再用章节选择器勾出你认作标杆的章,基线就**只用**这几章(是「只用」,不是「不够再补」)。这是给「AI 续写越写越像 AI 自己」准备的:从第 2 章续写起,模型参考的其实是它自己写的上一章,而**从全书取样的基线自己也在漂**(书越长 AI 占比越高)。把标杆钉死在你亲手写的那些章上,插件就能回答「**相对这几章**,新章偏了多少」——它不判断你有没有漂移,那一项本就不可判定。正在检查的那一章**永远排除**(否则等于拿自己跟自己比);勾中的章少于 3 章时推荐容差自动放宽到**至少 ±25%**,所以单章也能当基线;取不到的章(已改名 / 已删除,或**正文过短无法测量**)会被跳过并如实计数,**一章都取不到**时自动回退「按全书」并在返回体里写明原因。范围按书保存(`<书库根>/.novel-writer/baseline/<书名>.json`),换书互不影响。
|
|
173
176
|
11. **写作哨兵三件套**:`novel_continuity_check` 扩展——①**衔接检查**(chapter 参数:时间硬跳/语义距离/人物延续/钩子承接四路检测,带原文引用)②**OOC 检测**(ooc 参数:角色情绪基线偏离)③**大纲走偏**(outline 参数:方向行 vs 正文关键词重合);报告工具支持 **brief 精简模式**。
|
|
174
177
|
12. **原创模式与创作资料**:面板「原创模式」填写创作设定(世界观/角色/禁忌/主线/题材/额外要求,留空=模型自定,多书独立设定库);novel_outline 维护创作资料(创作设定/人物/剧情大纲/钩子记录/创作状态卡),原创强制「设定书→大纲→钩子」链,动态批次(10→20→30 章)防剧情跳跃与角色 OOC。
|
|
175
178
|
13. **体验与统计**:主面板**书库统计卡**(每本章数/总字数/近 7 天活跃字数,活跃🔥标绿)、**🎬 体验演示**(内置示例不落盘跑六维基线)、**📊 报告历史**(analysis/style-reports 列表浏览);错误提示带解决步骤;工具说明压缩省 token。
|
package/lib/brief.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
bookDir,
|
|
20
20
|
buildStyleAnchorPackage,
|
|
21
21
|
buildTolerance,
|
|
22
|
+
resolveBaselineScope,
|
|
22
23
|
creationDir,
|
|
23
24
|
CREATION_FILES,
|
|
24
25
|
featureEnabled,
|
|
@@ -463,8 +464,24 @@ export async function buildChapterBrief(root, book, chapterArg, opts, exec) {
|
|
|
463
464
|
// v5.0.0 修正:锚段/骨架必须取自**其它章**(与 novel_fix_plan 的锚段口径一致)。
|
|
464
465
|
// 目标是已存在的章(改稿场景)时把本章自身排除——否则"照着原著范本改"可能照着正在改的这一段,
|
|
465
466
|
// 把待修的病句当成标杆。chapter="next" 时目标章不存在,等价于不排除。
|
|
466
|
-
|
|
467
|
-
|
|
467
|
+
//
|
|
468
|
+
// v6.5.5:这一处的取样范围交给**基线范围**的单一裁决点(按全书 / 按用户选中的部分章)。
|
|
469
|
+
// 为什么锚段也要跟着走:这一段的用途就是给文风当锚(名字就叫「原著锚段」)。
|
|
470
|
+
// 若基线按部分、而锚段仍取全书,用户指定"以这几章为标杆"就没落到**最容易影响生成**的那一处:
|
|
471
|
+
// 书越长、AI 续写占比越高,锚段越会变成 AI 自己的文风——issue #1 的漂移正是这么来的。
|
|
472
|
+
const anchorScope = await resolveBaselineScope(baseRoot, safeBook, chapters, targetChapter ? targetChapter.file : "", exec);
|
|
473
|
+
const anchorFileSet = new Set(anchorScope.items.map((c) => c.file));
|
|
474
|
+
const anchorChapters = anchorScope.items;
|
|
475
|
+
const anchorTexts = texts.filter((t) => anchorFileSet.has(t.file));
|
|
476
|
+
// v6.5.5:这里的措辞**必须跟上裁决点给的原因**(独立验证代理抓到本行是全文唯一残留的「已失效」硬编码):
|
|
477
|
+
// 旧句只要回退就写「自定义基线已失效(N 章改名或删除)」,而另一种原因是"选中的只有本章自身"——
|
|
478
|
+
// 那句话在那条路径上不仅原因说错,还把"按设计排除"量化成"0 章改名或删除",是半句空话。
|
|
479
|
+
// degraded 是**渲染进 <content> 给模型看的**,口径必须与 baselineScope 一致,否则同一份开写包自相矛盾。
|
|
480
|
+
if (anchorScope.fellBack) {
|
|
481
|
+
degraded.push("原著锚段/六维基线:" + (anchorScope.reason === "only-target"
|
|
482
|
+
? "选中的章只有本章自身(不能作为自己的基线),已回退按全书"
|
|
483
|
+
: "自定义基线已失效(" + anchorScope.missing + " 章已改名或删除),已回退按全书"));
|
|
484
|
+
}
|
|
468
485
|
let anchors = [];
|
|
469
486
|
let skeletons = [];
|
|
470
487
|
try {
|
|
@@ -491,7 +508,9 @@ export async function buildChapterBrief(root, book, chapterArg, opts, exec) {
|
|
|
491
508
|
}
|
|
492
509
|
// v5.0.0:目标章已存在时把它排除出基线语料(与 novel_style_check 同口径);"下一章"尚未存在,
|
|
493
510
|
// 全部现有章都是它的参照系。
|
|
494
|
-
|
|
511
|
+
// v6.5.5:范围同样走基线范围的单一裁决点(按全书 / 按用户选中的部分章),与锚段、六维基线一致。
|
|
512
|
+
const baselineScope = await resolveBaselineScope(baseRoot, safeBook, perChapter, targetChapter ? targetChapter.file : "", exec);
|
|
513
|
+
const baselineCorpus = baselineScope.items;
|
|
495
514
|
let baseline = null;
|
|
496
515
|
if (baselineCorpus.length > 0) baseline = computeBaselineFromPerChapter(baselineCorpus);
|
|
497
516
|
else if (perChapter.length === 0) degraded.push("六维基线不可用:全书没有正文达 40 字以上的章节(书太短或章节为空)");
|
|
@@ -501,7 +520,10 @@ export async function buildChapterBrief(root, book, chapterArg, opts, exec) {
|
|
|
501
520
|
let lastVerdict = "";
|
|
502
521
|
if (prevChapter) {
|
|
503
522
|
const prevMetrics = perChapter.find((pc) => pc.file === prevChapter.file);
|
|
504
|
-
|
|
523
|
+
// v6.5.5:这里也走同一套基线范围。注意**排除的是上一章**(被判定的是它,不是目标章)——
|
|
524
|
+
// 范围(哪些章算标杆)只有一个,而"排除谁"取决于在判定哪一章,两者不要混为一谈。
|
|
525
|
+
const prevScope = await resolveBaselineScope(baseRoot, safeBook, perChapter, prevChapter.file, exec);
|
|
526
|
+
const others = prevScope.items;
|
|
505
527
|
// v6.2.0 修正(缺陷 #65①):原来写的是 `!prevMetrics || !prevMetrics.metrics`,而 perChapter 的每一项
|
|
506
528
|
// 都由 style-metrics.computeBaseline 写成 `{ file, metrics }`(缓存也只存这个形状),后半句恒为 false。
|
|
507
529
|
// 「上一章正文不足 40 字」的表现是 perChapter 里**没有这一项**(computeBaseline 会跳过短章),
|
|
@@ -859,6 +881,12 @@ export async function buildChapterBrief(root, book, chapterArg, opts, exec) {
|
|
|
859
881
|
worldview,
|
|
860
882
|
lexicon,
|
|
861
883
|
baseline,
|
|
884
|
+
// v6.5.5:**披露基线范围**。锚段与六维基线都可能只取自用户选中的部分章
|
|
885
|
+
//(按部分 = 只用勾选的章节),不写出来,模型会把"你选的 6 章"当成"整本书"来校准语感——
|
|
886
|
+
// 那恰恰是这个功能想避免的事。fellBack(选择全部失效→回退全书)也已含在 scope 文案里。
|
|
887
|
+
// 由独立复核代理指出「开写包原本完全不披露范围」后补上(与 style_check/fix_plan 同口径)。
|
|
888
|
+
baselineScope: baselineScope.scope,
|
|
889
|
+
baselineMode: baselineScope.mode,
|
|
862
890
|
anchors,
|
|
863
891
|
skeletons,
|
|
864
892
|
lastVerdict,
|