dsh-novel-write-engine 0.2.1 → 0.2.3
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/CHANGELOG.md +60 -1
- package/README.md +124 -57
- package/briefs/P5.md +22 -1
- package/briefs/P8.md +67 -1
- package/lib/client.js +591 -55
- package/lib/index.d.ts +393 -37
- package/lib/index.js +4039 -1997
- package/lib/types/client/dto.d.ts +45 -4
- package/lib/types/client/panel.d.ts +1 -1
- package/lib/types/client/viewmodel.d.ts +50 -3
- package/lib/types/constants.d.ts +4 -1
- package/lib/types/types.d.ts +37 -2
- package/package.json +1 -1
- package/rulepacks/default.yaml +4 -2
- package/skills/entry.md +7 -0
package/briefs/P8.md
CHANGED
|
@@ -28,11 +28,77 @@
|
|
|
28
28
|
- `timeline` 的键是 `summary.events` 的下标(字符串)。
|
|
29
29
|
- `relationships` 的键是 `"甲|乙"`;每项至少 `{ "action": "created", "type": "关系类型", "description": "..." }`,缺 `type` 会被拒绝。
|
|
30
30
|
- `characters` 的键是人物名;`world` 的键是新地点/能力/物品名;`foreshadows` 的键是 summary 里的 planted key 或已分配的 `FS-xxx`。
|
|
31
|
+
- `foreshadows` 的 `summary.foreshadows.resolved` 里列出的 key,delta 必须写 `action: "updated"`;引擎会把 `resolved_at` 写成当前章,并把 `note`/`new_info` 追加到 `advance_log`。示例:`"FS-002": {"action":"updated","note":"欠条被收回,债清了","new_info":true}`。
|
|
32
|
+
|
|
33
|
+
## 最小 schema
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"characters": {
|
|
38
|
+
"<人物名>": {
|
|
39
|
+
"action": "created|updated|no_change",
|
|
40
|
+
"reason": "no_change 必填;其余建议写",
|
|
41
|
+
"role": "protagonist|supporting|antagonist|extra(可选)",
|
|
42
|
+
"profile": {},
|
|
43
|
+
"current_state": { "resources": { "<资源名>": 0 } },
|
|
44
|
+
"growth": { "change": "string", "status_change": "string" }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"foreshadows": {
|
|
48
|
+
"<planted key 或 FS-xxx>": {
|
|
49
|
+
"action": "created|updated|no_change",
|
|
50
|
+
"title": "可读标签",
|
|
51
|
+
"anchor": "正文逐字原句,至少 8 字",
|
|
52
|
+
"description": "string",
|
|
53
|
+
"note": "resolve/advance 时写清如何兑现",
|
|
54
|
+
"new_info": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"timeline": {
|
|
58
|
+
"<summary.events 下标>": {
|
|
59
|
+
"action": "created",
|
|
60
|
+
"story_time": "Day 3 清晨",
|
|
61
|
+
"description": "string",
|
|
62
|
+
"location": "string",
|
|
63
|
+
"characters": ["人物名"]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"world": {
|
|
67
|
+
"<新地点/能力/物品名>": {
|
|
68
|
+
"action": "created|updated|no_change",
|
|
69
|
+
"kind": "location|ability|artifact|faction|rule",
|
|
70
|
+
"description": "string"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"relationships": {
|
|
74
|
+
"<甲|乙>": {
|
|
75
|
+
"action": "created|updated|no_change",
|
|
76
|
+
"type": "关系类型(created 必填)",
|
|
77
|
+
"description": "string",
|
|
78
|
+
"note": "updated 时写变化"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
错误会带上 `expected` 形态和收到的字段值,例如 `characters.陈嘉树.current_state must be an object; expected {"resources":{"港币":-3},...}`。不要猜字段名,按报错补齐即可。
|
|
85
|
+
|
|
86
|
+
## summary 与 delta 的联动(归档前必核)
|
|
87
|
+
|
|
88
|
+
`novel_archive` **不接受 summary**;它校验的是 P3/P5 已经固定的 draft summary。delta 必须与这份 summary 对齐:
|
|
89
|
+
|
|
90
|
+
- `characters` 里每个 `action:"created"` 的人物名,必须出现在 draft `summary.characters_appeared`。
|
|
91
|
+
- `world` 里每个 `action:"created"` 的 location / ability / artifact,必须出现在 draft `summary.new_elements` 的对应数组,且 `kind` 一致;`faction` / `rule` 只需正文出现并按 kind 写入,`summary.new_elements` 没有对应数组。
|
|
92
|
+
- `timeline` 的键必须是 draft `summary.events` 的下标(字符串)。
|
|
93
|
+
- `relationships` 的两端必须已在 `characters` 里声明(本章 created 或台账已有),否则先声明人物。
|
|
94
|
+
|
|
95
|
+
如果 summary 与本章事实不符,**不要直接改 delta 硬凑**:先 `novel_brief P5` → `novel_revise` 修正正文和 summary,再重走 P4/P6/P8。归档阶段没有第二次 summary 入口。
|
|
96
|
+
|
|
31
97
|
- **伏笔的 title 是可读标签,anchor 才是校验证据**:`title` 可以写「船费债」这样的短语;要归档,请把正文原句放进 `anchor`(summary 的 planted 项或 delta 项都行,至少 8 个字符)。没有 `anchor` 时,`title` 必须逐字出现在正文里,否则 `ENGINE_DELTA_UNVERIFIED`。示例:`{"action":"created","title":"船费债","anchor":"三百蚊的船费先欠着","description":"欠船费三百蚊"}`。
|
|
32
98
|
- 归档失败的报错会指出字段、值和缺失的锚点;不要把 title 改成碎片来“凑命中”,补 `anchor` 即可。
|
|
33
99
|
- 第一人称的叙述者若在 `narrator` 里声明为 `陈默(第一人称「我」)`,正文用「我」也视为出现,但角色键仍写 `陈默`。
|
|
34
100
|
- 每个新实体至少写 `action: "created"`;已存在且没变化写 `action: "no_change", reason: "..."`。
|
|
35
|
-
- `world` 新实体还要写 `kind: "location"|"ability"|"artifact"` 和 `description`。
|
|
101
|
+
- `world` 新实体还要写 `kind: "location"|"ability"|"artifact"|"faction"|"rule"` 和 `description`。
|
|
36
102
|
- `state_delta` 可以是对象,也可以是 JSON 字符串;引擎两者都接受。
|
|
37
103
|
- 未知伏笔 key、未声明角色、`no_change` 缺原因都会被 `ENGINE_DELTA_UNVERIFIED` 拒绝,引擎不会猜。
|
|
38
104
|
- 不要传正文、不要传评分、不要传轮次。`handoff` 可选,用于覆盖卷/幕/进度。
|