@cloud411716/fancy-webnovel 2.2.0 → 3.0.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/README.md +65 -0
- package/client.js +201 -15
- package/cordis.patch.yml +5 -1
- package/docs/douyin-plugin.md +118 -0
- package/docs/material-library/README.md +404 -0
- package/docs/material-library/import.js +437 -0
- package/docs/material-library/prompt.md +370 -0
- package/docs/material-library/queries.surql +94 -0
- package/docs/material-library/sample.jsonl +14 -0
- package/docs/material-library/schema.surql +46 -0
- package/docs/mcp-profile.example.yml +24 -0
- package/docs/story-graph-design.md +602 -0
- package/docs/story-graph-validation.md +81 -0
- package/docs/workspace-mcp.md +284 -0
- package/index.js +12 -7
- package/lib/atomic-write.js +109 -0
- package/lib/chapter-order.js +100 -0
- package/lib/confirmation.js +80 -0
- package/lib/db-init.js +123 -0
- package/lib/deployed-state.js +11 -11
- package/lib/direction-labels.js +265 -0
- package/lib/error-codes.js +31 -31
- package/lib/infra.js +29 -4
- package/lib/material-db.js +149 -0
- package/lib/path-guard.js +150 -0
- package/lib/projects.js +400 -0
- package/lib/scraper-utils.js +140 -0
- package/lib/surreal-server.js +338 -0
- package/lib/topic-decision.js +860 -0
- package/lib/topic-fields.js +251 -0
- package/lib/topic-schema.js +225 -0
- package/lib/workspace.js +501 -0
- package/package.json +31 -7
- package/plugins/fancy-analyze/analyze-definitions.md +519 -0
- package/plugins/fancy-analyze/index.js +1128 -77
- package/plugins/fancy-analyze/ingest-coverage.js +107 -0
- package/plugins/fancy-analyze/schema-analyze.md +355 -107
- package/plugins/fancy-analyze/scripts/append-summary-chapter.js +612 -0
- package/plugins/fancy-analyze/summary-progress.js +71 -7
- package/plugins/fancy-analyze/templates.js +437 -139
- package/plugins/fancy-bootstrap/index.js +276 -131
- package/plugins/fancy-bootstrap/scripts/init.js +59 -25
- package/plugins/fancy-bootstrap/templates.js +35 -18
- package/plugins/fancy-db/index.js +172 -0
- package/plugins/fancy-douyin/deploy.js +134 -0
- package/plugins/fancy-douyin/index.js +551 -0
- package/plugins/fancy-douyin/prompts/01-analysis-prompt.md +84 -0
- package/plugins/fancy-douyin/scripts/crawl-note.cjs +194 -0
- package/plugins/fancy-douyin/scripts/lib.cjs +197 -0
- package/plugins/fancy-douyin/scripts/scan-account.cjs +128 -0
- package/plugins/fancy-douyin/scripts/start-chrome.cjs +203 -0
- package/plugins/fancy-douyin/state.js +197 -0
- package/plugins/fancy-douyin/templates.js +127 -0
- package/plugins/fancy-export/exporter.js +805 -0
- package/plugins/fancy-export/index.js +63 -0
- package/plugins/fancy-import/import-driver.js +29 -6
- package/plugins/fancy-import/index.js +13 -5
- package/plugins/fancy-import/prompts/01-import-prompt.md +39 -14
- package/plugins/fancy-import/templates.js +17 -8
- package/plugins/fancy-material/exporter.js +153 -0
- package/plugins/fancy-material/genres.js +256 -0
- package/plugins/fancy-material/index.js +835 -0
- package/plugins/fancy-material/inventory.js +145 -0
- package/plugins/fancy-material/kinds.js +313 -0
- package/plugins/fancy-material/queue.js +55 -0
- package/plugins/fancy-material/scripts/query.js +254 -0
- package/plugins/fancy-material/templates.js +258 -0
- package/plugins/fancy-material/tool-deploy.js +138 -0
- package/plugins/fancy-material/validate.js +149 -0
- package/plugins/fancy-project/index.js +133 -0
- package/plugins/fancy-scan/existing-block.js +100 -0
- package/plugins/fancy-scan/index.js +410 -21
- package/plugins/fancy-scan/prompts/01-analysis-prompt.md +302 -0
- package/plugins/fancy-scan/scripts/append-block.js +725 -0
- package/plugins/fancy-scan/scripts/report-validate.js +824 -0
- package/plugins/fancy-scan/scripts/run-scan.js +169 -22
- package/plugins/fancy-scan/scripts/scrapers/fanqie-rank-scraper.js +145 -16
- package/plugins/fancy-scan/scripts/scrapers/jjwxc-rank-scraper.js +179 -49
- package/plugins/fancy-scan/scripts/scrapers/qimao-rank-scraper.js +38 -20
- package/plugins/fancy-scan/templates/blocks.js +155 -0
- package/plugins/fancy-scan/templates/platforms.js +372 -0
- package/plugins/fancy-scan/templates/report-schema.js +90 -0
- package/plugins/fancy-scan/templates.js +545 -146
- package/plugins/fancy-scan/tool-deploy.js +335 -0
- package/plugins/fancy-scan/wait-turn.js +46 -0
- package/plugins/fancy-story-builder/db/README.md +106 -0
- package/plugins/fancy-story-builder/db/client.js +228 -0
- package/plugins/fancy-story-builder/db/commands.js +145 -0
- package/plugins/fancy-story-builder/db/ids.js +39 -0
- package/plugins/fancy-story-builder/db/import.js +798 -0
- package/plugins/fancy-story-builder/db/project.js +299 -0
- package/plugins/fancy-story-builder/db/query.js +361 -0
- package/plugins/fancy-story-builder/db/schema.js +417 -0
- package/plugins/fancy-story-builder/db/stage-sync.js +238 -0
- package/plugins/fancy-story-builder/flesh-output.js +19 -6
- package/plugins/fancy-story-builder/index.js +4105 -396
- package/plugins/fancy-story-builder/patch-driver.js +390 -0
- package/plugins/fancy-story-builder/prompts/01-skeleton-prompt.md +29 -19
- package/plugins/fancy-story-builder/prompts/02-flesh-prompt.md +72 -10
- package/plugins/fancy-story-builder/prompts/03-rhythm-prompt.md +40 -5
- package/plugins/fancy-story-builder/prompts/04-writing-prompt.md +37 -0
- package/plugins/fancy-story-builder/purpose-template.md +42 -66
- package/plugins/fancy-story-builder/references/formulas-skeleton.json +229 -56
- package/plugins/fancy-story-builder/references/genre-profiles.json +3514 -0
- package/plugins/fancy-story-builder/references/glossary.md +15 -6
- package/plugins/fancy-story-builder/references/index.md +97 -6
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/00-index.md +1 -1
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/07-audit.md +25 -7
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/01-character.md +5 -1
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/03-relations.md +6 -2
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/05-audit.md +15 -5
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/00-index.md +1 -1
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/01-positioning.md +2 -1
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/03-entities.md +1 -1
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/06-audit.md +19 -1
- package/plugins/fancy-story-builder/schema-setting.json +1100 -0
- package/plugins/fancy-story-builder/schema-setting.md +201 -293
- package/plugins/fancy-story-builder/scripts/brief-validate.js +164 -0
- package/plugins/fancy-story-builder/scripts/content-quality.js +4 -1
- package/plugins/fancy-story-builder/scripts/flesh-validate.js +135 -12
- package/plugins/fancy-story-builder/scripts/graph-utils.js +146 -47
- package/plugins/fancy-story-builder/scripts/reference-log.js +110 -0
- package/plugins/fancy-story-builder/scripts/rhythm-validate.js +100 -4
- package/plugins/fancy-story-builder/scripts/schema-pages.js +2668 -0
- package/plugins/fancy-story-builder/scripts/semantic-lint.js +5 -1
- package/plugins/fancy-story-builder/scripts/skeleton-validate.js +158 -17
- package/plugins/fancy-story-builder/scripts/stage-batches.js +36 -2
- package/plugins/fancy-story-builder/scripts/stage-contract.js +12 -0
- package/plugins/fancy-story-builder/scripts/story-artifacts.js +933 -0
- package/plugins/fancy-story-builder/scripts/upstream-query.js +1 -1
- package/plugins/fancy-story-builder/scripts/v2/baseline.js +112 -0
- package/plugins/fancy-story-builder/scripts/v2/cast.js +517 -0
- package/plugins/fancy-story-builder/scripts/v2/context.js +434 -0
- package/plugins/fancy-story-builder/scripts/v2/contracts.js +493 -0
- package/plugins/fancy-story-builder/scripts/v2/core.js +419 -0
- package/plugins/fancy-story-builder/scripts/v2/engine.js +1068 -0
- package/plugins/fancy-story-builder/scripts/v2/export-markdown.js +794 -0
- package/plugins/fancy-story-builder/scripts/v2/genre.js +195 -0
- package/plugins/fancy-story-builder/scripts/v2/knowledge.js +321 -0
- package/plugins/fancy-story-builder/scripts/v2/macro.js +409 -0
- package/plugins/fancy-story-builder/scripts/v2/manifest.js +538 -0
- package/plugins/fancy-story-builder/scripts/v2/migrate.js +137 -0
- package/plugins/fancy-story-builder/scripts/v2/prompts.js +1335 -0
- package/plugins/fancy-story-builder/scripts/v2/rhythm.js +618 -0
- package/plugins/fancy-story-builder/scripts/v2/scale.js +843 -0
- package/plugins/fancy-story-builder/scripts/v2/snapshot.js +121 -0
- package/plugins/fancy-story-builder/scripts/v2/stages.js +273 -0
- package/plugins/fancy-story-builder/scripts/v2/writing.js +216 -0
- package/plugins/fancy-story-builder/storydb/README.md +271 -0
- package/plugins/fancy-story-builder/storydb/cli.js +458 -0
- package/plugins/fancy-story-builder/storydb/client.js +351 -0
- package/plugins/fancy-story-builder/storydb/compile.js +452 -0
- package/plugins/fancy-story-builder/storydb/context.js +288 -0
- package/plugins/fancy-story-builder/storydb/definitions.js +699 -0
- package/plugins/fancy-story-builder/storydb/driver.js +106 -0
- package/plugins/fancy-story-builder/storydb/dsh-tools.js +313 -0
- package/plugins/fancy-story-builder/storydb/export.js +175 -0
- package/plugins/fancy-story-builder/storydb/ids.js +31 -0
- package/plugins/fancy-story-builder/storydb/impact.js +170 -0
- package/plugins/fancy-story-builder/storydb/import.js +559 -0
- package/plugins/fancy-story-builder/storydb/mcp.js +99 -0
- package/plugins/fancy-story-builder/storydb/prompts.js +952 -0
- package/plugins/fancy-story-builder/storydb/stage-command.js +379 -0
- package/plugins/fancy-story-builder/storydb/stage.js +426 -0
- package/plugins/fancy-story-builder/storydb/store.js +891 -0
- package/plugins/fancy-story-builder/storydb/tools.js +592 -0
- package/plugins/fancy-story-builder/storydb/validation.js +183 -0
- package/plugins/fancy-story-builder/templates/v2/10-scale/scale-template.json +144 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/emotion-template.json +15 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/endings-template.json +16 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/lines-template.json +28 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/roles-template.json +10 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/story-template.json +19 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/volumes-template.json +24 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/world-template.json +24 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/characters-template.json +49 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/climaxes-template.json +14 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/conflicts-template.json +30 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/factions-template.json +18 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/foreshadows-template.json +29 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/information-template.json +29 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/items-template.json +13 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/locations-template.json +12 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/payoffs-template.json +16 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/relations-template.json +44 -0
- package/plugins/fancy-story-builder/templates/v2/40-rhythm/chapter-map-template.json +81 -0
- package/plugins/fancy-story-builder/templates/v2/40-rhythm/outline-template.json +162 -0
- package/plugins/fancy-story-builder/templates/v2/50-writing/ledger-template.json +46 -0
- package/plugins/fancy-story-builder/templates/v2/60-deslop/report-template.json +10 -0
- package/plugins/fancy-story-builder/templates//350/212/202/345/245/217//346/227/266/345/272/217/346/230/240/345/260/204/346/250/241/346/235/277.json +267 -44
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//344/270/226/347/225/214/350/247/202/350/247/204/345/210/231/346/250/241/346/235/277.json +121 -19
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/205/263/351/224/256/351/201/223/345/205/267/346/250/241/346/235/277.json +129 -21
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/205/266/344/273/226/345/256/236/344/275/223/346/250/241/346/235/277.json +62 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/206/262/347/252/201/346/250/241/346/235/277.json +76 -17
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/211/247/346/203/205/346/250/241/346/235/277.json +56 -8
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/212/277/345/212/233/346/250/241/346/235/277.json +63 -13
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/234/260/347/202/271/346/250/241/346/235/277.json +34 -6
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//347/273/223/345/261/200/346/250/241/346/235/277.json +81 -18
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//350/247/222/350/211/262/346/250/241/346/235/277.json +202 -42
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//345/205/263/347/263/273/346/250/241/346/235/277.json +160 -27
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//345/256/236/344/275/223/346/250/241/346/235/277.json +217 -41
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//346/241/206/346/236/266/346/250/241/346/235/277.json +215 -41
- package/plugins/fancy-story-builder/templates.js +272 -74
- package/plugins/fancy-story-builder/wiki-references.js +429 -93
- package/plugins/fancy-story-builder/writing-driver.js +336 -9
- package/plugins/fancy-topic/index.js +414 -61
- package/plugins/fancy-topic/prompts/01-exploration-prompt.md +115 -0
- package/plugins/fancy-topic/scripts/save-suggestion.js +219 -0
- package/plugins/fancy-topic/scripts/select-topic.js +106 -63
- package/plugins/fancy-topic/templates.js +225 -122
- package/plugins/fancy-topic/tool-deploy.js +200 -0
- package/lib/safe-rm.js +0 -94
package/lib/safe-rm.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 沙箱下 `rm` 挂死的一次性提示(bundle 级,所有子插件共用)。
|
|
3
|
-
*
|
|
4
|
-
* ## 为什么要有这段提示
|
|
5
|
-
*
|
|
6
|
-
* 实测(2026-10-23,DSH web + Landlock 沙箱):
|
|
7
|
-
*
|
|
8
|
-
* 1. 本机的 `/bin/rm` 和 `/usr/bin/rm` 都被替换成了 trash-cli 的 `trash-put`
|
|
9
|
-
* (`ls -l /bin/rm` → `/usr/bin/trash-put`)—— 删除不是真删,是移入回收站,
|
|
10
|
-
* 同时要在 `~/.local/share/Trash/info/` 写一份 `.trashinfo` 元数据。
|
|
11
|
-
* 2. DSH 的 bash 跑在 Landlock 沙箱里,可写白名单只有
|
|
12
|
-
* `/dev/null`、`/tmp` 和会话工作目录
|
|
13
|
-
* (`@deepseek-ai/dsh-sandbox-local/lib/index.js` 的 `landlockProfileArgs`)。
|
|
14
|
-
* 回收站 `~/.local/share/Trash` 不在其中。
|
|
15
|
-
* 3. trash-cli 写 `.trashinfo` 拿到 EACCES 后**不会报错退出**,而是换一个
|
|
16
|
-
* 递增后缀继续重试(`trashcli/put/janitor_tools/info_file_persister.py`
|
|
17
|
-
* 的 `while True` + `NeedsMoreAttempts`,只对 ENAMETOOLONG 特判)。
|
|
18
|
-
* → `rm` 永不返回 → 用 `&&` 串起来的整条命令挂到超时(默认 600 秒)。
|
|
19
|
-
*
|
|
20
|
-
* 复现(`landlock-run --ro / --rw /dev/null --rw /tmp --rw <cwd> -- rm -f <f>`):
|
|
21
|
-
* rc=124(被 timeout 杀);同一环境下 `node -e "fs.unlinkSync(...)"` rc=0。
|
|
22
|
-
*
|
|
23
|
-
* 把 `XDG_DATA_HOME` 指到 `/tmp`,回收站就落在沙箱允许写的目录里,`rm` 立刻返回。
|
|
24
|
-
*
|
|
25
|
-
* ## 为什么放在 bundle 入口,而不是各子插件自己的提示词
|
|
26
|
-
*
|
|
27
|
-
* fancy-webnovel 下每个子插件都可能让模型去删临时文件(骨架构建、拆书、
|
|
28
|
-
* 拆解结果清理……),逐个加提示词必然漏,而且以后新增子插件还会再漏。
|
|
29
|
-
* 这里注册成 DSH 的 `systemPrompt` section:**一次注册,对整个 bundle 的
|
|
30
|
-
* 所有会话、所有子插件生效**,模型不需要知道当前是哪个子插件。
|
|
31
|
-
*
|
|
32
|
-
* ## 顺带澄清一件事:这段文本不是 400 的元凶
|
|
33
|
-
*
|
|
34
|
-
* 曾经出现过 provider 报
|
|
35
|
-
* 400 messages: Validation error: message content cannot be empty
|
|
36
|
-
* 且报错里**含有本段文本**,很容易被误判成"是这段提示词导致的"。
|
|
37
|
-
* 不是。真实原因是插件往会话里塞了一条**空 content 的 user/message**:
|
|
38
|
-
* 它抢走了 transcript 的第一条位置,于是系统提示词(含本段文本)被降级成
|
|
39
|
-
* user 轮,跟空消息一起出现在报错里 —— 本段文本出现在报错里恰恰是**症状**。
|
|
40
|
-
* 详见 tests/cases/conversation-view.test.js 与 lib/infra.js 的文件头说明。
|
|
41
|
-
*
|
|
42
|
-
* @module @cloud411716/fancy-webnovel/safe-rm
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/** section 名。DSH 里 section 按名去重,重名会抛错。 */
|
|
46
|
-
export const SAFE_RM_SECTION_NAME = 'fancy-webnovel:safe-rm';
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 排序位。DSH 的 `systemPrompt.section()` 要求 order 是有限数字;
|
|
50
|
-
* 外部贡献可以用任意有限值,这里紧跟在 `tool:bash`(1000)之后,
|
|
51
|
-
* 让模型在读完 bash 工具说明后紧接着看到这条约束。
|
|
52
|
-
*/
|
|
53
|
-
export const SAFE_RM_SECTION_ORDER = 1005;
|
|
54
|
-
|
|
55
|
-
/** section 正文。措辞要短、要把"为什么"讲透,否则模型会当成风格偏好而忽略。 */
|
|
56
|
-
export const SAFE_RM_SECTION_TEXT = [
|
|
57
|
-
'本机的 rm 是 trash-cli 的 trash-put:删除即移入回收站,并非真删。',
|
|
58
|
-
'DSH 的文件沙箱(workspace-write)只允许写 /dev/null、/tmp 和会话工作目录,',
|
|
59
|
-
'回收站目录 ~/.local/share/Trash 不在其中;trash-cli 写 .trashinfo 失败后会不断换名重试,',
|
|
60
|
-
'rm 永不返回,整条命令会挂到超时(默认 600 秒)。',
|
|
61
|
-
'删除任何文件或目录(含临时文件)时,一律给 rm 加 XDG_DATA_HOME=/tmp 前缀,',
|
|
62
|
-
'让回收站落在沙箱允许写的 /tmp 下,rm 才会立刻返回:',
|
|
63
|
-
'XDG_DATA_HOME=/tmp rm -rf <路径>',
|
|
64
|
-
].join('\n');
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* 注册这条提示。
|
|
68
|
-
*
|
|
69
|
-
* 用 `ctx.inject(['systemPrompt'], ...)` 惰性注册而不是直接摸 `ctx.systemPrompt`:
|
|
70
|
-
* 精简部署(没装 systemPrompt 服务)和单元测试的假 ctx 都不会因此炸,
|
|
71
|
-
* 而且 HMR 重载时 cordis 会自动 dispose / 重建。
|
|
72
|
-
*
|
|
73
|
-
* @param {object} ctx - 插件上下文
|
|
74
|
-
* @returns {boolean} 是否真的注册了(false = 环境里没有 systemPrompt)
|
|
75
|
-
*/
|
|
76
|
-
export function registerSafeRmPrompt(ctx) {
|
|
77
|
-
// 没有 inject 的假 ctx(单元测试用的最小 mock)直接跳过 ——
|
|
78
|
-
// 一条提示词不该把整个 bundle 拖挂。
|
|
79
|
-
if (!ctx || typeof ctx.inject !== 'function') return false;
|
|
80
|
-
try {
|
|
81
|
-
// 不 await:systemPrompt 还没就绪时这只是挂一个待启动的子插件,
|
|
82
|
-
// 不能让 bundle 的加载卡在这儿。
|
|
83
|
-
ctx.inject(['systemPrompt'], (scope) => {
|
|
84
|
-
scope.systemPrompt.section({
|
|
85
|
-
name: SAFE_RM_SECTION_NAME,
|
|
86
|
-
order: SAFE_RM_SECTION_ORDER,
|
|
87
|
-
text: SAFE_RM_SECTION_TEXT,
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
return true;
|
|
91
|
-
} catch {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
}
|