@cloud411716/fancy-webnovel 4.29.1 → 4.30.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/docs/douyin-plugin.md +1 -1
- package/docs/material-library/README.md +24 -18
- package/docs/material-library/backlog.md +171 -0
- package/docs/material-library/import.js +16 -3
- package/docs/material-library/prompt.md +12 -9
- package/docs/material-library/queries.surql +2 -2
- package/docs/material-library/sample.jsonl +8 -7
- package/docs/material-library/schema.surql +17 -10
- package/docs/workspace-mcp.md +1 -1
- package/lib/material-db.js +4 -4
- package/lib/material-topic.js +3 -0
- package/package.json +1 -1
- package/plugins/fancy-bootstrap/index.js +1 -1
- package/plugins/fancy-db/index.js +1 -1
- package/plugins/fancy-material/exporter.js +5 -1
- package/plugins/fancy-material/index.js +316 -118
- package/plugins/fancy-material/inventory.js +7 -5
- package/plugins/fancy-material/kinds.js +47 -20
- package/plugins/fancy-material/plan.js +190 -0
- package/plugins/fancy-material/prompts/world-mother.md +11 -1
- package/plugins/fancy-material/styles.js +1 -1
- package/plugins/fancy-material/templates.js +170 -7
- package/plugins/fancy-material/validate.js +14 -2
- package/plugins/fancy-material/world.js +29 -11
- package/plugins/fancy-topic/index.js +2 -2
- package/plugins/fancy-topic/prompts/02-setup-prompt.md +3 -2
- package/plugins/fancy-topic/templates.js +2 -1
|
@@ -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 =
|
|
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: '只追加,不覆盖已有素材。默认
|
|
272
|
+
detail: '只追加,不覆盖已有素材。默认 50 条;系统组按套生成,不受这个数字影响。',
|
|
272
273
|
options: [
|
|
273
|
-
{ label: '
|
|
274
|
-
{ label: '
|
|
275
|
-
{ label: '30 条', description: '
|
|
276
|
-
{ label: '
|
|
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:
|
|
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
|
-
'- 禁止把定位里的职业、机构、流程名词直接当
|
|
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 里的职业/机构/流程名词直接当
|
|
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:
|
|
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
|
-
-
|
|
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.
|
|
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
|
});
|