@waterwx/dsh-novel-forge 2.2.0 → 2.4.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.
- package/LICENSE +661 -202
- package/README.md +20 -4
- package/lib/client.js +637 -619
- package/lib/index.js +1424 -1127
- package/lib/types/engine.d.ts +3 -8
- package/lib/types/prompt-cache.d.ts +43 -0
- package/lib/types/prompts/adapt.d.ts +21 -0
- package/lib/types/prompts/audit.d.ts +15 -0
- package/lib/types/prompts/bible.d.ts +10 -0
- package/lib/types/prompts/catalog.d.ts +40 -0
- package/lib/types/prompts/characters.d.ts +19 -0
- package/lib/types/prompts/common.d.ts +9 -0
- package/lib/types/prompts/digest.d.ts +27 -0
- package/lib/types/prompts/facts.d.ts +26 -0
- package/lib/types/prompts/foreshadow.d.ts +10 -0
- package/lib/types/prompts/market.d.ts +18 -0
- package/lib/types/prompts/outline.d.ts +25 -0
- package/lib/types/prompts/plan.d.ts +22 -0
- package/lib/types/prompts/plotlines.d.ts +21 -0
- package/lib/types/prompts/polish.d.ts +22 -0
- package/lib/types/prompts/review.d.ts +30 -0
- package/lib/types/prompts/world.d.ts +13 -0
- package/lib/types/prompts/writing.d.ts +29 -0
- package/lib/types/protocol.d.ts +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<img alt="version" src="https://img.shields.io/badge/version-1.3.0--alpha-blue" />
|
|
5
5
|
<img alt="DSH peer" src="https://img.shields.io/badge/DSH%20peer-0.1.2--alpha.3-blue" />
|
|
6
|
-
<img alt="License" src="https://img.shields.io/badge/license-
|
|
6
|
+
<img alt="License" src="https://img.shields.io/badge/license-AGPL_3.0_only-blue" />
|
|
7
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
8
|
</p>
|
|
9
9
|
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
| **失败分级(fail-stop)**:契约类错误(参数越界、章节不在计划中)**不重试**并记账,网络 / 超时 / 限流类才按次数重试;同一调用同参数已失败过会被直接挡下,避免无效循环 | **Failure classification**: contract errors are not retried and are recorded; only transient errors retry; a repeated identical failed call is blocked |
|
|
98
98
|
| **备用模型与故障恢复**:只对网络 / 超时 / 限流 / 服务端 / 额度类失败切换备用模型;用户取消与参数错误不切换;备用也失败时抛**主模型原始错误**保留第一现场;正文生成 / 修订 / 润色仅在「一个字都没产出」时才换模型,杜绝重复生成 | **Fallback model & recovery**: switches only on transient failures, never on cancellation or bad params; rethrows the primary error; streaming writes only fall back when zero output was produced |
|
|
99
99
|
| **生产单(批量连写)**:区间 / 新增 N 章一键下单,计划补足 + 逐章生成 + 被拒分级处理(无 high 豁免 / 修订 + 验证 / 两轮不过转人工)+ 出章即核对曲线,支持暂停 / 继续 / 停止与断点续跑(`run-state.json`)。**全局单实例、一次一本书、逐章串行**,批次绑定下单时的书目录(换书不打断也不切换);页面内置「运行说明」折叠块讲清并发 / 绑定 / 暂停续跑 / 同章冲突 | **Production run**: line up a range, auto-plan, generate chapter-by-chapter, tiered declined handling, curve check on completion, pause / resume / stop with checkpointing; single global instance, **one book at a time, strictly serial**, batch bound to the book it was started from |
|
|
100
|
-
| **Token / 耗时记账**:实况帧带输入 / 输出 / 思考 / 缓存 token、总耗时、首字耗时;`/status` 返回本次运行(进程内)汇总与按用途分组;面板可查看**每次调用实际发送的 Prompt**(system + user
|
|
100
|
+
| **Token / 耗时记账**:实况帧带输入 / 输出 / 思考 / 缓存 token、总耗时、首字耗时;`/status` 返回本次运行(进程内)汇总与按用途分组;面板可查看**每次调用实际发送的 Prompt**(system + user)。系统提示词按**固定规则 → 本书资料 → 本章动态**三层组装——永不变的排最前、次次都变的垫尾,跨章重复前缀有机会命中厂商输入缓存;汇总行如实展示命中用量与占输入的比例(以上报为准,不承诺比例) | **Token & latency accounting**: live frames carry in/out/reasoning/cached tokens, total and first-token latency; per-run summary grouped by purpose; inspect the actual prompt sent per call. System prompts are assembled in three layers (fixed rules → book material → per-chapter dynamics) so repeated prefixes across chapters have a chance to hit the provider's input cache; the summary row shows cached usage and its share of input as reported, with no promised ratio |
|
|
101
101
|
| **改编模式**:上传全文 → 设定卡片 / 可改范围 → 确认改编维度 → 生成映射表 / 规则 / 影响清单 → 替换 / 重写 → 保存为新书(原书保留) | **Adaptation mode**: upload full text → setting cards / mutability → confirm dimensions → mappings / rules / impacts → replace or rewrite → save as a new book |
|
|
102
102
|
| **知识库 / RAG**:书内自由参考文档,生成时按章节检索注入 | **Knowledge base / RAG**: in-book reference docs, retrieved & injected per chapter |
|
|
103
103
|
|
|
@@ -275,7 +275,7 @@ node scripts/check-third-party.mjs # 来源卫生:不得出现外部项目
|
|
|
275
275
|
|
|
276
276
|
```
|
|
277
277
|
src/ 插件源码(宿主半)
|
|
278
|
-
engine.ts 写作 / 审稿 / 润色 / 提炼 / 导出等全部 LLM
|
|
278
|
+
engine.ts 写作 / 审稿 / 润色 / 提炼 / 导出等全部 LLM 管线(提示词已迁出,见 prompts/)
|
|
279
279
|
routes.ts Web 路由(/api/dsh-novel-forge/*)
|
|
280
280
|
run.ts 生产单(批量章节生产的标准执行器)
|
|
281
281
|
revision.ts 修订仲裁:三类建议合并成一份指令 + 多源验证基准
|
|
@@ -287,11 +287,13 @@ src/ 插件源码(宿主半)
|
|
|
287
287
|
llm-retry.ts 备用模型与失败恢复
|
|
288
288
|
llm-live.ts 实况帧 + 用量账本 + Prompt 环形留存
|
|
289
289
|
prompt-slots.ts 提示词槽位
|
|
290
|
+
prompt-cache.ts 提示词分层组装(固定/本书/本章三层,服务输入缓存前缀)
|
|
291
|
+
prompts/ 系统提示词按域拆分 + catalog 注册表(改文案去域文件,不在 engine.ts 新起一段)
|
|
290
292
|
assistant.ts AI 编辑 Agent
|
|
291
293
|
assets.ts 内置写作资产(自研表述)
|
|
292
294
|
client/ 浏览器半(React + CSS Modules:面板 / 工作台 / 阅读器)
|
|
293
295
|
lib/ 构建产物(lib/index.js 宿主 / lib/client.js 浏览器)
|
|
294
|
-
tests/
|
|
296
|
+
tests/ 38 个 vitest 测试文件(475 个用例)
|
|
295
297
|
scripts/ 构建与门禁脚本(含 check-third-party.mjs 来源卫生门禁、release.mjs)
|
|
296
298
|
docs/ 设计文档(design-direction.md = 面板样式现行基准)+ archive/ 历史归档
|
|
297
299
|
package.json 包定义(dsh.bundle.patch + dsh.client 声明)
|
|
@@ -302,6 +304,20 @@ vitest.config.ts 测试范围(tests/**/*.test.ts)
|
|
|
302
304
|
|
|
303
305
|
---
|
|
304
306
|
|
|
307
|
+
## 许可证 / License
|
|
308
|
+
|
|
309
|
+
本项目采用 **GNU Affero 通用公共许可证第三版(AGPL-3.0-only)**——完整文本见
|
|
310
|
+
[`LICENSE`](LICENSE),第三方组件署名见 [`NOTICE`](NOTICE)。
|
|
311
|
+
|
|
312
|
+
**为什么选它**:本插件是服务端组件,AGPL-3.0-only 第 13 条保证任何修改后的版本若作为
|
|
313
|
+
网络服务运行,其使用者都能拿到对应源码——对写作工具工作台来说,这是「改进流回
|
|
314
|
+
上游」的硬保证,而不是口头约定。版本号钉死为 `-only`,不随时间漂移。
|
|
315
|
+
|
|
316
|
+
**版本边界**:v2.3.0 及以前的发布版以其发布时的 **Apache-2.0** 许可为准;
|
|
317
|
+
自 v2.4.0 起为 AGPL-3.0-only。许可证在分发时授予,已发布旧版的既有权利不受影响。
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
305
321
|
## English
|
|
306
322
|
|
|
307
323
|
# AI Novel Forge
|