@cloud411716/fancy-webnovel 4.16.0 → 4.16.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.
@@ -136,7 +136,7 @@ cookies 会额外镜像到:
136
136
  并发数:
137
137
 
138
138
  ```bash
139
- FANCY_DOUYIN_SUBAGENTS=3 # 默认 3,范围 1–6
139
+ FANCY_DOUYIN_SUBAGENTS=5 # 默认 5,范围 1–6
140
140
  FANCY_DOUYIN_SUBAGENTS=0 # 关闭子 Agent,回退单 Agent 串行
141
141
  ```
142
142
 
@@ -5,24 +5,6 @@
5
5
 
6
6
  DEFINE TABLE IF NOT EXISTS material SCHEMAFULL PERMISSIONS FOR select FULL;
7
7
 
8
- -- v10 -> v11 migration: add facet fields as optional first, backfill existing
9
- -- records, then tighten them to array<string>. Applying the strict definition
10
- -- directly makes SurrealDB reject old records that do not have the new fields.
11
- DEFINE FIELD IF NOT EXISTS tropes ON material TYPE option<array<string>>;
12
- DEFINE FIELD IF NOT EXISTS narrative ON material TYPE option<array<string>>;
13
- DEFINE FIELD IF NOT EXISTS traits ON material TYPE option<array<string>>;
14
- DEFINE FIELD IF NOT EXISTS roles ON material TYPE option<array<string>>;
15
- DEFINE FIELD IF NOT EXISTS relations ON material TYPE option<array<string>>;
16
- DEFINE FIELD IF NOT EXISTS moods ON material TYPE option<array<string>>;
17
- DEFINE FIELD IF NOT EXISTS settings ON material TYPE option<array<string>>;
18
- UPDATE material SET tropes = [] WHERE tropes = NONE;
19
- UPDATE material SET narrative = [] WHERE narrative = NONE;
20
- UPDATE material SET traits = [] WHERE traits = NONE;
21
- UPDATE material SET roles = [] WHERE roles = NONE;
22
- UPDATE material SET relations = [] WHERE relations = NONE;
23
- UPDATE material SET moods = [] WHERE moods = NONE;
24
- UPDATE material SET settings = [] WHERE settings = NONE;
25
-
26
8
  DEFINE FIELD OVERWRITE source ON material TYPE string DEFAULT 'builtin'
27
9
  ASSERT $value IN ['builtin', 'other'];
28
10
  DEFINE FIELD OVERWRITE kind ON material TYPE string
@@ -43,13 +25,13 @@ DEFINE FIELD OVERWRITE name ON material TYPE string;
43
25
  DEFINE FIELD OVERWRITE tags ON material TYPE array<string> DEFAULT [];
44
26
  DEFINE FIELD OVERWRITE subject ON material TYPE option<string>;
45
27
  DEFINE FIELD OVERWRITE genres ON material TYPE array<string> DEFAULT [];
46
- DEFINE FIELD OVERWRITE tropes ON material TYPE array<string> DEFAULT [];
47
- DEFINE FIELD OVERWRITE narrative ON material TYPE array<string> DEFAULT [];
48
- DEFINE FIELD OVERWRITE traits ON material TYPE array<string> DEFAULT [];
49
- DEFINE FIELD OVERWRITE roles ON material TYPE array<string> DEFAULT [];
50
- DEFINE FIELD OVERWRITE relations ON material TYPE array<string> DEFAULT [];
51
- DEFINE FIELD OVERWRITE moods ON material TYPE array<string> DEFAULT [];
52
- DEFINE FIELD OVERWRITE settings ON material TYPE array<string> DEFAULT [];
28
+ DEFINE FIELD OVERWRITE tropes ON material TYPE option<array<string>>;
29
+ DEFINE FIELD OVERWRITE narrative ON material TYPE option<array<string>>;
30
+ DEFINE FIELD OVERWRITE traits ON material TYPE option<array<string>>;
31
+ DEFINE FIELD OVERWRITE roles ON material TYPE option<array<string>>;
32
+ DEFINE FIELD OVERWRITE relations ON material TYPE option<array<string>>;
33
+ DEFINE FIELD OVERWRITE moods ON material TYPE option<array<string>>;
34
+ DEFINE FIELD OVERWRITE settings ON material TYPE option<array<string>>;
53
35
  DEFINE FIELD IF NOT EXISTS group_id ON material TYPE option<string>;
54
36
  DEFINE FIELD IF NOT EXISTS subkind ON material TYPE option<string>;
55
37
  DEFINE FIELD OVERWRITE note ON material TYPE string DEFAULT ''
@@ -129,7 +129,7 @@ namespace: fancy
129
129
  跳过,不超过 1 分钟的先看前 5 秒,与网文创作无关也跳过;文章按标题层级拆成原子
130
130
  设定。内容交给 LLM 提取素材,按 material JSONL 写入数据库,`source` 固定为
131
131
  `other`。作品任务状态记录在素材库的 `douyin_job` 表中,旧版工作区的
132
- `/.fancy/douyin/crawled.json` 会一次性迁移。采集完成后可由 DSH 子 Agent 并行分析,`FANCY_DOUYIN_SUBAGENTS` 控制并发数(默认 3,0 关闭);没有 subagent 服务时自动回退单 Agent。
132
+ `/.fancy/douyin/crawled.json` 会一次性迁移。采集完成后可由 DSH 子 Agent 并行分析,`FANCY_DOUYIN_SUBAGENTS` 控制并发数(默认 5,0 关闭);没有 subagent 服务时自动回退单 Agent。
133
133
 
134
134
  登录态保存在工作区 `/.fancy/douyin/chrome-profile/`,并镜像 cookies 到
135
135
  `login-state.json`。首次需要登录时使用有头 Chrome,登录态有效后后续运行自动
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "4.16.0",
3
+ "version": "4.16.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -7,7 +7,7 @@
7
7
  * image/video/article analyses to run at once.
8
8
  */
9
9
 
10
- export const DEFAULT_SUBAGENT_WORKERS = 3;
10
+ export const DEFAULT_SUBAGENT_WORKERS = 5;
11
11
  export const MAX_SUBAGENT_WORKERS = 6;
12
12
 
13
13
  export function subagentWorkerCount(env = process.env) {
@@ -36,7 +36,7 @@ export function helpText() {
36
36
  - 父进程负责采集、校验、入库和任务状态;子 Agent 只写各作品的 materials.jsonl。
37
37
  - 作品任务状态记录在素材库的 douyin_job 表;中途重启会复用稳定任务目录,已导入/已跳过的作品不会重采。
38
38
  - 有子 Agent 时,视觉能力自检和视频前 5 秒相关性判断也由子 Agent 完成,主对话不再出现这些分析提示词。
39
- - 子 Agent 并发数由 FANCY_DOUYIN_SUBAGENTS 控制(默认 3,0 关闭);DSH 没有 subagent 服务或 spawn provider 时自动回退单 Agent 串行。
39
+ - 子 Agent 并发数由 FANCY_DOUYIN_SUBAGENTS 控制(默认 5,0 关闭);DSH 没有 subagent 服务或 spawn provider 时自动回退单 Agent 串行。
40
40
  - 视频作品先判断时长:超过 1 分钟直接跳过;不超过 1 分钟的先看前 5 秒,
41
41
  与网文创作无关就跳过,有关才继续分析关键帧。
42
42
  - 如果内容与网文创作无关,LLM 会写入 skip 标记,该作品记为已处理并跳过。
@@ -82,23 +82,35 @@ async function runSurreal(root, args, timeout = NATIVE_TIMEOUT_MS) {
82
82
  const workspace = readWorkspace(root);
83
83
  const database = materialDatabaseName(workspace);
84
84
  const namespace = workspace.surreal?.namespace || 'fancy';
85
- const result = await spawnScript(binary, [
85
+ const command = [
86
+ binary,
86
87
  args[0],
87
88
  '--endpoint', rpcUrl(workspace),
88
89
  '--namespace', namespace,
89
90
  '--database', database,
90
91
  ...args.slice(1),
91
- ], {
92
- timeout,
93
- cwd: root,
94
- env: controlEnv(root),
95
- });
96
- // `surreal export` writes to a file and prints only logs, so spawnScript's
97
- // JSON-output heuristic marks it unsuccessful. The exit code is authoritative.
98
- if (result.code !== 0) {
99
- throw new Error(controlDetail(result));
92
+ ];
93
+ let result;
94
+ for (let attempt = 1; attempt <= 2; attempt += 1) {
95
+ result = await spawnScript(command[0], command.slice(1), {
96
+ timeout,
97
+ cwd: root,
98
+ env: controlEnv(root),
99
+ });
100
+ // `surreal export` writes to a file and prints only logs, so spawnScript's
101
+ // JSON-output heuristic marks it unsuccessful. The exit code is authoritative.
102
+ if (result.code === 0) {
103
+ return { result, workspace, namespace, database };
104
+ }
105
+ const detail = controlDetail(result);
106
+ const transient = /fetch failed|ECONN|connection.*(?:refused|reset)|network|timed? ?out/i.test(detail);
107
+ if (attempt === 1 && transient) {
108
+ await new Promise((resolve) => setTimeout(resolve, 2000));
109
+ continue;
110
+ }
111
+ throw new Error(detail);
100
112
  }
101
- return { result, workspace, namespace, database };
113
+ throw new Error(controlDetail(result));
102
114
  }
103
115
 
104
116
  /**