@waterwx/dsh-novel-forge 2.1.1-alpha → 2.1.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.
- package/README.md +368 -472
- package/lib/client.js +19578 -21391
- package/lib/index.js +4640 -3932
- package/lib/types/action-guard.d.ts +61 -0
- package/lib/types/ai-scan.d.ts +0 -6
- package/lib/types/assets.d.ts +7 -9
- package/lib/types/assistant.d.ts +25 -0
- package/lib/types/author-assets.d.ts +1 -3
- package/lib/types/bookshelf.d.ts +13 -3
- package/lib/types/client/api.d.ts +49 -29
- package/lib/types/client/chip-prefs.d.ts +36 -0
- package/lib/types/client/docx.d.ts +2 -2
- package/lib/types/client/llmLive.d.ts +12 -14
- package/lib/types/client/locales.d.ts +12 -67
- package/lib/types/client/mount.d.ts +0 -2
- package/lib/types/client/panel/AdaptModeView.d.ts +1 -1
- package/lib/types/client/panel/AiTag.d.ts +1 -0
- package/lib/types/client/panel/AssetsTab.d.ts +1 -1
- package/lib/types/client/panel/AssistantTab.d.ts +4 -1
- package/lib/types/client/panel/AuthorAssetsView.d.ts +1 -1
- package/lib/types/client/panel/AuthorHome.d.ts +12 -12
- package/lib/types/client/panel/CmdPalette.d.ts +12 -0
- package/lib/types/client/panel/CreateBookView.d.ts +1 -1
- package/lib/types/client/panel/GlobalAssetLibraryView.d.ts +1 -1
- package/lib/types/client/panel/ImportModal.d.ts +1 -1
- package/lib/types/client/panel/LiveFeedLog.d.ts +8 -0
- package/lib/types/client/panel/ModelManager.d.ts +2 -2
- package/lib/types/client/panel/NovelPanel.d.ts +7 -2
- package/lib/types/client/panel/PageHeader.d.ts +18 -0
- package/lib/types/client/panel/ProgressConsole.d.ts +1 -1
- package/lib/types/client/panel/PromptSlotsView.d.ts +11 -0
- package/lib/types/client/panel/ReaderView.d.ts +1 -1
- package/lib/types/client/panel/RunPanel.d.ts +1 -1
- package/lib/types/client/panel/SettingsView.d.ts +13 -10
- package/lib/types/client/panel/ShelfView.d.ts +11 -2
- package/lib/types/client/panel/SubPage.d.ts +27 -0
- package/lib/types/client/panel/TensionView.d.ts +18 -0
- package/lib/types/client/panel/TimelineView.d.ts +18 -0
- package/lib/types/client/panel/WorldTab.d.ts +1 -1
- package/lib/types/client/panel/helpers.d.ts +5 -3
- package/lib/types/client/panel/market-radar-state.d.ts +56 -0
- package/lib/types/client/panel/outline-markdown.d.ts +112 -0
- package/lib/types/client/panel/status-badge.d.ts +13 -0
- package/lib/types/client/panel/storage-parse.d.ts +46 -0
- package/lib/types/client/panel/toast.d.ts +2 -0
- package/lib/types/client/panel/usePersistentState.d.ts +17 -0
- package/lib/types/client/panel/views.d.ts +21 -35
- package/lib/types/client/run-status.d.ts +21 -0
- package/lib/types/client/sidebar-entry.d.ts +0 -2
- package/lib/types/digest-parse.d.ts +29 -0
- package/lib/types/docx-core.d.ts +16 -0
- package/lib/types/docx.d.ts +2 -3
- package/lib/types/engine.d.ts +122 -103
- package/lib/types/home.d.ts +11 -0
- package/lib/types/index.d.ts +21 -13
- package/lib/types/llm-live.d.ts +62 -36
- package/lib/types/llm-retry.d.ts +38 -0
- package/lib/types/market-radar-scan.d.ts +0 -1
- package/lib/types/market-radar-sources.d.ts +1 -1
- package/lib/types/migrate-output.d.ts +25 -0
- package/lib/types/model-capability.d.ts +119 -0
- package/lib/types/model-request.d.ts +36 -0
- package/lib/types/output-budget.d.ts +86 -0
- package/lib/types/plotline-align.d.ts +35 -0
- package/lib/types/prompt-slots.d.ts +57 -0
- package/lib/types/prompting.d.ts +2 -27
- package/lib/types/protocol.d.ts +479 -595
- package/lib/types/revision.d.ts +76 -0
- package/lib/types/routes.d.ts +9 -3
- package/lib/types/run-selection.d.ts +51 -0
- package/lib/types/run.d.ts +31 -0
- package/lib/types/settings-persist.d.ts +59 -0
- package/lib/types/snapshots.d.ts +46 -0
- package/lib/types/stage-contract.d.ts +58 -0
- package/lib/types/stream-fallback.d.ts +60 -0
- package/lib/types/strip-headings.d.ts +33 -0
- package/lib/types/tension.d.ts +53 -0
- package/lib/types/timeline.d.ts +37 -0
- package/package.json +41 -28
- package/assets/styles/arcane-thick-3d.webp +0 -0
- package/assets/styles/chinese-ink.webp +0 -0
- package/assets/styles/clay-stopmotion-3d.webp +0 -0
- package/assets/styles/dark-ghibli.webp +0 -0
- package/assets/styles/dark-gothic-3d.webp +0 -0
- package/assets/styles/film-photo.webp +0 -0
- package/assets/styles/guofeng-heavy.webp +0 -0
- package/assets/styles/guoman-2d-gufeng.webp +0 -0
- package/assets/styles/guoman-3d-tianyuan.webp +0 -0
- package/assets/styles/guoman-3d-xuanhuan.webp +0 -0
- package/assets/styles/horror-game-3d.webp +0 -0
- package/assets/styles/hyperreal-3d.webp +0 -0
- package/assets/styles/japan-cel-dark.webp +0 -0
- package/assets/styles/korean-webtoon.webp +0 -0
- package/assets/styles/low-cyberpunk-3d.webp +0 -0
- package/assets/styles/nextgen-cg.webp +0 -0
- package/assets/styles/noir-film.webp +0 -0
- package/assets/styles/openworld-survival.webp +0 -0
- package/assets/styles/paper-cut-3d.webp +0 -0
- package/assets/styles/pixar-adult-3d.webp +0 -0
- package/assets/styles/pop-marvel-2d.webp +0 -0
- package/assets/styles/sandiao-qban.webp +0 -0
- package/assets/styles/shinkai-anime.webp +0 -0
- package/assets/styles/tactical-stealth.webp +0 -0
- package/assets/styles/urban-lightreal-3d.webp +0 -0
- package/assets/styles/vaporwave-3d.webp +0 -0
- package/assets/styles/vhs90.webp +0 -0
- package/lib/types/client/panel/BookshelfBar.d.ts +0 -11
- package/lib/types/client/panel/FlowGuide.d.ts +0 -22
- package/lib/types/client/panel/MangaRoleLibrary.d.ts +0 -20
- package/lib/types/client/panel/MangaWorkspace.d.ts +0 -12
- package/lib/types/client/panel/ModelPicker.d.ts +0 -11
- package/lib/types/client/panel/ProgressHomeView.d.ts +0 -5
- package/lib/types/client/panel/PropLibrary.d.ts +0 -8
- package/lib/types/client/panel/SceneLibrary.d.ts +0 -16
- package/lib/types/client/panel/StoryboardTab.d.ts +0 -19
- package/lib/types/client/panel/StyleCard.d.ts +0 -8
- package/lib/types/client/panel/StyleGallery.d.ts +0 -1
- package/lib/types/comic-presets.d.ts +0 -12
- package/lib/types/manga-genre-rules.d.ts +0 -22
- package/lib/types/prompt-utils.d.ts +0 -35
- package/lib/types/review-policy.d.ts +0 -97
- package/lib/types/shot-language.d.ts +0 -46
- package/lib/types/src/ai-scan.d.ts +0 -36
- package/lib/types/src/assets.d.ts +0 -37
- package/lib/types/src/assistant.d.ts +0 -45
- package/lib/types/src/author-assets.d.ts +0 -25
- package/lib/types/src/bookshelf.d.ts +0 -42
- package/lib/types/src/client/api.d.ts +0 -234
- package/lib/types/src/client/docx.d.ts +0 -15
- package/lib/types/src/client/index.d.ts +0 -14
- package/lib/types/src/client/locales.d.ts +0 -212
- package/lib/types/src/client/mount.d.ts +0 -9
- package/lib/types/src/client/panel/AdaptModeView.d.ts +0 -5
- package/lib/types/src/client/panel/AssetsTab.d.ts +0 -12
- package/lib/types/src/client/panel/AssistantTab.d.ts +0 -7
- package/lib/types/src/client/panel/AuthorAssetsView.d.ts +0 -4
- package/lib/types/src/client/panel/AuthorHome.d.ts +0 -32
- package/lib/types/src/client/panel/BookshelfBar.d.ts +0 -11
- package/lib/types/src/client/panel/CreateBookView.d.ts +0 -9
- package/lib/types/src/client/panel/FlowGuide.d.ts +0 -22
- package/lib/types/src/client/panel/GlobalAssetLibraryView.d.ts +0 -4
- package/lib/types/src/client/panel/ImportModal.d.ts +0 -7
- package/lib/types/src/client/panel/MangaRoleLibrary.d.ts +0 -20
- package/lib/types/src/client/panel/MangaWorkspace.d.ts +0 -12
- package/lib/types/src/client/panel/ModelManager.d.ts +0 -14
- package/lib/types/src/client/panel/NovelPanel.d.ts +0 -13
- package/lib/types/src/client/panel/ProgressConsole.d.ts +0 -17
- package/lib/types/src/client/panel/ProgressHomeView.d.ts +0 -5
- package/lib/types/src/client/panel/PropLibrary.d.ts +0 -8
- package/lib/types/src/client/panel/ReaderView.d.ts +0 -8
- package/lib/types/src/client/panel/ReasoningSection.d.ts +0 -10
- package/lib/types/src/client/panel/RunPanel.d.ts +0 -5
- package/lib/types/src/client/panel/SceneLibrary.d.ts +0 -16
- package/lib/types/src/client/panel/SettingsView.d.ts +0 -16
- package/lib/types/src/client/panel/ShelfView.d.ts +0 -15
- package/lib/types/src/client/panel/StoryboardTab.d.ts +0 -19
- package/lib/types/src/client/panel/StyleCard.d.ts +0 -8
- package/lib/types/src/client/panel/StyleGallery.d.ts +0 -1
- package/lib/types/src/client/panel/WorldTab.d.ts +0 -10
- package/lib/types/src/client/panel/controller.d.ts +0 -19
- package/lib/types/src/client/panel/helpers.d.ts +0 -18
- package/lib/types/src/client/panel/views.d.ts +0 -77
- package/lib/types/src/client/sidebar-entry.d.ts +0 -13
- package/lib/types/src/client/text.d.ts +0 -9
- package/lib/types/src/comic-presets.d.ts +0 -12
- package/lib/types/src/docx.d.ts +0 -19
- package/lib/types/src/engine.d.ts +0 -402
- package/lib/types/src/index.d.ts +0 -79
- package/lib/types/src/manga-genre-rules.d.ts +0 -22
- package/lib/types/src/novel-context.d.ts +0 -80
- package/lib/types/src/prompt-utils.d.ts +0 -35
- package/lib/types/src/protocol.d.ts +0 -2176
- package/lib/types/src/review-policy.d.ts +0 -97
- package/lib/types/src/routes.d.ts +0 -29
- package/lib/types/src/run.d.ts +0 -32
- package/lib/types/src/shot-language.d.ts +0 -46
- package/lib/types/src/story-beat-language.d.ts +0 -35
- package/lib/types/src/style-library.d.ts +0 -33
- package/lib/types/story-beat-language.d.ts +0 -35
- package/lib/types/style-library.d.ts +0 -33
- package/src/ai-scan.ts +0 -179
- package/src/assets.ts +0 -1774
- package/src/assistant.ts +0 -915
- package/src/author-assets.ts +0 -147
- package/src/bookshelf.ts +0 -167
- package/src/client/api.ts +0 -716
- package/src/client/css-modules.d.ts +0 -8
- package/src/client/docx.ts +0 -69
- package/src/client/index.ts +0 -34
- package/src/client/llmLive.ts +0 -101
- package/src/client/locales.ts +0 -418
- package/src/client/mount.tsx +0 -97
- package/src/client/mount.tsx._new +0 -97
- package/src/client/mount.tsx._nf +0 -97
- package/src/client/mount.tsx._tmp +0 -97
- package/src/client/panel/AdaptModeView.tsx +0 -535
- package/src/client/panel/AssetsTab.tsx +0 -458
- package/src/client/panel/AssistantTab.tsx +0 -339
- package/src/client/panel/AuthorAssetsView.tsx +0 -208
- package/src/client/panel/AuthorHome.tsx +0 -234
- package/src/client/panel/BookAnalysisView.tsx +0 -60
- package/src/client/panel/BookshelfBar.tsx +0 -170
- package/src/client/panel/CreateBookView.tsx +0 -371
- package/src/client/panel/DirectorView.tsx +0 -200
- package/src/client/panel/FlowGuide.tsx +0 -84
- package/src/client/panel/GlobalAssetLibraryView.tsx +0 -172
- package/src/client/panel/IdeaInspirationView.tsx +0 -71
- package/src/client/panel/ImportModal.tsx +0 -303
- package/src/client/panel/KnowledgeBaseView.tsx +0 -73
- package/src/client/panel/LiveFeedLog.tsx +0 -76
- package/src/client/panel/MangaRoleLibrary.tsx +0 -1002
- package/src/client/panel/MangaWorkspace.tsx +0 -715
- package/src/client/panel/MarketRadarView.tsx +0 -374
- package/src/client/panel/ModelManager.tsx +0 -205
- package/src/client/panel/NovelPanel.tsx +0 -4721
- package/src/client/panel/ProgressConsole.tsx +0 -63
- package/src/client/panel/ProgressHomeView.tsx +0 -87
- package/src/client/panel/PropLibrary.tsx +0 -175
- package/src/client/panel/ReaderView.tsx +0 -306
- package/src/client/panel/ReasoningSection.tsx +0 -31
- package/src/client/panel/RunPanel.tsx +0 -204
- package/src/client/panel/SceneLibrary.tsx +0 -453
- package/src/client/panel/SettingsView.tsx +0 -289
- package/src/client/panel/ShelfView.tsx +0 -242
- package/src/client/panel/StoryboardTab.tsx +0 -472
- package/src/client/panel/StyleCard.tsx +0 -90
- package/src/client/panel/StyleGallery.tsx +0 -58
- package/src/client/panel/WorldTab.tsx +0 -202
- package/src/client/panel/controller.ts +0 -45
- package/src/client/panel/helpers.ts +0 -67
- package/src/client/panel/panel.module.css +0 -4359
- package/src/client/panel/views.tsx +0 -314
- package/src/client/sidebar-entry.ts +0 -122
- package/src/client/text.ts +0 -28
- package/src/comic-presets.ts +0 -67
- package/src/docx.ts +0 -83
- package/src/engine.ts +0 -5636
- package/src/global-assets.ts +0 -59
- package/src/index.ts +0 -346
- package/src/llm-live.ts +0 -68
- package/src/manga-genre-rules.ts +0 -87
- package/src/market-radar-scan.ts +0 -41
- package/src/market-radar-sources.ts +0 -173
- package/src/novel-context.ts +0 -287
- package/src/prompt-utils.ts +0 -73
- package/src/prompting.ts +0 -159
- package/src/protocol.ts +0 -2565
- package/src/review-policy.ts +0 -161
- package/src/routes.ts +0 -3939
- package/src/run.ts +0 -338
- package/src/shot-language.ts +0 -181
- package/src/story-beat-language.ts +0 -130
- package/src/style-library.ts +0 -84
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 纯展示组件(views):所有状态与事件处理器都留在 NovelPanel,
|
|
3
|
-
* 这里只接收 props 渲染。便于单独维护与复用。
|
|
4
|
-
*/
|
|
5
1
|
import type { ReactElement } from 'react';
|
|
6
|
-
import type {
|
|
7
|
-
/**
|
|
8
|
-
export declare function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
detailTitle?: string;
|
|
18
|
-
}): ReactElement;
|
|
19
|
-
/** 待办队列行。 */
|
|
20
|
-
export declare function TodoRow(props: {
|
|
21
|
-
tone: 'danger' | 'warning' | 'info' | 'success';
|
|
22
|
-
title: string;
|
|
23
|
-
description: string;
|
|
24
|
-
actionLabel: string;
|
|
25
|
-
disabled: boolean;
|
|
26
|
-
onAction: () => void;
|
|
27
|
-
}): ReactElement;
|
|
28
|
-
/** 全书质检问题行。 */
|
|
29
|
-
export declare function AuditIssueRow(props: {
|
|
30
|
-
issue: AuditIssue;
|
|
31
|
-
disabled: boolean;
|
|
32
|
-
onFix: () => void;
|
|
33
|
-
}): ReactElement;
|
|
2
|
+
import type { Plotline, PlotlineHealthReport, PlotlinePlan, RoleRecord, RoleStatusCard } from '../../protocol.ts';
|
|
3
|
+
/** 滑轨胶囊导航(B5-5):active 高亮为滑动指示块,随选中项平移。 */
|
|
4
|
+
export declare function SlideNav<T extends string>(props: {
|
|
5
|
+
ariaLabel: string;
|
|
6
|
+
items: ReadonlyArray<{
|
|
7
|
+
id: T;
|
|
8
|
+
label: ReactElement | string;
|
|
9
|
+
}>;
|
|
10
|
+
active: T;
|
|
11
|
+
onSelect: (id: T) => void;
|
|
12
|
+
}): JSX.Element;
|
|
34
13
|
/** 剧情线卡片(列表主体)。 */
|
|
35
14
|
export declare function PlotlineCard(props: {
|
|
36
15
|
line: Plotline;
|
|
@@ -54,24 +33,31 @@ export declare function RoleCard(props: {
|
|
|
54
33
|
onEdit: () => void;
|
|
55
34
|
onRemove: () => void;
|
|
56
35
|
}): ReactElement;
|
|
57
|
-
/**
|
|
36
|
+
/** 剧情健康检查报告面板。 */
|
|
58
37
|
export declare function PlotlineHealthPanel(props: {
|
|
59
38
|
report: PlotlineHealthReport;
|
|
60
39
|
disabled: boolean;
|
|
61
40
|
onPlan: () => void;
|
|
62
41
|
onClose: () => void;
|
|
63
42
|
}): ReactElement;
|
|
64
|
-
/**
|
|
43
|
+
/** 剧情方案面板。 */
|
|
65
44
|
export declare function PlotlinePlanPanel(props: {
|
|
66
45
|
plan: PlotlinePlan;
|
|
67
46
|
disabled: boolean;
|
|
68
47
|
onAdopt: (suggestion: Plotline) => void;
|
|
69
48
|
onClose: () => void;
|
|
70
49
|
}): ReactElement;
|
|
71
|
-
/**
|
|
50
|
+
/** 建议剧情线面板。 */
|
|
72
51
|
export declare function PlotlineSuggestionPanel(props: {
|
|
73
52
|
suggestions: Plotline[];
|
|
74
53
|
disabled: boolean;
|
|
75
54
|
onAdopt: (suggestion: Plotline) => void;
|
|
76
55
|
onClose: () => void;
|
|
77
56
|
}): ReactElement;
|
|
57
|
+
/** 空状态基元:图标 + 标题 + 可选提示。compact 变体用于列表/卡片内嵌场景。 */
|
|
58
|
+
export declare function EmptyState(props: {
|
|
59
|
+
icon?: string;
|
|
60
|
+
title: string;
|
|
61
|
+
hint?: string;
|
|
62
|
+
compact?: boolean;
|
|
63
|
+
}): ReactElement;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 运行状态芯片:固定在页面顶部的「小说工坊生成状态」小徽标。
|
|
3
|
+
* 轮询 /run/status,实时显示 生成中/暂停/完成/停止/出错 + 当前章号;
|
|
4
|
+
* 点击可打开/关闭小说工坊面板。独立 DOM 注入,不触碰主面板逻辑,挂载失败静默降级。
|
|
5
|
+
* 显示偏好(关 / 仅生成中暂停时 / 总是)存在 localStorage,见 chip-prefs.ts:
|
|
6
|
+
* 书架页「设置 · 全局 → 外观与主题」里有对应下拉,选择即时生效(跨标签页也同步)。
|
|
7
|
+
*
|
|
8
|
+
* P0 重写说明(原实现的三个问题):
|
|
9
|
+
* 1. 整块背景染状态色 + 固定白字 → 浅色主题下「白字配亮底」对比度崩坏。
|
|
10
|
+
* 现在改为「玻璃底 + 主题前景色文字 + 左侧状态色点」,状态只由色点承载,
|
|
11
|
+
* 文字永远跟随主题,任何深浅色下都可读。
|
|
12
|
+
* 2. 样式写死在 JS 的 inline style 里,切主题纹丝不动。
|
|
13
|
+
* 现在改用 CSS Module class,配色走 --nf-chip-* 令牌,
|
|
14
|
+
* 由 body[data-ds-dark-theme] 跟随宿主深浅色。
|
|
15
|
+
* 3. role="button" 却没有 tabindex、没有键盘处理,键盘用户完全用不了。
|
|
16
|
+
* 现在补 tabindex + Enter/Space 激活 + aria-label/live。
|
|
17
|
+
*/
|
|
18
|
+
import type { NovelApi } from './api.ts';
|
|
19
|
+
import type { PanelController } from './panel/controller.ts';
|
|
20
|
+
/** 生成一个固定顶部的状态芯片并开始轮询。返回 dispose。 */
|
|
21
|
+
export declare function mountRunStatus(controller: PanelController, api: NovelApi): () => void;
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* sibling plugin entries and self-heals via MutationObserver.
|
|
5
5
|
*/
|
|
6
6
|
import type { PanelController } from './panel/controller.ts';
|
|
7
|
-
/** Stable data attribute identifying the injected entry row. */
|
|
8
|
-
export declare const ENTRY_SELECTOR = "[data-dsh-novelforge-entry]";
|
|
9
7
|
/**
|
|
10
8
|
* Mount the sidebar entry, waiting for the shell and self-healing on
|
|
11
9
|
* re-renders.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 章节「摘要 + 事实 + 时间线」合并抽取的**解析收敛层**。
|
|
3
|
+
*
|
|
4
|
+
* ## 为什么独立成文件
|
|
5
|
+
*
|
|
6
|
+
* 合并后一次 LLM 调用要parse 三个字段,最容易出错的地方不是「怎么调模型」,
|
|
7
|
+
* 而是**「模型返回畸形 JSON 时怎么收敛」**:字段缺失、类型不对、数组里混null、
|
|
8
|
+
* runaway 长文本。任何一项坏掉都不该拖垮另外两项。
|
|
9
|
+
*
|
|
10
|
+
* 这层逻辑必须能被离线验证,而 engine.ts 依赖宿主包 `@deepseek-ai/dsh-llm`
|
|
11
|
+
* (脱离 dsh 环境直接import 失败)。所以规则层放这里,保持零依赖。
|
|
12
|
+
*/
|
|
13
|
+
/** 把 LLM 返回的原始 facts 收敛为合法事实条目(过滤过短项、截断超长项)。 */
|
|
14
|
+
export declare function parseFactLines(raw: unknown): string[];
|
|
15
|
+
/** 把 LLM 返回的原始 timeline 收敛为对象数组(剔除非对象成员)。 */
|
|
16
|
+
export declare function parseTimelineItems(raw: unknown): Record<string, unknown>[];
|
|
17
|
+
/**
|
|
18
|
+
* timeline 单项的字段映射:缺失/错类型一律回落到安全默认,绝不产出 undefined 字段。
|
|
19
|
+
*
|
|
20
|
+
* @param item - 模型给出的原始项。
|
|
21
|
+
* @param index - 该项在数组中的下标;模型没给 `order` 时用它兜底,保证章内序号连续。
|
|
22
|
+
*/
|
|
23
|
+
export declare function mapTimelineItem(item: Record<string, unknown>, index: number): {
|
|
24
|
+
time: string;
|
|
25
|
+
order: number;
|
|
26
|
+
place: string;
|
|
27
|
+
characters: string[];
|
|
28
|
+
event: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* docx 文本提取共享核心:服务端(src/docx.ts)与浏览器端(src/client/docx.ts)
|
|
3
|
+
* 共用 XML → 纯文本的解析逻辑,避免两份实现漂移。
|
|
4
|
+
* zip 解压入口因运行时不同(fflate vs fflate/browser,浏览器端必须走 browser
|
|
5
|
+
* 入口以避开 node:module 的 require 探测)留在两端各自处理。
|
|
6
|
+
*/
|
|
7
|
+
/** 解码 docx 正文实际会用到的少量 XML 实体。 */
|
|
8
|
+
export declare function decodeEntities(text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* 从 word/document.xml 的 XML 字符串提取纯文本:每个 <w:p> 段落一行,
|
|
11
|
+
* <w:tab>/<w:br> 保留为空白符;表格与嵌套结构按文档顺序拍平
|
|
12
|
+
* (它们的段落同样是 <w:p>)。
|
|
13
|
+
* @param xml - document.xml 解码后的字符串。
|
|
14
|
+
* @returns 正文文本(空文本时抛错)。
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractDocxTextFromXml(xml: string): string;
|
package/lib/types/docx.d.ts
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* docx outline extraction: a .docx is a zip whose word/document.xml holds the
|
|
3
3
|
* body text in <w:t> runs inside <w:p> paragraphs. We unzip with fflate and
|
|
4
4
|
* walk the XML with a tiny tokenizer — no heavyweight XML/DOM dependency.
|
|
5
|
+
* XML 解析共享核心在 ./docx-core.ts(与浏览器端同源)。
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
|
-
* Extract plain text from a docx buffer: one line per <w:p> paragraph
|
|
8
|
-
* <w:tab>/<w:br> preserved as whitespace. Tables and nested structures are
|
|
9
|
-
* flattened in document order (their paragraphs are just <w:p> too).
|
|
8
|
+
* Extract plain text from a docx buffer: one line per <w:p> paragraph.
|
|
10
9
|
* @param buffer - the raw .docx bytes.
|
|
11
10
|
* @returns the body text.
|
|
12
11
|
*/
|
package/lib/types/engine.d.ts
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const COMPLIANCE_REDLINES: ReadonlyArray<string>;
|
|
14
14
|
import type { Context } from '@deepseek-ai/cordis';
|
|
15
|
-
import
|
|
15
|
+
import { fullTextBudget } from './model-capability.ts';
|
|
16
|
+
import { applyModelCapability } from './model-request.ts';
|
|
17
|
+
import type { AdaptationDimension, AdaptAnalyzeResponse, AdaptationMapping, AdaptationRules, AdaptProposeResponse, AuditIssue, AuthorReview, ExportScope, TimelineEvent, TimelineIssue, BreakdownResponse, ChapterPlan, Foreshadow, NovelConfig, OutlineCandidate, Plotline, PlotlineHealthReport, PlotlinePlan, ProjectState, ReviewReport, RoleRecord, RoleStatusCard, StoryBible, AddModelRequest, AddModelResponse, LlmModelsResponse, LlmVendorsResponse, LlmProvidersResponse, RemoveProviderRequest, RemoveProviderResponse, LlmTestResponse, Volume, WorldState, AdaptMaterializeRequest, AdaptMaterializeResponse, AdaptMaterializeSaveRequest, AdaptMaterializeSaveResponse, MarketRadarRequest, MarketRadarResult, MarketRadarSignal, MarketRadarBriefRequest, ProductionFoundation, MarketCreativeBrief, BookAnalysisRequest, BookAnalysisResult, IdeaInspirationRequest, IdeaInspirationResult, DirectorRequest, DirectorAdvice } from './protocol.ts';
|
|
16
18
|
/** Project state file name inside the output dir. */
|
|
17
19
|
export declare const PROJECT_FILE = "novel-project.json";
|
|
18
20
|
/** Chapter output file name, e.g. 第001章_开篇.md */
|
|
@@ -44,6 +46,20 @@ export declare function syncProjectWithDisk(project: ProjectState, outputDir: st
|
|
|
44
46
|
export declare function readChapterFile(outputDir: string, chapter: ChapterPlan): string | undefined;
|
|
45
47
|
/** Create a fresh project from an outline. */
|
|
46
48
|
export declare function createProject(outline: string, outlinePath?: string): ProjectState;
|
|
49
|
+
/**
|
|
50
|
+
* 把已经拼好的请求过一遍模型参数能力层。
|
|
51
|
+
*
|
|
52
|
+
* **凡是自己构造 `GenerateOptions`、不走 {@link complete} 的调用点都必须经过它**,
|
|
53
|
+
* 否则那条路径会绕过厂商参数约束(固定温度、不支持的 reasoning 等),对 Kimi
|
|
54
|
+
* 这类模型直接报参数错误 —— 而"测试连通"恰恰是用户用来判断配置对不对的地方。
|
|
55
|
+
*
|
|
56
|
+
* 抽成函数而不是在每个调用点内联:流式调用点有 5 处,还要各自处理备用模型切换,
|
|
57
|
+
* 内联五遍就是同一件事写五份,必然漂移。
|
|
58
|
+
*
|
|
59
|
+
* 实现已挪到 {@link ./model-request.ts}(需要 dsh-llm 的运行时值),这里只做转出,
|
|
60
|
+
* 以保持 engine 内部与既有调用点的写法不变。
|
|
61
|
+
*/
|
|
62
|
+
export { applyModelCapability, fullTextBudget };
|
|
47
63
|
/** Extract the story bible from an outline. */
|
|
48
64
|
export declare function extractBible(ctx: Context, config: NovelConfig, outline: string, project?: ProjectState): Promise<StoryBible>;
|
|
49
65
|
/** Plan volumes from an outline. */
|
|
@@ -63,15 +79,39 @@ export declare function reviewChapterText(ctx: Context, config: NovelConfig, pro
|
|
|
63
79
|
export declare function authorReviewChapter(ctx: Context, config: NovelConfig, project: ProjectState, chapterNo: number, body: string, prevTail: string): Promise<AuthorReview>;
|
|
64
80
|
/** 复盘后自动关联:把本章号写入复盘标记推进的剧情线(按名称匹配,去重)。 */
|
|
65
81
|
export declare function autoLinkPlotlines(project: ProjectState, chapterNo: number, advancedLines: string[]): void;
|
|
66
|
-
/**
|
|
82
|
+
/** 建议剧情线:基于大纲/卷计划/已写章节/编年录,提炼候选线。 */
|
|
67
83
|
export declare function suggestPlotlines(ctx: Context, config: NovelConfig, project: ProjectState): Promise<Plotline[]>;
|
|
68
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* 刷新剧情线进度:结合编年录与各章摘要分析该线推进到哪。
|
|
86
|
+
*
|
|
87
|
+
* 支持一次刷新多条:`lines` 传入多条时,只发**一次**请求。
|
|
88
|
+
*
|
|
89
|
+
* ## 为什么要合并
|
|
90
|
+
*
|
|
91
|
+
* 原实现一次只能刷一条,于是作者有 8 条线就得点 8 次、跑 8 次 LLM——
|
|
92
|
+
* 而这 8 次请求的**输入前缀完全相同**(同样的最近 8 章摘要 + 15 条编年录)。
|
|
93
|
+
* 也就是说同一份上下文被重复发送了 8 遍。真实项目(151 章 / 8 条线 / 300 条事实)
|
|
94
|
+
* 实测:合并后每条线的输入从 ~1900 tok 降到 ~700 tok,且**延迟从 8 次串行
|
|
95
|
+
* 降到 1 次**。
|
|
96
|
+
*
|
|
97
|
+
* 另外,单条刷新时只带 8 章摘要——多线合并后仍只带 8 章(摘要本身就是截断的),
|
|
98
|
+
* 但一次就能看出「哪条线卡住了、哪条线其实早就推进完了」,交叉参照更准。
|
|
99
|
+
*
|
|
100
|
+
* @param lines - 要刷新的线;省略则取全部 active/paused 线。
|
|
101
|
+
* @returns 实际写入进度的线 id 列表(失败的线不在其中)。
|
|
102
|
+
*/
|
|
69
103
|
export declare function refreshPlotlineProgress(ctx: Context, config: NovelConfig, project: ProjectState, line: Plotline): Promise<string>;
|
|
70
|
-
|
|
104
|
+
export declare function refreshPlotlineProgress(ctx: Context, config: NovelConfig, project: ProjectState, lines: Plotline[]): Promise<string[]>;
|
|
105
|
+
export type RefreshResult = {
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
text: string;
|
|
109
|
+
};
|
|
110
|
+
/** 实际的批量刷新实现(被上面的重载收敛到一处)。 */
|
|
111
|
+
export declare function refreshLinesFor(ctx: Context, config: NovelConfig, project: ProjectState, lines: Plotline[]): Promise<RefreshResult[]>;
|
|
112
|
+
/** AI 从全书提炼角色库:大纲 + 道藏 + 编年录 + 章节摘要 → 结构化角色清单。 */
|
|
71
113
|
export declare function extractRoles(ctx: Context, config: NovelConfig, project: ProjectState): Promise<RoleRecord[]>;
|
|
72
|
-
/**
|
|
73
|
-
export declare function extractScenes(ctx: Context, config: NovelConfig, project: ProjectState, chapterNo?: number, styleId?: string, filterId?: string): Promise<SceneCard[]>;
|
|
74
|
-
/** 从 txt/md 全本文本拆章(纯逻辑,不落盘):识别章节头、剥离重复标题、去重、排序并统一重新编号。 */
|
|
114
|
+
/** AI 从全书提炼场景库:正文/编年录 → 高频重要场景的结构化视觉锚点。 */
|
|
75
115
|
export declare function splitBookText(raw: string): Array<{
|
|
76
116
|
no: number;
|
|
77
117
|
title: string;
|
|
@@ -98,43 +138,10 @@ export declare function importBookText(filePath: string, outputDir: string): {
|
|
|
98
138
|
chapters: number;
|
|
99
139
|
skipped: string[];
|
|
100
140
|
};
|
|
101
|
-
/**
|
|
102
|
-
export interface RoleVisualPrompt {
|
|
103
|
-
zh: string;
|
|
104
|
-
en: string;
|
|
105
|
-
tags: string[];
|
|
106
|
-
source: string;
|
|
107
|
-
/** 即梦/生图通用负面提示词。 */
|
|
108
|
-
negativePrompt?: string;
|
|
109
|
-
/** 该角色所需情绪表情清单(6-12 个,如 疲惫/麻木/压抑悲伤)。 */
|
|
110
|
-
expressions?: string[];
|
|
111
|
-
/** 四类精修提示词(立绘/四视图/表情/细节,一次提炼直接产出)。 */
|
|
112
|
-
promptKit?: RoleRecord['promptKit'];
|
|
113
|
-
}
|
|
114
|
-
/** 小说角色库:提炼单个角色的形象锚点并写回角色卡。 */
|
|
115
|
-
export declare function extractRoleVisual(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, roleName: string, styleId?: string, filterId?: string): Promise<RoleVisualPrompt>;
|
|
116
|
-
/** 漫剧角色卡:提炼形象锚点并写回漫剧卡(status → anchored)。 */
|
|
117
|
-
export declare function extractMangaRoleVisual(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, cardId: string, styleId?: string, filterId?: string): Promise<RoleVisualPrompt>;
|
|
118
|
-
/** 小说角色库:角色四类生图提示词精修包(写回角色卡)。 */
|
|
119
|
-
export declare function generateRolePromptKit(ctx: Context, config: NovelConfig, project: ProjectState, roleName: string, styleId?: string, filterId?: string): Promise<RoleRecord['promptKit']>;
|
|
120
|
-
/** 漫剧角色卡:四类生图提示词精修包(写回漫剧卡,status → anchored)。 */
|
|
121
|
-
export declare function generateMangaRolePromptKit(ctx: Context, config: NovelConfig, project: ProjectState, cardId: string, styleId?: string, filterId?: string): Promise<RoleRecord['promptKit']>;
|
|
122
|
-
/**
|
|
123
|
-
* 漫剧角色库·提名(两段式):从某章分镜的 characters 提名候选角色名 →
|
|
124
|
-
* 规则过滤(精确名 + 身份/简称匹配,短名单 ≤5)→ LLM 确认(是/否 + 选哪个,不做开放检索)→
|
|
125
|
-
* 返回带漫剧卡建议的候选(未匹配时给出「回小说库补提炼 / 漫剧直接创建」判定)。
|
|
126
|
-
*/
|
|
127
|
-
export declare function nominateMangaRoles(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<MangaRoleCandidate[]>;
|
|
128
|
-
/** ✨ 从道藏/红线提炼「视觉世界观规则」:生图/生视频必须遵守的设定纠偏(如"商品=人,禁止常规超市商品")。 */
|
|
129
|
-
export declare function extractVisualRules(ctx: Context, config: NovelConfig, project: ProjectState): Promise<string[]>;
|
|
130
|
-
/**
|
|
131
|
-
* 开书想法 → AI 大纲:输入一句话想法,生成 2-3 个方向不同、可直接开书的完整大纲方案。
|
|
132
|
-
* @param count 本次生成几个(默认 3,最多 3)
|
|
133
|
-
* @param exclude 已暂留方案的剧情方向/卖点摘要(换批时避开,防止重复)
|
|
134
|
-
*/
|
|
141
|
+
/** 保证风格词块已内嵌(LLM 偶发漏嵌时兜底):zh 段首前缀,en 末尾追加。 */
|
|
135
142
|
export declare function suggestOutlines(ctx: Context, config: NovelConfig, idea: string, count?: number, exclude?: string[]): Promise<OutlineCandidate[]>;
|
|
136
143
|
/** 拆书分析:对已写章节做结构/人物/文风/卖点四维体检。
|
|
137
|
-
*
|
|
144
|
+
* 两阶段管道(先抽取候选、再落库):
|
|
138
145
|
* ① 源片段笔记:每章抽取结构化笔记(剧情/人物/设定/写法/卖点/短板信号)
|
|
139
146
|
* ② 分节分析:按维度各跑一次 LLM,输出可读分析稿 + 结构化数据 + 证据链。
|
|
140
147
|
* @param scope 'recent'(默认最近20章) | 'volume:N' | 'all'
|
|
@@ -157,14 +164,9 @@ export declare function removeLlmProvider(ctx: Context, req: RemoveProviderReque
|
|
|
157
164
|
* 写入 DSH 凭据 refs,并(必要时)注册/更新 llm-pi-ai provider 路由。
|
|
158
165
|
*/
|
|
159
166
|
export declare function registerLlmModel(ctx: Context, req: AddModelRequest): Promise<AddModelResponse>;
|
|
160
|
-
/**
|
|
161
|
-
export declare function getActiveMangaStyle(project: ProjectState): {
|
|
162
|
-
styleId?: string;
|
|
163
|
-
filterId?: string;
|
|
164
|
-
};
|
|
165
|
-
/** 🩺 剧情健康检查:基于已写章节数/各线状态/编年录,判断是否需要新线及添加时机。 */
|
|
167
|
+
/** 剧情健康检查:基于已写章节数/各线状态/编年录,判断是否需要新线及添加时机。 */
|
|
166
168
|
export declare function analyzePlotlineHealth(ctx: Context, config: NovelConfig, project: ProjectState): Promise<PlotlineHealthReport>;
|
|
167
|
-
/**
|
|
169
|
+
/** 剧情方案:基于健康检查结果设计下一阶段方向与建议新线。 */
|
|
168
170
|
export declare function designPlotlinePlan(ctx: Context, config: NovelConfig, project: ProjectState, health?: PlotlineHealthReport): Promise<PlotlinePlan>;
|
|
169
171
|
/**
|
|
170
172
|
* Stream a chapter rewrite. With `target` (a passage of the body), only that
|
|
@@ -194,6 +196,8 @@ export declare function polishChapterStream(ctx: Context, config: NovelConfig, p
|
|
|
194
196
|
chars: number;
|
|
195
197
|
draft: string;
|
|
196
198
|
}, void, unknown>;
|
|
199
|
+
/** 统计中文字符数(汉字),与「每章字数」红线口径一致(不含标点/换行)。 */
|
|
200
|
+
export declare function countHanzi(text: string): number;
|
|
197
201
|
/** Generate one chapter (streaming). Yields progress frames; persists when done. */
|
|
198
202
|
export declare function generateChapterStream(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): AsyncGenerator<{
|
|
199
203
|
frame: 'start';
|
|
@@ -208,27 +212,6 @@ export declare function generateChapterStream(ctx: Context, config: NovelConfig,
|
|
|
208
212
|
}, void, unknown>;
|
|
209
213
|
/** Generate a chapter summary (narrative memory). */
|
|
210
214
|
export declare function summarizeChapter(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<string>;
|
|
211
|
-
/**
|
|
212
|
-
* 分镜·导演级:剧情骨架 → 分镜表(镜头级)。
|
|
213
|
-
* 只做画面层:景别/机位运镜/时长/画面/台词/音效/光效 + 状态连续;禁止改剧情(骨架只读)。
|
|
214
|
-
*/
|
|
215
|
-
export declare function generateStoryboardTable(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number, skeleton: StoryboardSkeleton, styleId?: string, filterId?: string): Promise<StoryboardTable>;
|
|
216
|
-
/**
|
|
217
|
-
* 提炼常驻道具(跨镜头需一致):从已写章节正文识别反复出现的关键道具 + 一行统一外观描述。
|
|
218
|
-
* 生成分镜提示词前自动调用,若道具库为空则补齐;道具库存 project.props,注入提示词保持跨镜头一致。
|
|
219
|
-
*/
|
|
220
|
-
export declare function extractProps(ctx: Context, config: NovelConfig, project: ProjectState): Promise<Prop[]>;
|
|
221
|
-
/**
|
|
222
|
-
* 分镜·提示词级:分镜表 → 即梦可粘贴视频提示词。
|
|
223
|
-
* 每镜头一段:风格词块(基底+滤镜)+ 画面内容(角色动作/服装标志物)+ 机位运镜 + 光效。
|
|
224
|
-
* 提示词聚焦画面与镜头(视频模型无音频,台词/音效不注入)。
|
|
225
|
-
*/
|
|
226
|
-
export declare function generateStoryboardPrompts(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number, table: StoryboardTable, styleId?: string, filterId?: string): Promise<StoryboardPrompt[]>;
|
|
227
|
-
/**
|
|
228
|
-
* 分镜·编剧级:单章 → 剧情骨架(节拍链)。
|
|
229
|
-
* 只做故事层(事件/情绪/功能/因果),不做画面;导演级分镜在其上展开。
|
|
230
|
-
*/
|
|
231
|
-
export declare function generateStoryboardSkeleton(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<StoryboardSkeleton>;
|
|
232
215
|
/**
|
|
233
216
|
* 反向推大纲:从已写章节正文反推出全书总纲(分卷 + 章节要点 + 主线/人物弧线/伏笔清单)。
|
|
234
217
|
* 两阶段:分批提取章节事件摘要 → 汇总生成大纲。不修改章节/设定,只返回大纲文本。
|
|
@@ -241,7 +224,7 @@ export declare function reverseOutlineFromChapters(ctx: Context, config: NovelCo
|
|
|
241
224
|
*/
|
|
242
225
|
export declare function analyzeAdaptation(ctx: Context, config: NovelConfig, text: string): Promise<AdaptAnalyzeResponse>;
|
|
243
226
|
/** 改编方案:由用户勾选的维度与新值,生成 LLM 映射表/规则/影响清单。 */
|
|
244
|
-
export declare function proposeAdaptation(ctx: Context, config: NovelConfig,
|
|
227
|
+
export declare function proposeAdaptation(ctx: Context, config: NovelConfig, _text: string, selections: Array<{
|
|
245
228
|
key: string;
|
|
246
229
|
title: string;
|
|
247
230
|
current: string;
|
|
@@ -298,6 +281,36 @@ export declare function summarizeAndExtractFacts(ctx: Context, config: NovelConf
|
|
|
298
281
|
summary: string;
|
|
299
282
|
factCount: number;
|
|
300
283
|
}>;
|
|
284
|
+
/**
|
|
285
|
+
* 摘要 + 事实 + 时间线:**一次** LLM 调用出全部三样。
|
|
286
|
+
*
|
|
287
|
+
* ## 为什么合并(实测收益)
|
|
288
|
+
*
|
|
289
|
+
* 三样东西的输入是**同一份章节正文**。分开调用等于把整章正文完整送两遍——
|
|
290
|
+
* 而正文恰恰是这三步里最大的 token 项。用真实项目(120 章,每章 3700-8700 字符)
|
|
291
|
+
* 实测:合并前平均每章输入 6742 tok,合并后 3726 tok,**省 44.7%**。
|
|
292
|
+
* 整本书一次生成约省 36 万输入 token。
|
|
293
|
+
*
|
|
294
|
+
* 之所以以前没合:三者的产出结构不同(对象 / 数组 / 数组),且时间线单独走
|
|
295
|
+
* `auditModel`。现在统一成一个 JSON 对象,模型差异交由调用方按需传入。
|
|
296
|
+
*
|
|
297
|
+
* ## 失败语义(重要)
|
|
298
|
+
*
|
|
299
|
+
* 合并后**一次失败三项全丢**,而分开时摘要失败不影响时间线。故本函数对
|
|
300
|
+
* 每个字段独立解析、缺失即为空,绝不因为一项坏掉就丢弃另两项好的。
|
|
301
|
+
* 调用方若对时间线有强需求,仍可调原有的 {@link extractTimelineForChapter} 单独补。
|
|
302
|
+
*
|
|
303
|
+
* @returns 摘要、实际入库的事实条数、写入的时间线事件数。
|
|
304
|
+
*/
|
|
305
|
+
export declare function summarizeFactsAndTimeline(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number, options?: {
|
|
306
|
+
model?: string;
|
|
307
|
+
maxTokens?: number;
|
|
308
|
+
timeline?: boolean;
|
|
309
|
+
}): Promise<{
|
|
310
|
+
summary: string;
|
|
311
|
+
factCount: number;
|
|
312
|
+
timelineCount: number;
|
|
313
|
+
}>;
|
|
301
314
|
/**
|
|
302
315
|
* 伏笔落地标记:检查刚生成的章节正文是否埋下了 planned 伏笔(关键词匹配),
|
|
303
316
|
* 命中则将该伏笔标记为 planted 并记录 plantedChapter——保证暗线管理页与正文同步。
|
|
@@ -312,7 +325,7 @@ export declare function markForeshadowPlanted(project: ProjectState, outputDir:
|
|
|
312
325
|
export declare function extractFacts(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<number>;
|
|
313
326
|
/** 全书一致性质检:LLM 分批扫描已生成章节 + 设定 + 事实库,聚合矛盾清单。 */
|
|
314
327
|
export declare function auditBook(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, onProgress?: (completedBatches: number, totalBatches: number) => void): Promise<AuditIssue[]>;
|
|
315
|
-
/**
|
|
328
|
+
/** 小说简介:生成或按已写开头补全(面向读者的作品门面)。 */
|
|
316
329
|
export declare function generateBlurb(ctx: Context, config: NovelConfig, project: ProjectState, partial?: string): Promise<string>;
|
|
317
330
|
/**
|
|
318
331
|
* 组装全书上下文包(AI 助手 book_overview 工具)。
|
|
@@ -338,7 +351,7 @@ export interface ImpactItem {
|
|
|
338
351
|
export declare function analyzeImpact(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, change: string): Promise<ImpactItem[]>;
|
|
339
352
|
/** 把大世界结构化数据渲染成提示词块(境界体系按顺序强约束)。 */
|
|
340
353
|
export declare function renderWorld(world: WorldState | undefined): string;
|
|
341
|
-
/**
|
|
354
|
+
/** 提炼大世界:从大纲 + 道藏生成结构化境界体系/区域/势力。 */
|
|
342
355
|
export declare function extractWorld(ctx: Context, config: NovelConfig, project: ProjectState): Promise<WorldState>;
|
|
343
356
|
/**
|
|
344
357
|
* 事实库回填:对历史已生成章节批量抽取事实(无事实记录的旧章节)。
|
|
@@ -390,41 +403,47 @@ export declare function runMarketIdeaInspiration(ctx: Context, config: NovelConf
|
|
|
390
403
|
}): Promise<IdeaInspirationResult>;
|
|
391
404
|
/** 自动导演编排建议:基于全书上下文,给出下一卷/阶段编排 + 修复再平衡。 */
|
|
392
405
|
export declare function runDirectorAdvice(ctx: Context, config: NovelConfig, project: ProjectState, req: DirectorRequest): Promise<DirectorAdvice>;
|
|
406
|
+
/**
|
|
407
|
+
* 从一章正文抽取时间线事件(时间点 / 地点 / 参与角色 / 事件)。
|
|
408
|
+
*
|
|
409
|
+
* 会**替换**该章已有事件(重复抽取幂等);抽取结果按 order 递增排序后写回项目。
|
|
410
|
+
* 失败时抛错,由调用方决定是否降级(自动流程用 try/catch 包住,不阻断出章)。
|
|
411
|
+
*
|
|
412
|
+
* @param ctx 宿主上下文。
|
|
413
|
+
* @param config 运行时配置。
|
|
414
|
+
* @param project 项目状态(就地更新 `project.timeline`)。
|
|
415
|
+
* @param outputDir 书目录。
|
|
416
|
+
* @param chapterNo 章节号。
|
|
417
|
+
* @returns 本次抽取到的事件(已写入 project)。
|
|
418
|
+
*/
|
|
419
|
+
export declare function extractTimelineForChapter(ctx: Context, config: NovelConfig, project: ProjectState, outputDir: string, chapterNo: number): Promise<TimelineEvent[]>;
|
|
420
|
+
/**
|
|
421
|
+
* AI 复核时间线:在规则初筛之外,让模型找规则抓不到的时序问题
|
|
422
|
+
* (年龄/季节错位、回忆与当前时间混淆、跨章跨度不合理等)。
|
|
423
|
+
*
|
|
424
|
+
* @param ctx 宿主上下文。
|
|
425
|
+
* @param config 运行时配置。
|
|
426
|
+
* @param project 项目状态。
|
|
427
|
+
* @returns 模型给出的问题清单(与规则初筛结果合并由调用方决定)。
|
|
428
|
+
*/
|
|
429
|
+
export declare function reviewTimeline(ctx: Context, config: NovelConfig, project: ProjectState): Promise<TimelineIssue[]>;
|
|
393
430
|
/** Export the whole book as one txt/md file. */
|
|
394
431
|
export declare function exportBook(outputDir: string, project: ProjectState, format: 'txt' | 'md'): {
|
|
395
432
|
file: string;
|
|
396
433
|
chars: number;
|
|
397
434
|
chapters: number;
|
|
398
435
|
};
|
|
399
|
-
/** 漫剧资产库根目录:outputDir/manga-assets */
|
|
400
|
-
export declare function mangaAssetsDir(outputDir: string): string;
|
|
401
|
-
/** 保存角色定妆图到资产库:manga-assets/角色/角色名/标签.png */
|
|
402
|
-
export declare function saveMangaRoleImage(outputDir: string, roleName: string, label: string, dataUrl: string): string;
|
|
403
|
-
/** 保存角色提示词到资产库:manga-assets/角色/角色名/提示词.txt */
|
|
404
|
-
export declare function saveMangaRolePrompt(outputDir: string, roleName: string, zh: string, en: string, negative?: string): string;
|
|
405
|
-
/** 保存场景底图到资产库:manga-assets/场景/场景名.png */
|
|
406
|
-
export declare function saveMangaSceneImage(outputDir: string, sceneName: string, label: string, dataUrl: string): string;
|
|
407
|
-
/** 保存分镜即梦脚本到资产库:manga-assets/分镜脚本/第N章-标题.md */
|
|
408
|
-
export declare function saveMangaStoryboardScript(outputDir: string, chapterNo: number, title: string, markdown: string): string;
|
|
409
|
-
/** 保存「即梦素材包」到资产库:manga-assets/素材包/第N章-标题·即梦素材包.md */
|
|
410
|
-
export declare function saveMangaAssetPackage(outputDir: string, chapterNo: number, title: string, markdown: string): string;
|
|
411
|
-
/** 保存场景中文生图提示词到资产库:manga-assets/场景/场景名/提示词.txt */
|
|
412
|
-
export declare function saveMangaScenePrompt(outputDir: string, sceneName: string, zh: string, negative?: string): string;
|
|
413
|
-
/** 保存逐镜即梦提示词到资产库:manga-assets/分镜脚本/第N章-标题-提示词.md */
|
|
414
|
-
export declare function saveMangaChapterPrompts(outputDir: string, chapterNo: number, title: string, markdown: string): string;
|
|
415
|
-
export interface AutoGenerateResult {
|
|
416
|
-
chapterNo: number;
|
|
417
|
-
skeletonBeats: number;
|
|
418
|
-
shotCount: number;
|
|
419
|
-
promptCount: number;
|
|
420
|
-
importedRoles: number;
|
|
421
|
-
needMakeupRoles: number;
|
|
422
|
-
extraRoles: number;
|
|
423
|
-
pendingCandidates: number;
|
|
424
|
-
pendingRoleNames: string[];
|
|
425
|
-
}
|
|
426
436
|
/**
|
|
427
|
-
*
|
|
428
|
-
*
|
|
437
|
+
* 按范围导出:整本正文 / 设定 / 规划 / 角色 / 质检记录 / 项目 JSON。
|
|
438
|
+
*
|
|
439
|
+
* @param outputDir 书目录。
|
|
440
|
+
* @param project 项目状态。
|
|
441
|
+
* @param scope 导出范围。
|
|
442
|
+
* @param format txt / md / json(json 只对 `project` 范围有独立含义,其余按 md 落盘)。
|
|
443
|
+
* @returns 文件名、字符数与章节数。
|
|
429
444
|
*/
|
|
430
|
-
export declare function
|
|
445
|
+
export declare function exportScope(outputDir: string, project: ProjectState, scope: ExportScope, format: 'txt' | 'md' | 'json'): {
|
|
446
|
+
file: string;
|
|
447
|
+
chars: number;
|
|
448
|
+
chapters: number;
|
|
449
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute Harness home for this process.
|
|
3
|
+
* @returns the normalized home directory.
|
|
4
|
+
*/
|
|
5
|
+
export declare function dshHome(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Join path segments onto the Harness home.
|
|
8
|
+
* @param segments - path segments appended to the home.
|
|
9
|
+
* @returns the normalized absolute joined path.
|
|
10
|
+
*/
|
|
11
|
+
export declare function dshHomePath(...segments: string[]): string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -8,15 +8,21 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Context } from '@deepseek-ai/cordis';
|
|
10
10
|
import z from 'schemastery';
|
|
11
|
-
import type {
|
|
11
|
+
import type { NovelConfig } from './protocol.ts';
|
|
12
12
|
/** Stable cordis plugin name. */
|
|
13
13
|
export declare const name = "novel-forge";
|
|
14
14
|
/** Services required before the novel-forge surfaces can mount. */
|
|
15
15
|
export declare const inject: string[];
|
|
16
16
|
/**
|
|
17
17
|
* Settings namespace of the novel-forge capability — the section the web
|
|
18
|
-
* settings surface edits.
|
|
19
|
-
*
|
|
18
|
+
* settings surface edits.
|
|
19
|
+
*
|
|
20
|
+
* Legacy fallback only: from Harness 0.2 the Loader derives the section from this
|
|
21
|
+
* plugin's exported `Config`, and addresses it by the **entry id** it assigned in
|
|
22
|
+
* the active profile. That id is not guaranteed to be this name (bundle rows may
|
|
23
|
+
* be given a generated id), so the live id is read from the context instead —
|
|
24
|
+
* see {@link novelSettingsNamespace}. The constant stays for the browser half and
|
|
25
|
+
* for installations whose entry id really is this spelling.
|
|
20
26
|
*/
|
|
21
27
|
export declare const NOVEL_SETTINGS_NAMESPACE: "dsh-novel-forge";
|
|
22
28
|
/** Plugin config, validated by the same-named schemastery schema. */
|
|
@@ -37,8 +43,12 @@ export interface Config {
|
|
|
37
43
|
generateModel?: string;
|
|
38
44
|
/** 任务级模型路由:审稿模型(留空则跟随 model)。 */
|
|
39
45
|
reviewModel?: string;
|
|
40
|
-
/**
|
|
46
|
+
/** 任务级模型路由:质检模型(留空则跟随 model)。 */
|
|
41
47
|
auditModel?: string;
|
|
48
|
+
/** 备用模型:主模型失败时自动切换重试一次(留空 = 不切换)。 */
|
|
49
|
+
fallbackModel?: string;
|
|
50
|
+
/** 出章后自动抽取故事时间线(默认开)。 */
|
|
51
|
+
autoTimeline?: boolean;
|
|
42
52
|
/** LLM reasoning effort (off/low/high/max). */
|
|
43
53
|
reasoningEffort?: 'off' | 'low' | 'high' | 'max';
|
|
44
54
|
/** 分析类任务(提炼/拆书/反推大纲等)的推理档位;默认 low。 */
|
|
@@ -55,14 +65,6 @@ export interface Config {
|
|
|
55
65
|
autoAuthorReview?: boolean;
|
|
56
66
|
/** 修订/润色产出草稿后自动附带一次 AI 审查(默认开,可在设置页关闭省 token)。 */
|
|
57
67
|
autoReviewAfterRevise?: boolean;
|
|
58
|
-
/** 生图模型库(多套并存,启用一条生效)。 */
|
|
59
|
-
imageModels?: ImageModelConfig[];
|
|
60
|
-
/** 豆包/Seedream 生图 API Key(旧字段,兼容迁移用)。 */
|
|
61
|
-
imageApiKey?: string;
|
|
62
|
-
/** 豆包/Seedream 生图模型 ID(旧字段,兼容迁移用)。 */
|
|
63
|
-
imageApiModel?: string;
|
|
64
|
-
/** 是否启用豆包生图(旧字段,兼容迁移用)。 */
|
|
65
|
-
imageApiEnabled?: boolean;
|
|
66
68
|
/** 自定义背景图(URL / dataURL / 服务端路径引用)。 */
|
|
67
69
|
themeBackground?: string;
|
|
68
70
|
/** 自定义背景遮罩/模糊强度 0-80。 */
|
|
@@ -72,9 +74,15 @@ export interface Config {
|
|
|
72
74
|
/** 是否启用改编模式(默认关闭)。 */
|
|
73
75
|
enableAdaptMode?: boolean;
|
|
74
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Plugin config schema.
|
|
79
|
+
*
|
|
80
|
+
* Every field is live-editable (see {@link live}): the plugin re-reads the
|
|
81
|
+
* settings section on every request, so a change must apply without remounting.
|
|
82
|
+
*/
|
|
75
83
|
export declare const Config: z<Config>;
|
|
76
84
|
/** Model-facing announcement: plugin presence, capabilities, and limits. */
|
|
77
|
-
export declare const NOVEL_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-novel-forge \u63D2\u4EF6\uFF08AI \u7F16\u8BD1\u5C0F\u8BF4\u5DE5\u4F5C\u53F0\uFF09\uFF1A\u4FA7\u8FB9\u680F\u300C\u5C0F\u8BF4\u5DE5\u574A\u300D\u5165\u53E3\u3002\u80FD\u529B\uFF1A\u8BFB\u53D6 docx \u5927\u7EB2\
|
|
85
|
+
export declare const NOVEL_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-novel-forge \u63D2\u4EF6\uFF08AI \u7F16\u8BD1\u5C0F\u8BF4\u5DE5\u4F5C\u53F0\uFF09\uFF1A\u4FA7\u8FB9\u680F\u300C\u5C0F\u8BF4\u5DE5\u574A\u300D\u5165\u53E3\u3002\u80FD\u529B\uFF1A\u8BFB\u53D6 docx \u5927\u7EB2\u3001\u7C98\u8D34\u5927\u7EB2\u6587\u672C\u6216\u628A txt \u5168\u672C\u62C6\u7AE0\u5BFC\u5165\uFF1B\u7528 LLM \u63D0\u70BC\u9053\u85CF\uFF08\u4EBA\u8BBE/\u4E16\u754C\u89C2/\u91D1\u624B\u6307\u89C4\u5219/\u5199\u4F5C\u7EA2\u7EBF\uFF09\u4E0E\u5927\u4E16\u754C\uFF08\u5883\u754C/\u533A\u57DF/\u52BF\u529B\uFF09\uFF1B\u751F\u6210\u5377\u8BA1\u5212\u4E0E\u7ED3\u6784\u5316\u7AE0\u8282\u8BA1\u5212\uFF08\u672C\u7AE0\u76EE\u6807/\u5267\u60C5\u8981\u70B9/\u5FC5\u8FBE\u9879/\u4E49\u52A1\u5408\u7EA6/\u7AE0\u672B\u94A9\u5B50\uFF09\uFF1B\u9010\u7AE0\u751F\u6210 3000-4000 \u5B57\u6B63\u6587\u5E76\u4FDD\u5B58\u4E3A Markdown\uFF08\u9ED8\u8BA4\u8F93\u51FA\u5230\u63D2\u4EF6\u8BBE\u7F6E\u91CC\u300C\u8F93\u51FA\u76EE\u5F55\u300D\u6307\u5B9A\u7684\u4F4D\u7F6E\uFF0C\u672A\u914D\u7F6E\u65F6\u843D\u5230 Harness \u6570\u636E\u76EE\u5F55\u4E0B\u7684 novels/\u4E66\u540D\uFF09\uFF1B\u6BCF\u7AE0\u81EA\u52A8\u751F\u6210\u6458\u8981\u4E0E\u7F16\u5E74\u5F55\u4E8B\u5B9E\u3001\u62BD\u53D6\u6545\u4E8B\u65F6\u95F4\u7EBF\uFF08\u6545\u4E8B\u5185\u65F6\u95F4/\u5730\u70B9/\u5728\u573A\u89D2\u8272/\u4E8B\u4EF6\uFF09\u3001\u81EA\u52A8 AI \u5BA1\u7A3F\uFF08\u4EBA\u8BBE/\u8BBE\u5B9A/\u7EA2\u7EBF/\u6587\u7B14/\u723D\u70B9/\u903B\u8F91/\u53CD AI/\u5448\u73B0/\u5408\u89C4\u4E5D\u7EF4\uFF09\u4E0E\u4F5C\u8005\u590D\u76D8\uFF1B\u652F\u6301\u6309\u5BA1\u7A3F\u610F\u89C1\u5408\u5E76\u4FEE\u8BA2\uFF08\u5BA1\u7A3F high + \u65F6\u95F4\u7EBF\u77DB\u76FE + \u5F20\u529B\u504F\u5DEE\u5408\u6210\u4E00\u8F6E\uFF0C\u6BCF\u7AE0\u6700\u591A\u4E24\u8F6E\u540E\u8F6C\u4EBA\u5DE5\uFF09\u3001\u53BB AI \u5473\u6DA6\u8272\u3001\u7AE0\u8282\u5386\u53F2\u7248\u672C\u56DE\u6EDA\u3001\u6697\u7EBF\uFF08\u4F0F\u7B14\uFF09\u7BA1\u7406\u3001\u5267\u60C5\u7EBF\u4E0E\u89D2\u8272\u5E93\u3001\u5F20\u529B\u66F2\u7EBF\u3001\u5168\u4E66\u4E00\u81F4\u6027\u8D28\u68C0\u4E0E\u654F\u611F\u8BCD\u626B\u63CF\u3001\u5206\u8303\u56F4\u5BFC\u51FA\u4E0E\u9879\u76EE\u5907\u4EFD\u3001\u6279\u91CF\u8FDE\u5199\uFF08\u751F\u4EA7\u5355\uFF0C\u53EF\u6682\u505C/\u7EED\u8DD1\uFF09\u3002\u9650\u5236\uFF1A\u6240\u6709 AI \u64CD\u4F5C\u6D88\u8017 LLM API \u989D\u5EA6\uFF1B\u8F93\u51FA\u76EE\u5F55\u4E0E\u6A21\u578B\u53EF\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u4FEE\u6539\uFF1B\u7AE0\u8282\u6B63\u6587\u8D28\u91CF\u53D6\u51B3\u4E8E\u5927\u7EB2\u5B8C\u6574\u5EA6\uFF1B\u5F20\u529B/\u65F6\u95F4\u7EBF\u95EE\u9898\u9ED8\u8BA4\u53EA\u662F\u5EFA\u8BAE\uFF08\u5199\u65E5\u5FD7\u4E0E\u5F85\u529E\uFF09\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6539\u6B63\u6587\u3002\u7528\u6237\u63D0\u5230\u300C\u5C0F\u8BF4 / \u5927\u7EB2 / \u5199\u5C0F\u8BF4 / \u7AE0\u8282 / \u5BA1\u7A3F / \u6DA6\u8272\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
|
|
78
86
|
/** Resolve a config-like value into the full runtime config. */
|
|
79
87
|
export declare function resolveConfig(value: Partial<Config> | undefined): NovelConfig;
|
|
80
88
|
/**
|