@cloud411716/fancy-webnovel 4.29.1 → 4.30.1

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.
@@ -36,14 +36,14 @@ export function helpText() {
36
36
  /fancy-material help 显示本帮助
37
37
 
38
38
  说明:
39
- - 素材是原子积木,每条有 id / kind / name / tags / genres / group_id / subkind / note / source;group_id 和 subkind 可选。
39
+ - 素材是原子积木,每条有 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source;世界/组/等级序号可选。
40
40
  - 素材库还支持 subject / tropes / narrative / traits / roles / relations / moods / settings 等多层 facet;它们主要由 fancy-douyin 分析结果填充,fancy-material 生成时可省略。
41
41
  - subkind 是 kind 下的二级分类(例如 kind=特殊体质,subkind=病理变异);用于同一 kind 内再分组。
42
42
  - note 可选,最多 300 字;都市类地名/势力/能力名优先写内层身份,表层伪装名写 note。
43
43
  - 命名/措辞按题材文化体系适配:东方仙侠用诀/式/法/印,都市高武用令/条/章/程,西幻用契/印/律/颂,科幻用协议/阈值/序列,历史用司/署/营/旗,悬疑用规则/现象/编号,言情以意象词为主。
44
44
  - 禁止用质量评价词做 tags:精品、高价值、文笔好、强力、神秘。
45
45
  - tags 和 genres 都是数组:tags 3–8 个,genres 1–10 个;一个素材可以同时适配多个题材/标签。
46
- - 每次运行默认每个 kind 新增 20 条;每批最多 10 条,插件自动分批直到完成。
46
+ - 每次运行默认每个表面素材池新增 50 条;能力/势力每个类别各 50 条;能力核心和等级阶梯按套生成。每批最多 10 条。
47
47
  - facet 多选是**交集**:同一层选中的每一项都必须同时满足,不是任选其一。例如题材选 都市+异能+脑洞,素材必须同时满足三种。
48
48
  - 选「都市异能」会同时按「都市」和「异能」处理;选「悬疑脑洞」会同时按「悬疑」和「脑洞」处理,两个条件都必须满足。
49
49
  - 题材/方向/定位来自 _novel_topic_suggestion.json 时只做推荐值;用户本次选择优先,fancy-material 不修改该文件。
@@ -67,7 +67,7 @@ ${genreBlock}
67
67
  ${kindBlock}`;
68
68
  }
69
69
 
70
- export const DEFAULT_TARGET_PER_KIND = 20;
70
+ export const DEFAULT_TARGET_PER_KIND = 50;
71
71
  export const DEFAULT_BATCH_SIZE = 10;
72
72
 
73
73
  /**
@@ -92,7 +92,7 @@ function compactRules(genres, queryScript, workspace, sourceFixed = 'builtin') {
92
92
  '- 只写本批指定的一个 kind;不要把其它 kind 混进同一个文件。',
93
93
  '- 每条必须独立、具体、可复用;拒绝“火红、耀眼、神秘、强大”这类空泛词。',
94
94
  '- 命名类必须有具体锚点;拒绝“复原眼、章眼、旧仓单、神秘剑、黑色长刀”这类废名。',
95
- '- 字段只能是 id / kind / name / tags / genres / group_id / subkind / note / source;'
95
+ '- 字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source;'
96
96
  + 'source 写 ' + sourceFixed + ';tags 3–8 个,genres 1–10 个。',
97
97
  '- tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去;'
98
98
  + '例如「都市高武」可以写 tags: ["都市","高武","都市高武", ...]。',
@@ -142,6 +142,9 @@ export function generationPrompt({
142
142
  styleSummary = '',
143
143
  worldBlock = '',
144
144
  worldSummary = '',
145
+ subkind = '',
146
+ groupId = '',
147
+ worldId = '',
145
148
  }) {
146
149
  const lines = [];
147
150
  if (includeBase && base) {
@@ -196,6 +199,9 @@ export function generationPrompt({
196
199
  const label = kindLabel ? '(' + kindLabel + ')' : '';
197
200
  lines.push('- kind 队列:第 ' + kindIndex + ' / ' + kindTotal + ' 个');
198
201
  lines.push('- 本批 kind:`' + kind + '`' + label);
202
+ if (subkind) lines.push('- 本批 subkind:`' + subkind + '`(同一批所有记录都必须写这个 subkind)');
203
+ if (groupId) lines.push('- 本批 group_id:`' + groupId + '`(同一批所有记录都必须写这个 group_id)');
204
+ if (worldId) lines.push('- 本批 world_id:`' + worldId + '`(同一批所有记录都必须写这个 world_id)');
199
205
  lines.push('- 本次该 kind 配额:' + targetPerKind + ' 条(追加到数据库,不是库内上限)');
200
206
  lines.push('- 本次已生成:' + generated + ' 条');
201
207
  lines.push('- 本次还需:' + Math.max(0, targetPerKind - generated) + ' 条');
@@ -220,13 +226,16 @@ export function generationPrompt({
220
226
 
221
227
  lines.push('');
222
228
  lines.push('写入要求:');
223
- lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / group_id / subkind / note / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
229
+ lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
224
230
  lines.push('2. 命名/措辞/体例必须匹配题材文化体系,禁止跨题材串用后缀;都市类地名/势力/能力名优先写内层身份,表层日常伪装名写 note(最多 300 字)。');
225
231
  lines.push('2.1 本次 facet 是交集:同一层多选全部同时成立;素材必须同时满足所有选中层,不能只取一部分。选中的 tropes / moods / settings / roles / relations 要原样写进对应数组。');
226
232
  lines.push('3. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
227
233
  lines.push('4. 不要在文件里写 Markdown 代码围栏、标题、解释、前后缀。');
228
234
  lines.push('5. 可以直接写 JSONL,也可以使用 Python/Node 生成器;生成器放 <工作区>/.tmp/,输出必须是目标 JSONL。');
229
235
  lines.push('6. 本批文件只放本批素材;数据库导入只追加,不会覆盖已有素材。');
236
+ if (worldId) lines.push('6.1 每条记录必须写 world_id: `' + worldId + '`。');
237
+ if (subkind) lines.push('6.2 每条记录必须写 subkind: `' + subkind + '`。');
238
+ if (groupId) lines.push('6.3 每条记录必须写 group_id: `' + groupId + '`。');
230
239
  lines.push('7. 生成前先用查询脚本/索引检查候选名字;同 kind 同 name 已存在就换一个。');
231
240
  lines.push('8. 写完后运行 validate.js;失败就按错误修正,直到通过。');
232
241
  lines.push('9. 不要自己运行导入命令;插件会负责最终校验、按 kind+name 去重并追加导入。');
@@ -251,6 +260,160 @@ export function generationPrompt({
251
260
  return lines.join('\n');
252
261
  }
253
262
 
263
+
264
+ function groupHeader({ base, includeBase, worldSummary, styleSummary, modes = '' }) {
265
+ const lines = [];
266
+ if (includeBase && base) {
267
+ lines.push(String(base || '').trim(), '', '---', '');
268
+ } else {
269
+ lines.push('## 继续生成(同一素材库)', '');
270
+ lines.push('继续遵守最初提示词中的角色、写作原则、质量红线、命名标准、描写标准、查询与追加规则。不要重新解释规则,直接写本批素材。', '');
271
+ if (worldSummary) lines.push('## 本批世界母体锁定(必须保持)', '', worldSummary, '');
272
+ }
273
+ if (styleSummary) lines.push('## 本批风格锁定(必须保持)', '', styleSummary, '');
274
+ if (modes) lines.push(modes, '');
275
+ return lines;
276
+ }
277
+
278
+ function groupTail({ attempt, failures, target, validateScript, queryScript, existingIndex, existingTotal }) {
279
+ const lines = [];
280
+ if (validateScript) lines.push('- 格式校验脚本:`' + validateScript + '`');
281
+ if (queryScript) lines.push('- 查询脚本:`' + queryScript + '`');
282
+ if (existingIndex) lines.push('- 已有素材索引:`' + existingIndex + '`');
283
+ if (Number.isFinite(existingTotal)) lines.push('- 本次题材下已有素材:' + existingTotal + ' 条');
284
+ lines.push('');
285
+ lines.push('写入要求:');
286
+ lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;不要 Markdown 围栏、标题、解释、前后缀。');
287
+ lines.push('2. 同一批所有记录必须属于同一组,使用同一个 `group_id`、同一个 `subkind` 和同一个 `world_id`。');
288
+ lines.push('3. tags 3–8 个;genres 必须原样包含本次全部题材,缺一个都算废稿;source 固定写 builtin。');
289
+ lines.push('4. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
290
+ lines.push('5. 写完后运行 validate.js;失败就按错误修正,直到通过。');
291
+ lines.push('6. 不要自己运行导入命令;插件会负责校验和追加导入。');
292
+ lines.push('7. 写完后只回复:已写入 <目标文件路径>;然后结束本轮。');
293
+ if (attempt > 1) {
294
+ lines.push('', '## 上次文件没有通过校验', '');
295
+ const list = Array.isArray(failures) ? failures : [failures];
296
+ for (const failure of list) {
297
+ const content = String(failure || '').trim();
298
+ if (content) lines.push('```text', content, '```');
299
+ }
300
+ lines.push('', '请只修正上面这些问题,重新写入同一个目标文件;不要把已经正确的素材删掉重写。');
301
+ }
302
+ return lines;
303
+ }
304
+
305
+ export function abilityCorePrompt({
306
+ base,
307
+ target,
308
+ workspace,
309
+ batchId,
310
+ attempt = 1,
311
+ failures = [],
312
+ genres = [],
313
+ category = '',
314
+ groupId = '',
315
+ worldId = '',
316
+ targetSets = 3,
317
+ generatedSets = 0,
318
+ requestSets = 1,
319
+ includeBase = true,
320
+ validateScript,
321
+ queryScript,
322
+ existingIndex,
323
+ existingTotal,
324
+ styleSummary = '',
325
+ worldBlock = '',
326
+ worldSummary = '',
327
+ }) {
328
+ const lines = groupHeader({
329
+ base,
330
+ includeBase,
331
+ worldSummary,
332
+ styleSummary,
333
+ modes: '## 本批是能力核心组(允许 6 个 kind,必须成套)\n\n'
334
+ + '本次不要按单 kind 写。你要生成一套完整的能力核心,恰好 6 条记录,六条互相解释同一个能力。',
335
+ });
336
+ lines.push('## 本次运行', '');
337
+ lines.push('- 工作区目录:' + workspace);
338
+ lines.push('- 目标文件(**绝对路径**):`' + target + '`');
339
+ lines.push('- 批次 ID:`' + batchId + '`');
340
+ lines.push('- 能力类别:`' + category + '`');
341
+ lines.push('- 固定 group_id:`' + groupId + '`');
342
+ lines.push('- 固定 subkind:`' + category + '`');
343
+ lines.push('- 固定 world_id:`' + worldId + '`');
344
+ lines.push('- 本次目标:' + targetSets + ' 套;已生成:' + generatedSets + ' 套;本批写:' + requestSets + ' 套');
345
+ lines.push('- 本批要写:**恰好 6 条记录**,kind 必须分别是:');
346
+ lines.push(' - `ability_mechanism`(机制)');
347
+ lines.push(' - `ability_activation`(发动条件)');
348
+ lines.push(' - `ability_cost`(代价)');
349
+ lines.push(' - `ability_limit`(限制)');
350
+ lines.push(' - `ability_counter`(反制)');
351
+ lines.push(' - `power_source`(力量来源)');
352
+ lines.push('- 六条必须指向同一个能力、同一套规则;机制、代价、限制、反制要能互相对上。');
353
+ lines.push('- 每条都要有 `name`、`tags`、`genres`、`note`;`note` 写具体后果,不写空泛说明。');
354
+ if (Array.isArray(genres) && genres.length) {
355
+ lines.push('- genres 必须同时包含:' + genres.join('、'));
356
+ }
357
+ lines.push('');
358
+ lines.push(...groupTail({ attempt, failures, target, validateScript, queryScript, existingIndex, existingTotal }));
359
+ return lines.join('\n');
360
+ }
361
+
362
+ export function rankLadderPrompt({
363
+ base,
364
+ target,
365
+ workspace,
366
+ batchId,
367
+ attempt = 1,
368
+ failures = [],
369
+ genres = [],
370
+ kind = 'power_rank',
371
+ kindLabel = '',
372
+ subkind = '',
373
+ groupId = '',
374
+ worldId = '',
375
+ targetSets = 3,
376
+ generatedSets = 0,
377
+ requestSets = 1,
378
+ levels = 10,
379
+ includeBase = true,
380
+ validateScript,
381
+ queryScript,
382
+ existingIndex,
383
+ existingTotal,
384
+ styleSummary = '',
385
+ worldBlock = '',
386
+ worldSummary = '',
387
+ }) {
388
+ const lines = groupHeader({
389
+ base,
390
+ includeBase,
391
+ worldSummary,
392
+ styleSummary,
393
+ modes: '## 本批是等级阶梯(同一 kind,必须成套有序)\n\n'
394
+ + '本次不要生成散装等级名。你要生成一套完整的等级阶梯,每级一条记录。',
395
+ });
396
+ lines.push('## 本次运行', '');
397
+ lines.push('- 工作区目录:' + workspace);
398
+ lines.push('- 目标文件(**绝对路径**):`' + target + '`');
399
+ lines.push('- 批次 ID:`' + batchId + '`');
400
+ lines.push('- 本批 kind:`' + kind + '`' + (kindLabel ? '(' + kindLabel + ')' : ''));
401
+ lines.push('- 体系/势力类型:`' + subkind + '`');
402
+ lines.push('- 固定 group_id:`' + groupId + '`');
403
+ lines.push('- 固定 subkind:`' + subkind + '`');
404
+ lines.push('- 固定 world_id:`' + worldId + '`');
405
+ lines.push('- 本次目标:' + targetSets + ' 套阶梯;已生成:' + generatedSets + ' 套;本批写:' + requestSets + ' 套');
406
+ lines.push('- 本批要写:一套 **8–12 级**的完整阶梯,建议 ' + levels + ' 级。');
407
+ lines.push('- 每条记录必须写 `rank_order`:最低级为 1,往上递增,不能断号、不能重复。');
408
+ lines.push('- `name` 是等级/职务名;`note` 写这一级的权责、门槛、待遇或代价;上下级关系要能看出来。');
409
+ if (Array.isArray(genres) && genres.length) {
410
+ lines.push('- genres 必须同时包含:' + genres.join('、'));
411
+ }
412
+ lines.push('');
413
+ lines.push(...groupTail({ attempt, failures, target, validateScript, queryScript, existingIndex, existingTotal }));
414
+ return lines.join('\n');
415
+ }
416
+
254
417
  function formatDuration(ms) {
255
418
  const total = Math.max(0, Math.round(Number(ms) || 0) / 1000);
256
419
  const hours = Math.floor(total / 3600);
@@ -288,10 +451,10 @@ export function generationRunText({
288
451
  : ((incomplete.length || notStarted.length || stopReason) ? '⚠️ 素材生成未全部完成' : '✅ 素材生成完成');
289
452
  const lines = [
290
453
  title,
291
- '目标:本次每个 kind 新增 ' + targetPerKind + ' 条;每批最多 ' + batchSize + ' 条',
454
+ '目标:表面素材池每个新增 ' + targetPerKind + ' 条;能力核心/等级阶梯按套生成;每批最多 ' + batchSize + ' 条',
292
455
  '数据库:' + database,
293
456
  ];
294
- if (queue.length) lines.push('本次队列:' + queue.length + ' 个 kind');
457
+ if (queue.length) lines.push('本次队列:' + queue.length + ' 个项目');
295
458
  if (completed.length) lines.push('本次完成:' + completed.length + ' 个 kind');
296
459
  if (notStarted.length) lines.push('未开始:' + notStarted.length + ' 个 kind');
297
460
  if (incomplete.length) {
@@ -13,7 +13,7 @@ import { MATERIAL_KINDS } from './kinds.js';
13
13
  import { MATERIAL_FACET_FIELDS, MATERIAL_FACET_LIMITS, MATERIAL_TAG_LIMITS, MATERIAL_SUBJECT_MAX } from './facets.js';
14
14
 
15
15
  const ALLOWED = new Set([
16
- 'id', 'kind', 'name', 'subject', 'tags', 'group_id', 'subkind', 'note', 'source',
16
+ 'id', 'kind', 'name', 'subject', 'tags', 'group_id', 'subkind', 'world_id', 'rank_order', 'note', 'source',
17
17
  ...MATERIAL_FACET_FIELDS,
18
18
  ]);
19
19
  const QUALITY_TAGS = new Set(['精品', '高价值', '文笔好', '强力', '神秘']);
@@ -29,7 +29,7 @@ function usage() {
29
29
 
30
30
  检查:
31
31
  - 一行一个合法 JSON 对象
32
- - 字段只能是 id / kind / name / subject / tags / genres / tropes / narrative / traits / roles / relations / moods / settings / group_id / subkind / note / source
32
+ - 字段只能是 id / kind / name / subject / tags / genres / tropes / narrative / traits / roles / relations / moods / settings / world_id / group_id / subkind / rank_order / note / source
33
33
  - source 只能是 builtin / other
34
34
  - builtin 的 kind 必须在允许列表内,id 以 kind 开头
35
35
  - other 的 kind 不受限制
@@ -105,6 +105,18 @@ function validate(raw, line) {
105
105
  errors.push('第 ' + line + ' 行:subkind 不能超过 ' + SUBKIND_MAX + ' 字');
106
106
  }
107
107
  }
108
+ if (raw.world_id !== undefined) {
109
+ if (typeof raw.world_id !== 'string' || !raw.world_id.trim()) {
110
+ errors.push('第 ' + line + ' 行:world_id 必须是非空字符串');
111
+ } else if (raw.world_id.trim().length > 120) {
112
+ errors.push('第 ' + line + ' 行:world_id 不能超过 120 字符');
113
+ }
114
+ }
115
+ if (raw.rank_order !== undefined) {
116
+ if (!Number.isInteger(raw.rank_order) || raw.rank_order < 1) {
117
+ errors.push('第 ' + line + ' 行:rank_order 必须是正整数');
118
+ }
119
+ }
108
120
  if (raw.note !== undefined) {
109
121
  if (typeof raw.note !== 'string') errors.push('第 ' + line + ' 行:note 必须是字符串');
110
122
  else if (raw.note.length > NOTE_MAX) errors.push('第 ' + line + ' 行:note 不能超过 ' + NOTE_MAX + ' 字');
@@ -21,6 +21,7 @@ import { atomicWriteJson } from '#workspace';
21
21
  import { BUILTIN_GENRES } from '#material-topic';
22
22
  import { MATERIAL_FACET_CANDIDATES } from './facets.js';
23
23
  import { KIND_GROUPS, KIND_LABELS, MATERIAL_KINDS } from './kinds.js';
24
+ import { normalizeCategories } from './plan.js';
24
25
 
25
26
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
26
27
  const WORLD_PROMPT_FILE = path.join(__dirname, 'prompts', 'world-mother.md');
@@ -28,8 +29,8 @@ const WORLD_PROMPT_FILE = path.join(__dirname, 'prompts', 'world-mother.md');
28
29
  export const FLOW_VERSION = 1;
29
30
  export const FLOW_RELATIVE_PATH = path.join('.fancy', 'material', 'flow.json');
30
31
  export const EMPTY_FACET_LABEL = '无(不限)';
31
- export const DEFAULT_TARGET_PER_KIND = 20;
32
- export const DEFAULT_SCOPE_TITLES = ['命名', '世界与势力', '能力', '剧情与脑洞'];
32
+ export const DEFAULT_TARGET_PER_KIND = 50;
33
+ export const DEFAULT_SCOPE_TITLES = ['命名', '世界与势力', '能力', '等级', '剧情与脑洞'];
33
34
 
34
35
  /**
35
36
  * 弹框顺序。只选 6 层,避免把用户拖进十几个框。
@@ -245,7 +246,7 @@ export function scopeQuestion({ currentKinds = [] } = {}) {
245
246
  });
246
247
  }
247
248
  options.push({
248
- label: '推荐:命名 + 世界 + 能力 + 剧情',
249
+ label: '推荐:命名 + 世界 + 能力 + 等级 + 剧情',
249
250
  description: `世界母体最相关的 ${recommendedScopeKinds().length} 个 kind`,
250
251
  });
251
252
  options.push({
@@ -268,12 +269,12 @@ export function countQuestion() {
268
269
  id: 'material-count',
269
270
  header: '素材 · 数量',
270
271
  question: '每个 kind 本次追加多少条?',
271
- detail: '只追加,不覆盖已有素材。默认 20 条;首次建议 20 条先看质量。',
272
+ detail: '只追加,不覆盖已有素材。默认 50 条;系统组按套生成,不受这个数字影响。',
272
273
  options: [
273
- { label: '20 条(推荐)', description: '质量与数量平衡,默认值' },
274
- { label: '10 条', description: '先小批试跑' },
275
- { label: '30 条', description: '需要更多备选' },
276
- { label: '50 条', description: '批量生成,耗时较长' },
274
+ { label: '50 条(推荐)', description: '长篇默认池子大小' },
275
+ { label: '20 条', description: '先小批试跑' },
276
+ { label: '30 条', description: '中等批量' },
277
+ { label: '100 条', description: '需要更多备选,耗时较长' },
277
278
  ],
278
279
  };
279
280
  }
@@ -316,6 +317,8 @@ export function worldCandidateQuestion(candidates, { allowReroll = true } = {})
316
317
  const bits = [];
317
318
  if (candidate.core_conflict) bits.push('核心矛盾:' + candidate.core_conflict);
318
319
  if (candidate.suggestion_fit) bits.push('与选题关系:' + candidate.suggestion_fit);
320
+ if (candidate.ability_categories?.length) bits.push('能力:' + candidate.ability_categories.map((item) => item.name || item).join('、'));
321
+ if (candidate.faction_types?.length) bits.push('势力:' + candidate.faction_types.map((item) => item.name || item).join('、'));
319
322
  if (candidate.difference) bits.push('差异:' + candidate.difference);
320
323
  options.push({
321
324
  label,
@@ -370,7 +373,10 @@ function normalizeWorldCandidate(raw, index, { constraintGenres = [] } = {}) {
370
373
  taboos: normalizeStringArray(source.taboos || source.forbidden),
371
374
  visual_motifs: normalizeStringArray(source.visual_motifs || source.motifs),
372
375
  naming_logic: clean(source.naming_logic || source.naming),
373
- core_genres: coreGenres.length ? coreGenres : [...constraintGenres],
376
+ core_genres: constraintGenres.length ? [...constraintGenres] : coreGenres,
377
+ ability_categories: normalizeCategories(source.ability_categories || source.power_categories, []),
378
+ faction_types: normalizeCategories(source.faction_types || source.factions, []),
379
+ power_systems: normalizeCategories(source.power_systems || source.power_system, []),
374
380
  supported_kinds: normalizeStringArray(source.supported_kinds)
375
381
  .filter((kind) => MATERIAL_KINDS.includes(kind)),
376
382
  suggestion_fit: clean(source.suggestion_fit),
@@ -486,7 +492,7 @@ function renderSuggestionBlock(suggestion) {
486
492
  '- 方向是候选世界母体的锚点,不是最终世界名。',
487
493
  '- 定位是读者承诺和核心矛盾,不是命名词表。',
488
494
  '- 必须先把定位翻译成 3–5 条世界公理/代价/禁忌,再让名字从公理里长出来。',
489
- '- 禁止把定位里的职业、机构、流程名词直接当 rank_name / skill_name / faction_name。',
495
+ '- 禁止把定位里的职业、机构、流程名词直接当 power_rank / faction_rank / skill_name / faction_name。',
490
496
  '- 反例:试岗、替班、带班、值守、包月令、静音条。',
491
497
  ].join('\n');
492
498
  }
@@ -566,9 +572,18 @@ export function renderWorldBlock({
566
572
  '- 素材的 genres 必须原样包含全部核心题材;缺任何一个都算废稿。',
567
573
  '- 对应 facet 数组(tropes / moods / settings / roles / relations)必须包含本次选中的全部值;不能只写其中一个。',
568
574
  '- 名字必须从世界母体的公理、代价、禁忌里长出来,不能是现实职业词或字面功能词。',
569
- '- 禁止把 positioning 里的职业/机构/流程名词直接当 rank_name / skill_name / faction_name。',
575
+ '- 禁止把 positioning 里的职业/机构/流程名词直接当 power_rank / faction_rank / skill_name / faction_name。',
570
576
  '- 反例:试岗、替班、带班、值守、包月令、静音条。',
571
577
  ].filter(Boolean);
578
+ if (world.ability_categories?.length) {
579
+ lines.push('', '### 能力类别', ...world.ability_categories.map((item) => '- ' + (item.name || item)));
580
+ }
581
+ if (world.faction_types?.length) {
582
+ lines.push('', '### 势力类型', ...world.faction_types.map((item) => '- ' + (item.name || item)));
583
+ }
584
+ if (world.power_systems?.length) {
585
+ lines.push('', '### 力量体系', ...world.power_systems.map((item) => '- ' + (item.name || item)));
586
+ }
572
587
  if (world.institutions?.length) lines.push('', '### 机构/场所', ...world.institutions.map((item) => '- ' + item));
573
588
  if (world.taboos?.length) lines.push('', '### 禁忌', ...world.taboos.map((item) => '- ' + item));
574
589
  if (world.visual_motifs?.length) lines.push('', '### 视觉母题', ...world.visual_motifs.map((item) => '- ' + item));
@@ -598,6 +613,9 @@ export function renderWorldBatchSummary({
598
613
  world.cost ? '- 核心代价:' + world.cost : '',
599
614
  world.naming_logic ? '- 命名逻辑:' + world.naming_logic : '',
600
615
  '- 题材交集(必须全部满足):' + (constraintGenres.join('、') || '无(不限)'),
616
+ world.ability_categories?.length ? '- 能力类别:' + world.ability_categories.map((item) => item.name || item).join('、') : '',
617
+ world.faction_types?.length ? '- 势力类型:' + world.faction_types.map((item) => item.name || item).join('、') : '',
618
+ world.power_systems?.length ? '- 力量体系:' + world.power_systems.map((item) => item.name || item).join('、') : '',
601
619
  selected ? '- facet 交集:' + selected : '',
602
620
  '- 同一层多选是 AND;禁止只取其中一个约束。',
603
621
  ].filter(Boolean).join('\n');
@@ -16,7 +16,7 @@ import { readDeployedState, deployedStateProblemText, DEPLOYED_STATUS } from '#d
16
16
  import { repairTopicDecision, selectNonRedundantBlocks, inspectBlockBodies } from '#topic-decision';
17
17
  import { isSensitiveProjectPath, isValidProjectPath } from '#path-guard';
18
18
  import { parseDecisionCandidates } from '#topic-candidates';
19
- import { NOVEL_SUGGESTION_FILE, validateSuggestion, validateMinimalTopic, readSuggestion, ABILITY_KINDS, PLOT_KINDS } from '#material-topic';
19
+ import { NOVEL_SUGGESTION_FILE, validateSuggestion, validateMinimalTopic, readSuggestion, ABILITY_KINDS, PLOT_KINDS, PLOT_MATERIAL_KINDS } from '#material-topic';
20
20
  import { atomicWriteJSON } from '#atomic-write';
21
21
  import { resolveWorkspace } from '#workspace';
22
22
  import { topic } from './templates.js';
@@ -507,7 +507,7 @@ async function pathSetup(ctx, session, invocation, signal, projectRoot, tasks) {
507
507
  const coverage = {
508
508
  genres,
509
509
  ability: ABILITY_KINDS.map((kind) => ({ kind, count: Number(counts[kind]) || 0 })),
510
- plot: PLOT_KINDS.map((kind) => ({ kind, count: Number(counts[kind]) || 0 })),
510
+ plot: PLOT_MATERIAL_KINDS.map((kind) => ({ kind, count: Number(counts[kind]) || 0 })),
511
511
  };
512
512
  const missing = [...coverage.ability, ...coverage.plot]
513
513
  .filter((item) => !item.count)
@@ -42,7 +42,7 @@ node '${QUERY_SCRIPT}' --workspace '${WORKSPACE}' --genre '${QUERY_GENRE}' --kin
42
42
  需要查询的 kind:
43
43
 
44
44
  - 能力组:${ABILITY_KINDS}
45
- - 剧情与脑洞组:${PLOT_KINDS}
45
+ - 剧情种子组:${PLOT_SEED_KINDS}
46
46
 
47
47
  规则:
48
48
 
@@ -51,7 +51,8 @@ node '${QUERY_SCRIPT}' --workspace '${WORKSPACE}' --genre '${QUERY_GENRE}' --kin
51
51
  3. 题材是交集:本次选择是 `${GENRE_FILTERS}`。可以用其中任意一个题材查询,但选中的素材必须同时满足 `flow.json` 里的全部题材、场景、情绪、情节、身份、关系约束。
52
52
  4. 如果某个 kind 查不到结果,可以去掉 `--genre` 再查一次,但只能用真实素材;仍然没有就停下来告诉用户,不要编。
53
53
  5. 同一层 facet 多选是 AND,不是 OR。不要把只满足一个条件的素材硬拼成方案。
54
- 6. 不要修改、删除 `.fancy-tools/fancy-material/` 下的脚本。
54
+ 6. `conflict_seed`、`conflict_escalation`、`plot_twist`、`mystery_seed`、`payoff_scene`、`trope` 不需要从素材库查询;它们要在定稿方案里结合世界母体、角色和 `${PLOT_SEED_KINDS}` 种子现场生成。
55
+ 7. 不要修改、删除 `.fancy-tools/fancy-material/` 下的脚本。
55
56
 
56
57
  ## 三、生成 1 个推荐定稿 + 2 个备选
57
58
 
@@ -17,7 +17,7 @@ import { dirname, join } from 'path';
17
17
  import { createHash } from 'crypto';
18
18
  import { fileURLToPath } from 'url';
19
19
  import { shellSingleQuote } from '#path-guard';
20
- import { ABILITY_KINDS, PLOT_KINDS } from '#material-topic';
20
+ import { ABILITY_KINDS, PLOT_KINDS, PLOT_MATERIAL_KINDS } from '#material-topic';
21
21
  import {
22
22
  TOPIC_FIELDS,
23
23
  TOPIC_FIELD_CN,
@@ -405,6 +405,7 @@ export const topic = {
405
405
  COVERAGE_JSON: JSON.stringify(coverage || {}, null, 2),
406
406
  ABILITY_KINDS: ABILITY_KINDS.map(k => `\`${k}\``).join('、'),
407
407
  PLOT_KINDS: PLOT_KINDS.map(k => `\`${k}\``).join('、'),
408
+ PLOT_SEED_KINDS: PLOT_MATERIAL_KINDS.map(k => `\`${k}\``).join('、'),
408
409
  QUERY_SCRIPT: queryScript || '',
409
410
  WORKSPACE: workspace || '',
410
411
  });