dsh-novel-writer 2.6.1 → 2.6.2

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 (3) hide show
  1. package/README.en.md +86 -20
  2. package/README.md +78 -59
  3. package/package.json +1 -1
package/README.en.md CHANGED
@@ -1,26 +1,92 @@
1
- # dsh-novel-writer — Novel Writing Assistant Plugin (v2.6.0)
1
+ # 📚 dsh-novel-writer — Novel Writing Assistant
2
2
 
3
- A DSH (DeepSeek Harness) bundle plugin. **Ships a local semantic embedding engine (bge-small-zh-v1.5 ONNX, bundled, CPU inference, 0 token cost)** — semantic capabilities without any API fees.
3
+ English | [**中文**](./README.md)
4
4
 
5
- ## Tools (15, each with an independent UI switch)
6
- novel_books / novel_chapters / novel_read / novel_keywords / novel_new_chapter / novel_import / novel_sentence_analysis / novel_sentence_config / novel_style_check / novel_plot / novel_settings / novel_summary / novel_continuity_check / novel_semantic_search (new in v2.0.0) / **novel_style_report (new in v2.5.0)**
5
+ [![npm version](https://img.shields.io/npm/v/dsh-novel-writer.svg?style=flat-square&color=blue)](https://www.npmjs.com/package/dsh-novel-writer)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](LICENSE)
7
+ [![GitHub stars](https://img.shields.io/github/stars/siweina/dsh-novel-writer.svg?style=flat-square&color=orange)](https://github.com/siweina/dsh-novel-writer/stargazers)
8
+ [![GitHub release](https://img.shields.io/github/v/release/siweina/dsh-novel-writer.svg?style=flat-square)](https://github.com/siweina/dsh-novel-writer/releases)
9
+ [![DSH plugin](https://img.shields.io/badge/DSH-plugin-4b8bbe.svg?style=flat-square)](https://github.com/deepseek-ai/deepseek-harness)
7
10
 
8
- ## v2.0.0 Semantic Layer
9
- - **Local engine** (lib/embedding.js): Xenova/bge-small-zh-v1.5 (quantized), 512-dim Chinese vectors, ~23MB, bundled; @huggingface/tokenizers + onnxruntime-web (WASM), local CPU, 0 token / 0 API cost;
10
- - **Lazy load** (~0.3s first call); automatic fallback to pure-rule mode if unavailable;
11
- - **Index cache**: per-book vectors at `.novel-writer/embedding/<book>.json` — repeated searches are instant;
12
- - **novel_semantic_search**: natural-language search across the whole book (foreshadowing clues, emotional scenes, setting mentions) — matches by meaning even when keywords differ;
13
- - **novel_style_check upgrade**: adds semantic similarity (target chapter vs rest of book) alongside rule-based fingerprint similarity;
14
- - **Switch: semanticEmbedding** — default ON (probe-based: auto-enabled when the model is present); turn it off in the sidebar「写作助手功能」panel to fully return to rule-only mode.
11
+ A novel-writing assistant plugin for **DeepSeek Harness (DSH)** (v2.6.0): chapter library management, sentence-pattern analysis, emotion purification & quantification, **12-axis vibe spectrum**, **style portrait report**, plot & settings management, local semantic search (0 token), webnovel signal detection, batch import, and AI-assisted continuation writing. Zero third-party dependencies on host. **Requires Node ≥ 22.3.**
15
12
 
16
- ## History (v0.3 v1.6)
17
- Sentence-pattern analysis; emotion purification + AI review (strong/weak lexicon, pollution caveat); emotion quantification (Valence sliding window: variance/slope/conflict + implicit imagery + complexity score); worldview/genre/theme detection (modern/western/eastern + 15 genres + 35 themes); pragmatic-style review; settings tables (5) + foreshadowing registry + summaries + continuity audit + style check; analysis cache & report export (`.novel-writer/analysis/`).
13
+ > **A note to non-Chinese users**: This plugin is designed specifically for Chinese-language novel analysis and writing — its core capabilities (sentence-pattern analysis, emotion quantification, imagery detection) and its built-in semantic model are all built and tuned for Chinese text. Fully supporting English or other languages alongside Chinese is beyond my current capability. I sincerely apologize for any inconvenience this may cause.
18
14
 
19
- ## v2.5.0: Style Portrait Report (measurement/judgment separation)
20
- - **novel_style_report** (15th tool): aggregates 6 measurement dimensions (style fingerprint / keywords / theme / emotion quantification / 12-axis vibe / semantic style distances);
21
- - Plugin only reports numbers, never labels — style judgment is left to the LLM; AI judgment can be saved via `aiJudgment` (stored in .novel-writer/style-reports/) and read with `action=get`;
22
- - Vibe spectrum: 12 axes (added 文艺唯美 Aesthetic / 情欲暧昧 Sensual), rule-based conclusions removed;
23
- - Semantic style distances: 12 style prototype sets × book vector (local embedding, 0 token).
24
15
 
25
- ## Size
26
- ~95MB total (23MB quantized model + 70MB runtime); zip 31MB. If disk is tight, disable the semantic switch and delete `lib/models/` + `node_modules/` to go back to rule-only.
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ **Option 1: npm (recommended)**
21
+
22
+ ```sh
23
+ dsh plugin --profile web add dsh-novel-writer
24
+ # or
25
+ npm install dsh-novel-writer
26
+ ```
27
+
28
+ **Option 2: From GitHub**
29
+
30
+ ```sh
31
+ dsh plugin --profile web add github:siweina/dsh-novel-writer#main
32
+ ```
33
+
34
+ After installing, **restart the web app** to activate (host registers 15 tools + state/reveal routes; browser mounts the "Writing Assistant" sidebar toggle panel).
35
+
36
+ ---
37
+
38
+ ## Features
39
+
40
+ 1. **Style portrait report** (`novel_style_report`): 6-dimension measurement — style fingerprint / high-frequency lexicon / genre-theme / emotion quantification / 12-axis vibe spectrum / semantic style distance. **Measurement-judgment separation**: the plugin only reports numbers, never labels; AI judgment can be saved back to `.novel-writer/style-reports/` for consistent continuation writing.
41
+ 2. **12-axis vibe spectrum**: nightmare / angst / heartwarming / fluff / tearjerker / dark / mystery / blaze / absurd / lonesome / aesthetic / sensual — with traceable evidence, 0 token.
42
+ 3. **Local semantic engine**: bge-small-zh Chinese model (23MB, shipped with the plugin) local CPU inference — `novel_semantic_search` finds semantically related passages with natural language (with chapter location), semantic style comparison, semantic implicit emotion; lazy loading + graceful fallback.
43
+ 4. **Sentence-pattern analysis**: 9 categories, arrangement patterns, rhythm, emotion curve, style fingerprint + guidance, with cache & report export.
44
+ 5. **Emotion purification & quantification**: strong/weak emotion-word grading, pollution detection, caveat warning + AI re-verification; Valence sliding window → variance V / delta Δ / conflict index C + implicit imagery carriers.
45
+ 6. **Worldview & pragmatics detection**: auto cultural-baseline detection with confidence; speechStyle title/honorifics/rituals/tone norms; genre & theme + webnovel signals.
46
+ 7. **Writing toolkit**: plot tracking / five settings tables (characters·locations·items·timeline·worldview) / chapter summaries / continuity audit / batch import / style check / continuation writing.
47
+ 8. **Per-tool UI toggles**: "Writing Assistant" sidebar panel (master + grouped tool toggles + feature toggles), plain-language labels, data-dir usage & semantic-engine status display.
48
+
49
+ ---
50
+
51
+ ## Provided Tools (15)
52
+
53
+ | Tool | Description |
54
+ |------|-------------|
55
+ | `novel_books` | List all books in library |
56
+ | `novel_chapters` | List a book's chapters |
57
+ | `novel_read` | Read a chapter (paginated) |
58
+ | `novel_keywords` | Keywords: bigram/trigram/name candidates |
59
+ | `novel_new_chapter` | Create new chapter file |
60
+ | `novel_import` | Batch import manuscripts |
61
+ | `novel_sentence_analysis` | Sentence-pattern analysis |
62
+ | `novel_sentence_config` | View/set tool & feature toggles |
63
+ | `novel_style_check` | Style check (rule + semantic) |
64
+ | `novel_style_report` | **Style portrait report** (6-dim measurement) |
65
+ | `novel_plot` | Plot/foreshadowing tracker |
66
+ | `novel_settings` | Settings management (+worldview) |
67
+ | `novel_summary` | Chapter summaries |
68
+ | `novel_continuity_check` | Continuity audit |
69
+ | `novel_semantic_search` | Semantic search (local embedding, 0 token) |
70
+
71
+ ---
72
+
73
+ ## Configuration
74
+
75
+ ```yaml
76
+ - id: novel-writer
77
+ config:
78
+ root: 'D:/my-novel-library'
79
+ allowLanState: false # true = allow state save from LAN GUI access
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Data Directory
85
+
86
+ Under `<library-root>/.novel-writer/`: `plots` / `settings` / `summaries` / `analysis` / `audits` / `embedding` / `style-reports`.
87
+
88
+ ---
89
+
90
+ ## License
91
+
92
+ [MIT](./LICENSE)
package/README.md CHANGED
@@ -1,73 +1,92 @@
1
- # dsh-novel-writer — 小说写作助手插件(v2.6.0)
1
+ # 📚 dsh-novel-writer — 小说写作助手
2
2
 
3
- DSH(DeepSeek Harness)小说写作助手 bundle 插件。**v2.6.0 集成本地语义嵌入引擎(bge-small-zh-v1.5 ONNX,随插件分发,本地 CPU 推理,0 token 成本)**,在不增加任何 API 费用的前提下获得语义级能力。
3
+ [**English**](./README.en.md) | 中文
4
4
 
5
- ## 工具清单(15 个,全部带独立 UI 开关)
5
+ [![npm version](https://img.shields.io/npm/v/dsh-novel-writer.svg?style=flat-square&color=blue)](https://www.npmjs.com/package/dsh-novel-writer)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](LICENSE)
7
+ [![GitHub stars](https://img.shields.io/github/stars/siweina/dsh-novel-writer.svg?style=flat-square&color=orange)](https://github.com/siweina/dsh-novel-writer/stargazers)
8
+ [![GitHub release](https://img.shields.io/github/v/release/siweina/dsh-novel-writer.svg?style=flat-square)](https://github.com/siweina/dsh-novel-writer/releases)
9
+ [![DSH plugin](https://img.shields.io/badge/DSH-plugin-4b8bbe.svg?style=flat-square)](https://github.com/deepseek-ai/deepseek-harness)
6
10
 
7
- novel_books / novel_chapters / novel_read / novel_keywords / novel_new_chapter / novel_import / novel_sentence_analysis / novel_sentence_config / novel_style_check / novel_plot / novel_settings(设定管理)/ novel_summary(章节摘要)/ novel_continuity_check(连贯性审计)/ novel_semantic_search(语义检索)/ **novel_style_report(风格画像报告,v2.5.0 新增)**
11
+ **DeepSeek Harness (DSH)** 打造的小说写作助手插件(v2.6.0):章节库管理、句式分析、情感净化与量化、氛围光谱、**风格画像报告**、伏笔设定管理、本地语义检索(0 token)、网文信号识别、批量导入与 AI 续写辅助。宿主端零第三方依赖,浏览器端仅依赖 Web GUI 自带的 react。**要求 Node 22.3。**
8
12
 
9
- ## v2.0.0 新增能力(语义层)
13
+ > **致非中文用户**:本插件为中文小说分析写作而设计——句式、情感、意象等核心能力以及内置的语义模型,全部针对中文语料构建与调优。在深耕中文的同时兼顾英文等其他语言,确实超出了我目前的能力范围。若因此给您带来不便,我深感抱歉,恳请谅解。
10
14
 
11
- ### 本地语义嵌入引擎(embedding.js)
12
- - 模型:Xenova/bge-small-zh-v1.5(512 维中文向量,约 91MB),随插件分发,开箱即用;
13
- - 运行时:**@huggingface/tokenizers**(官方轻量分词,294KB 零依赖)+ onnxruntime-web(WASM 推理),本地 CPU,0 token、0 API 费用;
14
- - 懒加载:首次调用才加载(约 0.3s);加载失败自动回退纯规则,不影响任何既有功能;
15
- - 索引缓存:每书向量落盘 `.novel-writer/embedding/<书>.json`,重复检索秒开(47 万字约 3100 段,首次建索引约 20-30s,之后命中缓存)。
16
15
 
17
- ### 新工具:novel_semantic_search(语义检索)
18
- 用自然语言描述在全书中检索语义相关段落——找伏笔线索、情感场景、设定提及,**即使原文没有相同关键词也能命中**(如搜「压抑克制的时刻」能命中没有"压抑"二字的段落)。
16
+ ---
19
17
 
20
- ### novel_style_check 升级:语义级风格对比
21
- 规则指纹相似度(句式/句长/情绪)之外,新增**语义相似度**(目标章 vs 全书其余部分向量余弦),双维度判定风格一致性。
18
+ ## 安装
22
19
 
23
- ### 功能开关:语义增强(semanticEmbedding)
24
- - **默认开启(探测式)**:模型存在即自动启用;用户可在侧边栏「写作助手功能」面板关闭,关闭后语义检索返回提示、风格检查跳过语义维度;
25
- - 关闭后插件完整回退到 v1.6.0 纯规则能力。
20
+ **方式一:npm(推荐)**
26
21
 
27
- ## 历史能力(v0.3 → v1.6 累积)
28
- - 句式模式分析(九类句式分布/排列/段落/句长/情感曲线/风格指纹/密度);
29
- - 情感净化 + AI 复核(强/弱情绪词分级、污染预警 caveat、强制抽查);
30
- - 情感量化(Valence 滑动窗口:方差/斜率/矛盾指数 + 隐性意象 + 复杂度评分);
31
- - 世界观/流派/题材检测(modern/western/eastern + 15 流派 + 35 题材,主副题材);
32
- - 语用级审查(称谓/客套/仪式/语气,中西/现代禁用词);
33
- - 设定管理五张表 + 伏笔登记 + 章节摘要 + 连贯性审计 + 风格自检;
34
- - 分析缓存与报告导出(`.novel-writer/analysis/`)。
22
+ ```sh
23
+ dsh plugin --profile web add dsh-novel-writer
24
+ #
25
+ npm install dsh-novel-writer
26
+ ```
35
27
 
36
- ## 功能开关(侧边栏「写作助手功能」面板)
37
- - 总开关 enabled;autoAnalyze;14 个工具级开关;
38
- - 功能级:emotionCaveat(情感净化预警)/ genreTheme(题材与流派检测)/ emotionComplexity(情感量化)/ **semanticEmbedding(语义增强,v2.0.0)**。
28
+ **方式二:从 GitHub 安装**
39
29
 
40
- ## 目录结构
30
+ ```sh
31
+ dsh plugin --profile web add github:siweina/dsh-novel-writer#main
41
32
  ```
42
- dsh-novel-writer-v2.0.0/
43
- ├── lib/
44
- │ ├── index.js # 宿主端(14 工具 + state 路由 + 开关门禁)
45
- │ ├── analysis.js # 规则引擎(句式/情感净化/情感量化/题材)
46
- │ ├── embedding.js # 本地语义嵌入引擎(bge-small-zh ONNX)
47
- │ ├── models/ # 模型文件(onnx/model.onnx 91MB + tokenizer)
48
- │ └── client.js # 浏览器端(侧边栏面板 + 全部开关)
49
- ├── node_modules/ # @huggingface/tokenizers + onnxruntime-web(随插件分发)
50
- ├── test/ # 引擎 + client + e2e 测试
51
- └── skills/novel-writing/SKILL.md # 模型使用指南
33
+
34
+ 安装后**重启 web 应用**生效(宿主端注册 15 个工具与 state/reveal 路由,浏览器端挂载侧边栏「写作助手功能」开关面板)。
35
+
36
+ ---
37
+
38
+ ## 功能
39
+
40
+ 1. **风格画像报告**(novel_style_report):6 维测量报告——文风指纹 / 高频词汇 / 题材流派 / 情感量化 / 氛围光谱 12 轴 / 语义风格距离。**测量与判断分离**:插件只报数不贴标签,AI 判断可回传存盘(`.novel-writer/style-reports/`),续写保持风格一致。
41
+ 2. **氛围光谱 12 轴**:噩梦感 / 焦虑压抑 / 温馨治愈 / 甜宠日常 / 催泪虐心 / 黑暗残酷 / 悬疑神秘 / 热血激昂 / 荒诞无厘头 / 孤独疏离 / 文艺唯美 / 情欲暧昧——证据链可追溯,0 token。
42
+ 3. **本地语义引擎**:bge-small-zh 中文模型(23MB 随插件分发)本地 CPU 推理——`novel_semantic_search` 自然语言搜全书语义相关段落(带章节定位),语义级风格对比、语义隐性情感,懒加载 + 自动回退。
43
+ 4. **句式模式分析**:九类句式分布、排列规律、句长节奏、情感曲线、风格指纹与节奏建议,带缓存与报告导出。
44
+ 5. **情感净化 + 量化**:强/弱情绪词分级、污染源检测、caveat 预警 + AI 复核;Valence 滑动窗口 → 方差 V / 斜率 Δ / 矛盾指数 C + 隐性意象载体。
45
+ 6. **世界观与语用检测**:文化基准自动判断(西/东/混合)+ 置信度;speechStyle 称谓/客套/仪式/语气规范;题材流派 + 网文信号。
46
+ 7. **写作辅助全家桶**:伏笔登记表 / 设定五张表(人物·地点·道具·时间线·世界观)/ 章节摘要 / 连贯性审计 / 批量导入 / 风格自检 / 续写辅助。
47
+ 8. **全工具 UI 开关**:侧边栏「写作助手功能」面板(总开关 + 工具开关分组 + 功能开关),大白话文案,显示数据目录占用与语义引擎状态。
48
+
49
+ ---
50
+
51
+ ## 提供的工具(15 个)
52
+
53
+ | 工具 | 说明 |
54
+ |------|------|
55
+ | `novel_books` | 列出章节库全部作品 |
56
+ | `novel_chapters` | 列出某作品章节清单 |
57
+ | `novel_read` | 阅读某章正文(分段) |
58
+ | `novel_keywords` | 关键词:二字组/三字组/疑似人名 |
59
+ | `novel_new_chapter` | 创建新章节文件 |
60
+ | `novel_import` | 原稿件批量导入/分类 |
61
+ | `novel_sentence_analysis` | 句式模式分析(九类/情感净化/量化/曲线/指纹) |
62
+ | `novel_sentence_config` | 查看/修改工具与功能开关 |
63
+ | `novel_style_check` | 风格自检(规则+语义双维度) |
64
+ | `novel_style_report` | **风格画像报告**(6 维测量 + AI 判断分离) |
65
+ | `novel_plot` | 伏笔/剧情线登记表 |
66
+ | `novel_settings` | 设定管理(人物/地点/道具/时间线/世界观) |
67
+ | `novel_summary` | 章节摘要(长书续写辅助) |
68
+ | `novel_continuity_check` | 连贯性审计(设定矛盾+语用冲突候选) |
69
+ | `novel_semantic_search` | 语义检索(本地 embedding,0 token) |
70
+
71
+ ---
72
+
73
+ ## 配置
74
+
75
+ ```yaml
76
+ - id: novel-writer
77
+ config:
78
+ root: 'D:/我的小说库'
79
+ allowLanState: false # true=局域网访问 GUI 时也允许保存开关
52
80
  ```
53
81
 
54
- ## v2.1.0 新增:氛围光谱 + 多方向意象表
55
- - **氛围光谱(vibe)**:detect 输出 10 轴氛围坐标(噩梦感/焦虑压抑/温馨治愈/甜宠日常/催泪虐心/黑暗残酷/悬疑神秘/热血激昂/荒诞无厘头/孤独疏离)+ 组合结论 + 置信度 + 证据链——设定型气质(类克苏鲁等)以数值表达,不贴死标签;
56
- - **多方向意象表**:变色龙词(雨/烛火/火光/夜/灯…)按语境触发词裁决方向,触发词未命中时用本地语义引擎与正/负原型句比余弦,仍不确定则双计分并标记歧义——修复"甜宠文误判负向 100%"类问题;
57
- - **词表**:内置大连理工七类情感词表(27,413 词)供意象/情感扩展。
58
-
59
- ## v2.2.0 新增:网文信号层(vibe 三路补强)
60
- - **动作/套路词群**:164 词(含 webnovel-writer genre-tropes 现成套路词:退婚/打脸/秒杀/追妻火葬场…),按 10 轴分组,封顶权重(每轴 ≤0.3);
61
- - **题材联动**:题材命中 → 相关轴加分(豪门总裁→甜宠、系统流→荒诞/热血、玄幻→热血…),仅当该轴已有基础信号时触发;
62
- - **情感直给词密度**:joy/fear/sorrow/anger 词计数 → 对应轴密度加分;
63
- - **防污染四道防线**:加信号不换引擎 / 低权重封顶 / 来源标注可审计 / features.webnovelVibe 开关可回退;三组回归(公版文学 8 本 + 手写样本 6 本 + 网文 6 本)验证无污染;
64
- - **词表资源**:lib/lexicons/webnovel-tropes.md(现成套路模板)+ dutir_seven.json(大连理工 27,413 情感词)。
65
-
66
- ## v2.5.0 新增:风格画像报告(测量与判断分离)
67
- - **novel_style_report(第 15 个工具)**:聚合 6 维测量数据(文风指纹/高频词汇/题材流派/情感量化/氛围光谱 12 轴/语义风格距离)输出结构化报告;
68
- - **插件只报数不贴标签**:氛围光谱 12 轴(新增 文艺唯美/情欲暧昧),砍掉规则结论文案——判断交给大模型;
69
- - **AI 判断回传存盘**:AI 结合报告给出风格气质判断 → aiJudgment 参数回传 → 存入 .novel-writer/style-reports/<书>.json,后续 action=get 读取,续写保持风格一致;
70
- - **语义风格距离**:12 组风格原型句 × 全书向量(本地 embedding,0 token)——实测示例书:克苏鲁诡异 0.79/压抑致郁 0.79。
71
-
72
- ## 体积说明
73
- **zip 约 31MB**(含本地语义模型与 WASM 运行时,解压后代码+模型约 130MB);已移除 transformers.js/onnxruntime-node/sharp 全家桶(省 85%)。如磁盘紧张可在「语义增强」开关关闭后删除 `lib/models/` 与 `node_modules/`,插件回到纯规则模式。
82
+ ---
83
+
84
+ ## 数据目录
85
+
86
+ `<书库根>/.novel-writer/`:`plots`(伏笔)/ `settings`(设定)/ `summaries`(摘要)/ `analysis`(分析报告)/ `audits`(审计)/ `embedding`(语义索引)/ `style-reports`(风格画像)。
87
+
88
+ ---
89
+
90
+ ## 许可证
91
+
92
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-novel-writer",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "小说写作助手插件(v2.6.0):句式/情感/意象分析、伏笔设定管理、本地语义检索、氛围光谱、风格画像报告;增量索引与缓存压缩优化。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",