@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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动作失败分级(fail-stop 规则)——不依赖 LLM/宿主服务的纯逻辑模块,可离线单测。
|
|
3
|
+
*
|
|
4
|
+
* 规则来源(借鉴同类 DSH 小说插件的规则设计):
|
|
5
|
+
* - 参数/契约类失败**不得重复同一调用**,解释一次即停;
|
|
6
|
+
* - 瞬时故障允许有限重试,同样禁止无限重试。
|
|
7
|
+
* 规则必须可测试,否则只是文档。
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 动作失败分级:
|
|
11
|
+
* - `contract` 参数/契约类(参数缺失、片段未找到、章节不存在、非法取值…):
|
|
12
|
+
* 同一调用只允许修正一次,禁止原样重复。
|
|
13
|
+
* - `transient` 瞬时故障(网络、模型中断、磁盘临时不可用…):允许重试一次。
|
|
14
|
+
*/
|
|
15
|
+
export type ActionErrorKind = 'contract' | 'transient';
|
|
16
|
+
/** 带分级的动作失败(executeAction 抛出,供 fail-stop 判定)。 */
|
|
17
|
+
export declare class NovelActionError extends Error {
|
|
18
|
+
readonly kind: ActionErrorKind;
|
|
19
|
+
constructor(kind: ActionErrorKind, message: string);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 判定一次动作失败的类别。
|
|
23
|
+
*
|
|
24
|
+
* @param error 捕获到的异常。
|
|
25
|
+
* @returns `contract`(参数/契约,不重试原样调用)或 `transient`(瞬时,可重试一次)。
|
|
26
|
+
*/
|
|
27
|
+
export declare function classifyActionError(error: unknown): ActionErrorKind;
|
|
28
|
+
/**
|
|
29
|
+
* 同一调用签名允许的总尝试次数(含首次)。
|
|
30
|
+
*
|
|
31
|
+
* @param kind 失败类别。
|
|
32
|
+
* @returns `contract` = 1(禁止原样重复),`transient` = 2(允许一次重试)。
|
|
33
|
+
*/
|
|
34
|
+
export declare function actionRetryLimit(kind: ActionErrorKind): number;
|
|
35
|
+
/**
|
|
36
|
+
* 把动作参数规范化为稳定签名(键排序),用于识别「同一个调用」。
|
|
37
|
+
*
|
|
38
|
+
* @param args 动作参数。
|
|
39
|
+
* @returns 稳定字符串签名。
|
|
40
|
+
*/
|
|
41
|
+
export declare function safeArgsKey(args: Record<string, unknown> | undefined): string;
|
|
42
|
+
/**
|
|
43
|
+
* 已失败调用记账:同一签名达到重试上限即 fail-stop。
|
|
44
|
+
*/
|
|
45
|
+
export declare class FailureLedger {
|
|
46
|
+
private readonly counts;
|
|
47
|
+
/**
|
|
48
|
+
* 记录一次失败并判断是否应当停止本轮。
|
|
49
|
+
*
|
|
50
|
+
* @param tool 工具名。
|
|
51
|
+
* @param args 该次调用参数。
|
|
52
|
+
* @param kind 失败类别。
|
|
53
|
+
* @returns `attempts` 本次是第几次失败;`stop` 是否达到上限(true = 立即停止,不再喂回模型)。
|
|
54
|
+
*/
|
|
55
|
+
record(tool: string, args: Record<string, unknown> | undefined, kind: ActionErrorKind): {
|
|
56
|
+
attempts: number;
|
|
57
|
+
stop: boolean;
|
|
58
|
+
};
|
|
59
|
+
/** 已登记的失败签名数量(测试/诊断用)。 */
|
|
60
|
+
get size(): number;
|
|
61
|
+
}
|
package/lib/types/ai-scan.d.ts
CHANGED
|
@@ -28,9 +28,3 @@ export interface AiScanResult {
|
|
|
28
28
|
summary: string;
|
|
29
29
|
}
|
|
30
30
|
export declare function scanAiFlavor(text: string): AiScanResult;
|
|
31
|
-
/** 扫描前后对比(润色时用) */
|
|
32
|
-
export declare function compareAiScan(before: AiScanResult, after: AiScanResult): {
|
|
33
|
-
improved: boolean;
|
|
34
|
-
deltaScore: number;
|
|
35
|
-
details: string[];
|
|
36
|
-
};
|
package/lib/types/assets.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Writing assets — 题材基底库 / 推进模式库 / 反 AI 规则 / 写法引擎.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - 8
|
|
6
|
-
* - 12
|
|
7
|
-
* -
|
|
4
|
+
* 内置种子数据(本项目自研表述;结构参考了同类工具的功能划分):
|
|
5
|
+
* - 8 套预置叙事风格模板
|
|
6
|
+
* - 12 条带命中模式的反 AI 规则
|
|
7
|
+
* - 题材树 + 推进模式种子
|
|
8
8
|
* Assets persist with the project (novel-project.json) and are injected into
|
|
9
9
|
* generation / planning / review prompts, and available to the AI assistant.
|
|
10
10
|
*/
|
|
11
11
|
import type { AntiAiRule, GenreNode, PlotBeatTemplate, ProgressionMode, ProjectAssets, StarterStyleProfile, StyleAsset, StyleTemplate } from './protocol.ts';
|
|
12
|
-
/**
|
|
12
|
+
/** 预置叙事风格模板(8 套,一键绑定无需样本文本)。 */
|
|
13
13
|
export declare const BUILTIN_STYLE_TEMPLATES: StyleTemplate[];
|
|
14
|
-
/** 内置全局反 AI
|
|
14
|
+
/** 内置全局反 AI 规则(12 条,随插件发布;项目可叠加自定义规则)。 */
|
|
15
15
|
export declare const BUILTIN_ANTI_AI_RULES: AntiAiRule[];
|
|
16
16
|
/** 内置题材基底库(常用网文题材树,跨书复用)。 */
|
|
17
17
|
export declare const BUILTIN_GENRE_LIBRARY: GenreNode[];
|
|
@@ -23,8 +23,6 @@ export declare const BUILTIN_PLOT_BEATS: PlotBeatTemplate[];
|
|
|
23
23
|
export declare function emptyProjectAssets(): ProjectAssets;
|
|
24
24
|
/** 合并项目资产与内置库:返回「生效的反 AI 规则」(内置全局 + 项目自定义)。 */
|
|
25
25
|
export declare function effectiveAntiAiRules(assets: ProjectAssets | undefined): AntiAiRule[];
|
|
26
|
-
/** 安定 key:内置规则全局基线(globalBaselineEnabled)在新书/旧书一律生效。 */
|
|
27
|
-
export declare function ensureGlobalBaseline(assets: ProjectAssets | undefined): ProjectAssets;
|
|
28
26
|
/** 内置库种子化 upsert(对齐上游 SystemResourceBootstrapService 精神)。
|
|
29
27
|
* missing_only 仅补齐缺失的全局基线规则;sync_existing 还会按 key 刷新已内置规则的结构化字段。 */
|
|
30
28
|
export declare function ensureBuiltinAssets(assets: ProjectAssets | undefined, mode?: 'missing_only' | 'sync_existing'): ProjectAssets;
|
|
@@ -38,7 +36,7 @@ export declare function renderStyleAssets(assets: ProjectAssets | undefined): st
|
|
|
38
36
|
export declare function renderAllAssets(assets: ProjectAssets | undefined): string;
|
|
39
37
|
/** 预置写法模板 → 可直接绑定的 StyleAsset。 */
|
|
40
38
|
export declare function styleTemplateToAsset(template: StyleTemplate): StyleAsset;
|
|
41
|
-
/**
|
|
39
|
+
/** 起始风格画像库:无样本文本也能快速绑定一套写法(4 档起步写法)。 */
|
|
42
40
|
export declare const BUILTIN_STARTER_STYLE_PROFILES: StarterStyleProfile[];
|
|
43
41
|
/** 起始风格画像 → 可直接绑定的 StyleAsset(绑定对应模板,名称用画像名)。 */
|
|
44
42
|
export declare function starterProfileToAsset(profile: StarterStyleProfile): StyleAsset | null;
|
package/lib/types/assistant.d.ts
CHANGED
|
@@ -15,8 +15,33 @@
|
|
|
15
15
|
import type { Context } from '@deepseek-ai/cordis';
|
|
16
16
|
import type { AssistantMessage, NovelConfig, ProjectState } from './protocol.ts';
|
|
17
17
|
import { chapterFileName } from './engine.ts';
|
|
18
|
+
import { type BookStage } from './stage-contract.ts';
|
|
18
19
|
/** History file name inside the output dir. */
|
|
19
20
|
export declare const ASSISTANT_HISTORY_FILE = "novel-assistant.jsonl";
|
|
21
|
+
/**
|
|
22
|
+
* 按阶段渲染动作说明书。
|
|
23
|
+
*
|
|
24
|
+
* - `strict=false`(作者点明了要做什么):全量说明书照给,只靠动作可见性段提示
|
|
25
|
+
* 哪些属于阶段外——作者有权指定任意动作。
|
|
26
|
+
* - `strict=true`(作者只说「继续/下一步」):阶段外的写操作说明书直接**从提示词里移除**,
|
|
27
|
+
* 和执行层的阶段白名单完全一致,模型不再有机会去试错撞守卫。
|
|
28
|
+
*
|
|
29
|
+
* @param docs 动作说明书行。
|
|
30
|
+
* @param stage 阶段契约。
|
|
31
|
+
* @param strict 是否为「阶段即唯一命令」模式。
|
|
32
|
+
* @returns 裁剪后的说明书行。
|
|
33
|
+
*/
|
|
34
|
+
export declare function renderToolDocs(docs: readonly string[], stage: BookStage, strict: boolean): string[];
|
|
35
|
+
/**
|
|
36
|
+
* 渲染「动作可见性」:把写操作分成「本阶段可用」与「阶段外(仅作者点名时执行)」,
|
|
37
|
+
* 让模型不必靠试错去发现哪些动作会被拒绝。
|
|
38
|
+
*
|
|
39
|
+
* @param stage 阶段契约。
|
|
40
|
+
* @returns 多行文本。
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderActionVisibility(stage: BookStage): string;
|
|
43
|
+
export { classifyActionError, actionRetryLimit, safeArgsKey, NovelActionError, FailureLedger } from './action-guard.ts';
|
|
44
|
+
export type { ActionErrorKind } from './action-guard.ts';
|
|
20
45
|
/** Load the persisted conversation (empty when none). */
|
|
21
46
|
export declare function loadAssistantHistory(outputDir: string): AssistantMessage[];
|
|
22
47
|
/** 清空助手对话记录(删除历史文件)。 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 作者资产库/总数据(跨书)— 按作者维度聚合的可复用资产。
|
|
3
|
-
* 与书架同惯例持久化到
|
|
3
|
+
* 与书架同惯例持久化到 <DSH_HOME>/dsh-novel-forge-author-assets.json。
|
|
4
4
|
* 提供读取/持久化/新增或更新/删除,以及「导入默认」:把书架书的写作资产/角色 +
|
|
5
5
|
* 内置全局库(题材/反AI规则/风格模板/推进模式)批量沉淀成资产条目(默认库)。
|
|
6
6
|
*/
|
|
@@ -11,8 +11,6 @@ export declare function authorAssetsFile(): string;
|
|
|
11
11
|
export declare function loadAuthorAssets(): AuthorAssetLibrary;
|
|
12
12
|
/** 持久化作者资产库。 */
|
|
13
13
|
export declare function saveAuthorAssets(library: AuthorAssetLibrary): void;
|
|
14
|
-
/** 新建一条资产(自动生成 id 与时间戳)。 */
|
|
15
|
-
export declare function createAuthorAsset(input: Omit<AuthorStyleAsset, 'id' | 'createdAt' | 'updatedAt'>): AuthorStyleAsset;
|
|
16
14
|
/** 按 id 更新一条资产;不存在则追加。 */
|
|
17
15
|
export declare function upsertAuthorAsset(input: AuthorStyleAsset): AuthorAssetLibrary;
|
|
18
16
|
/** 删除一条资产;返回更新后的资产库。 */
|
package/lib/types/bookshelf.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 书架(Bookshelf)— 多书管理:一本书记录一个独立输出目录。
|
|
3
|
-
* 状态持久化到
|
|
3
|
+
* 状态持久化到 <DSH_HOME>/dsh-novel-forge-bookshelf.json(跟随 dsh 配置惯例)。
|
|
4
4
|
*/
|
|
5
5
|
import type { BookEntry, BookshelfSnapshot } from './protocol.ts';
|
|
6
6
|
/** 书架配置文件路径。 */
|
|
@@ -37,6 +37,16 @@ export declare function activateBook(id: string): BookEntry | undefined;
|
|
|
37
37
|
export declare function removeBook(id: string): boolean;
|
|
38
38
|
/** 当前书输出目录(无书架则 undefined,回退 settings)。 */
|
|
39
39
|
export declare function activeBookOutputDir(): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* 书目录重指向:把 outputDir 等于 from 的书条目全部改为 to(目录迁移联动)。
|
|
42
|
+
* @returns 重指向的条目数。
|
|
43
|
+
*/
|
|
44
|
+
export declare function repointBookDirs(from: string, to: string): number;
|
|
45
|
+
/**
|
|
46
|
+
* 新书默认输出目录:`<配置的输出目录>/书名`;未配置时回退 `<DSH_HOME>/novels/书名`。
|
|
47
|
+
* @param bookName - 书名(剔除文件系统非法字符并截断到 40 字)。
|
|
48
|
+
* @param baseDir - settings 里配置的输出目录(未经激活书合并的原始值)。
|
|
49
|
+
* @returns 该书应写入的绝对目录。
|
|
50
|
+
*/
|
|
51
|
+
export declare function defaultOutputDirFor(bookName: string, baseDir?: string): string;
|
|
42
52
|
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* fetch, same origin; generation/rewrite/polish ride NDJSON streams read
|
|
4
4
|
* incrementally.
|
|
5
5
|
*/
|
|
6
|
-
import { type AssetsPatch, type AssetsResponse, type AddModelRequest, type AddModelResponse, type LlmModelsResponse, type LlmProvidersResponse, type LlmVendorsResponse, type RemoveProviderRequest, type RemoveProviderResponse, type BibleResponse, type ChapterResponse, type ConfigPatch, type ExportResponse, type ForeshadowRequest, type ForeshadowResponse, type JobFrame, type LoadOutlineResponse, type AdaptExecuteRequest, type AdaptRewriteFrame, type AdaptMaterializeSaveRequest, type AdaptMaterializeSaveResponse, type PluginUpdateResponse, type LlmTestResponse, type NovelConfig, type PlanResponse, type ReviewReport, type StatusResponse, type StyleEngineRequest, type StyleAsset, type VolumesResponse } from '../protocol.ts';
|
|
6
|
+
import { type AssetsPatch, type AssetsResponse, type AddModelRequest, type AddModelResponse, type LlmModelsResponse, type LlmProvidersResponse, type LlmVendorsResponse, type RemoveProviderRequest, type RemoveProviderResponse, type BibleResponse, type ChapterResponse, type ConfigPatch, type ExportResponse, type ForeshadowRequest, type ForeshadowResponse, type JobFrame, type LoadOutlineResponse, type AdaptExecuteRequest, type AdaptRewriteFrame, type AdaptMaterializeSaveRequest, type AdaptMaterializeSaveResponse, type PluginUpdateResponse, type LlmTestResponse, type NovelConfig, type PlanResponse, type ReviewReport, type RevisionPlanResponse, type StatusResponse, type StyleEngineRequest, type StyleAsset, type VolumesResponse } from '../protocol.ts';
|
|
7
7
|
/** Error carrying the route's JSON error message. */
|
|
8
8
|
export declare class NovelApiError extends Error {
|
|
9
9
|
constructor(message: string);
|
|
@@ -19,14 +19,6 @@ export declare class NovelApi {
|
|
|
19
19
|
}>;
|
|
20
20
|
/** 反推大纲:从已写章节正文反向生成全书总纲(NDJSON 流)。 */
|
|
21
21
|
outlineReverse(onFrame: (frame: JobFrame) => void): Promise<void>;
|
|
22
|
-
/** 分镜·导演级:骨架 → 分镜表(镜头级)。 */
|
|
23
|
-
storyboardTable(chapterNo: number, skeleton: import('../protocol.ts').StoryboardSkeleton, styleId?: string, filterId?: string): Promise<import('../protocol.ts').StoryboardTableResponse>;
|
|
24
|
-
/** 漫剧方案管理:create / remove / activate。 */
|
|
25
|
-
manhuaPlans(req: import('../protocol.ts').MangaPlansRequest): Promise<import('../protocol.ts').MangaPlansResponse>;
|
|
26
|
-
/** 分镜·提示词级:分镜表 → 即梦可粘贴视频提示词。 */
|
|
27
|
-
storyboardPrompts(chapterNo: number, table: import('../protocol.ts').StoryboardTable, styleId?: string, filterId?: string): Promise<import('../protocol.ts').StoryboardPromptsResponse>;
|
|
28
|
-
/** 分镜·编剧级:单章 → 剧情骨架(节拍链)。 */
|
|
29
|
-
storyboardSkeleton(chapterNo: number): Promise<import('../protocol.ts').StoryboardSkeletonResponse>;
|
|
30
22
|
/** 开书想法 → AI 大纲:生成 count 个方案(换批时传 exclude 避开已暂留方向)。 */
|
|
31
23
|
outlineSuggest(idea: string, count?: number, exclude?: string[]): Promise<import('../protocol.ts').OutlineSuggestResponse>;
|
|
32
24
|
/** 拆书分析:对已写章节做结构/人物/文风/卖点体检。 */
|
|
@@ -41,17 +33,30 @@ export declare class NovelApi {
|
|
|
41
33
|
summary: string;
|
|
42
34
|
}>;
|
|
43
35
|
foreshadow(req: ForeshadowRequest): Promise<ForeshadowResponse>;
|
|
44
|
-
exportBook(format: 'txt' | 'md'): Promise<ExportResponse>;
|
|
36
|
+
exportBook(format: 'txt' | 'md' | 'json', scope?: import('../protocol.ts').ExportScope): Promise<ExportResponse>;
|
|
45
37
|
chapter(no: number): Promise<ChapterResponse>;
|
|
46
38
|
/** 审查手动编辑的正文(不落盘)。previousReport 传入时走「验证模式」(核对原意见解决 + 只挑新增 high)。 */
|
|
47
39
|
chapterCheck(no: number, text: string, previousReport?: ReviewReport): Promise<{
|
|
48
40
|
report: ReviewReport;
|
|
49
41
|
}>;
|
|
42
|
+
/**
|
|
43
|
+
* 修订指令合并:把本章的审稿意见(勾选项)+ 时间线矛盾 + 张力偏差合成**一份**指令。
|
|
44
|
+
* 面板所有「按意见修订 / 一键按建议修订」入口都先走这里,保证同一章只改一轮。
|
|
45
|
+
*/
|
|
46
|
+
revisionPlan(no: number, reviewIssues?: ReviewReport['issues'], opts?: {
|
|
47
|
+
includeTimeline?: boolean;
|
|
48
|
+
includeTension?: boolean;
|
|
49
|
+
}): Promise<RevisionPlanResponse>;
|
|
50
50
|
/** 保存手动编辑的正文(自动备份 .bak;带报告则沿用落盘,否则保存后自动审稿)。 */
|
|
51
51
|
chapterSave(no: number, text: string, report?: ReviewReport): Promise<import('../protocol.ts').ChapterSaveResponse>;
|
|
52
52
|
patchConfig(patch: ConfigPatch): Promise<{
|
|
53
53
|
config: NovelConfig;
|
|
54
|
+
settingsWarning?: string;
|
|
54
55
|
}>;
|
|
56
|
+
/** 输出目录迁移:dryRun=true 仅预览目录内容;确认时传 to 搬迁。 */
|
|
57
|
+
moveOutputDir(to?: string, dryRun?: boolean): Promise<import('../protocol.ts').MoveOutputDirResponse>;
|
|
58
|
+
/** 本书参数:不带 patch 读取;带 patch 合并保存(字段传 null = 回退全局)。 */
|
|
59
|
+
bookSettings(patch?: Record<string, unknown>): Promise<import('../protocol.ts').BookSettingsResponse>;
|
|
55
60
|
openFolder(): Promise<void>;
|
|
56
61
|
/** 插件自更新:在 DSH profile 目录拉取最新 npm 版(需重启 DSH 生效)。 */
|
|
57
62
|
pluginUpdate(): Promise<PluginUpdateResponse>;
|
|
@@ -122,11 +127,11 @@ export declare class NovelApi {
|
|
|
122
127
|
}): Promise<{
|
|
123
128
|
result: import('../protocol.ts').IdeaInspirationResult;
|
|
124
129
|
}>;
|
|
125
|
-
/**
|
|
130
|
+
/** 自动编辑编排建议:基于全书上下文。 */
|
|
126
131
|
director(focus?: string): Promise<{
|
|
127
132
|
result: import('../protocol.ts').DirectorAdvice;
|
|
128
133
|
}>;
|
|
129
|
-
/**
|
|
134
|
+
/** 自动编辑「采纳」出的书内待办:读取。 */
|
|
130
135
|
directorTodosList(): Promise<{
|
|
131
136
|
todos: import('../protocol.ts').DirectorTodo[];
|
|
132
137
|
}>;
|
|
@@ -188,8 +193,6 @@ export declare class NovelApi {
|
|
|
188
193
|
ok: boolean;
|
|
189
194
|
no: number;
|
|
190
195
|
}>;
|
|
191
|
-
/** 角色库:AI 提炼 / 采纳 / 更新 / 删除。 */
|
|
192
|
-
imageTest(req: import('../protocol.ts').ImageTestRequest): Promise<import('../protocol.ts').ImageTestResponse>;
|
|
193
196
|
/** 对选中的提供商/模型发一次最小真实调用,验证连通性。 */
|
|
194
197
|
llmTest(provider: string, model: string): Promise<LlmTestResponse>;
|
|
195
198
|
/** 添加模型:厂商直填 key,或自定义 OpenAI 兼容路由(写 DSH 凭据 + 注册路由)。 */
|
|
@@ -203,20 +206,7 @@ export declare class NovelApi {
|
|
|
203
206
|
/** 移除一个提供方(unset key + 移除 llm-pi-ai 路由)。 */
|
|
204
207
|
removeProvider(req: RemoveProviderRequest): Promise<RemoveProviderResponse>;
|
|
205
208
|
roles(req: import('../protocol.ts').RolesRequest): Promise<import('../protocol.ts').RolesResponse>;
|
|
206
|
-
/**
|
|
207
|
-
mangaRoles(req: import('../protocol.ts').MangaRolesRequest): Promise<import('../protocol.ts').MangaRolesResponse>;
|
|
208
|
-
/** 导出「即梦素材包」落盘到资产库 manga-assets/素材包/。 */
|
|
209
|
-
exportPackage(chapterNo: number, title: string, markdown: string): Promise<{
|
|
210
|
-
ok: boolean;
|
|
211
|
-
file: string;
|
|
212
|
-
}>;
|
|
213
|
-
/** 场景库:AI 提炼 / 采纳 / 更新 / 删除 / 图集。 */
|
|
214
|
-
scenes(req: import('../protocol.ts').ScenesRequest): Promise<import('../protocol.ts').ScenesResponse>;
|
|
215
|
-
/** 视觉世界观规则:提炼 / 保存。 */
|
|
216
|
-
visualRules(req: import('../protocol.ts').VisualRulesRequest): Promise<import('../protocol.ts').VisualRulesResponse>;
|
|
217
|
-
/** 道具库:从已写章节提炼常驻道具 / 保存清单。 */
|
|
218
|
-
mangaProps(req: import('../protocol.ts').MangaPropsRequest): Promise<import('../protocol.ts').MangaPropsResponse>;
|
|
219
|
-
/** 小说简介:AI 生成/补全(partial 留空 = 全量),或手动保存。 */
|
|
209
|
+
/** 小说简介:生成/补全(partial 留空 = 全量),或手动保存。 */
|
|
220
210
|
blurb(action: 'generate' | 'save', text?: string, partial?: string): Promise<{
|
|
221
211
|
blurb: string;
|
|
222
212
|
}>;
|
|
@@ -231,7 +221,7 @@ export declare class NovelApi {
|
|
|
231
221
|
rename(bookName: string): Promise<{
|
|
232
222
|
bookName: string;
|
|
233
223
|
}>;
|
|
234
|
-
/**
|
|
224
|
+
/** 大世界:提炼(generate)或手动保存(save)。 */
|
|
235
225
|
world(action: 'generate' | 'save', world?: import('../protocol.ts').WorldState): Promise<{
|
|
236
226
|
world: import('../protocol.ts').WorldState;
|
|
237
227
|
}>;
|
|
@@ -288,6 +278,36 @@ export declare class NovelApi {
|
|
|
288
278
|
}>;
|
|
289
279
|
/** Run one assistant turn (NDJSON stream). */
|
|
290
280
|
assistant(message: string, onFrame: (frame: import('../protocol.ts').AssistantFrame) => void): Promise<void>;
|
|
281
|
+
/** 张力曲线:数据 + 规则核对。 */
|
|
282
|
+
tension(): Promise<import('../protocol.ts').TensionResponse>;
|
|
283
|
+
/** 设置张力曲线预设。 */
|
|
284
|
+
tensionPreset(preset: import('../protocol.ts').TensionCurvePreset): Promise<void>;
|
|
285
|
+
/** 设置/清除某一章的目标张力。 */
|
|
286
|
+
tensionSet(chapterNo: number, tension?: number): Promise<void>;
|
|
287
|
+
/** 提示词槽位:列表。 */
|
|
288
|
+
promptSlots(): Promise<import('../protocol.ts').PromptSlotsResponse>;
|
|
289
|
+
/** 写入一个提示词槽位(空串 = 清空)。 */
|
|
290
|
+
promptSlotSet(id: import('../protocol.ts').PromptSlotId, value: string): Promise<void>;
|
|
291
|
+
/** 故事时间线:列表(含规则初筛问题)。 */
|
|
292
|
+
timeline(): Promise<import('../protocol.ts').TimelineResponse>;
|
|
293
|
+
/** 抽取某一章的时间线事件。 */
|
|
294
|
+
timelineExtract(chapterNo: number): Promise<{
|
|
295
|
+
events: import('../protocol.ts').TimelineEvent[];
|
|
296
|
+
}>;
|
|
297
|
+
/** 检查时间线矛盾(规则初筛 + AI 复核)。 */
|
|
298
|
+
timelineCheck(): Promise<import('../protocol.ts').TimelineResponse>;
|
|
299
|
+
/** 手工修正一条时间线事件。 */
|
|
300
|
+
timelineUpdate(event: import('../protocol.ts').TimelineEvent): Promise<void>;
|
|
301
|
+
/** 删除一条时间线事件。 */
|
|
302
|
+
timelineRemove(id: string): Promise<void>;
|
|
303
|
+
/** 章节历史版本列表。 */
|
|
304
|
+
snapshots(): Promise<import('../protocol.ts').SnapshotResponse>;
|
|
305
|
+
/** 回滚到某个历史版本。 */
|
|
306
|
+
snapshotRestore(id: string): Promise<void>;
|
|
307
|
+
/** 给某章手工存档。 */
|
|
308
|
+
snapshotCreate(chapterNo: number): Promise<void>;
|
|
309
|
+
/** 删除一个历史版本。 */
|
|
310
|
+
snapshotRemove(id: string): Promise<void>;
|
|
291
311
|
/** Load the persisted assistant conversation. */
|
|
292
312
|
assistantHistory(): Promise<import('../protocol.ts').AssistantMessage[]>;
|
|
293
313
|
/** 清空助手对话记录。 */
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 右上角「小说工坊生成状态」芯片的显示偏好(纯客户端、localStorage)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么是 localStorage 而不是插件配置:这是纯界面 chrome,与显示模式 / 界面密度 /
|
|
5
|
+
* 编辑器字号 / 芯片自身的位置记忆同类;哪个浏览器想清屏就哪个浏览器清,不需要跨端同步。
|
|
6
|
+
* 将来若要跨端,把键名沿用成 config 字段 `showRunChip` 即可平滑升级。
|
|
7
|
+
*
|
|
8
|
+
* 三态:
|
|
9
|
+
* off 关闭(同时停止 4 秒轮询,不白跑)
|
|
10
|
+
* active 只在生产单**运行中或已暂停**时显示(不想错过生成,也不想留残影)
|
|
11
|
+
* always 只要该目录有生产单状态就显示(默认,保持历史行为)
|
|
12
|
+
*/
|
|
13
|
+
import type { RunState } from '../protocol.ts';
|
|
14
|
+
export type RunChipMode = 'off' | 'active' | 'always';
|
|
15
|
+
/** localStorage 键(与芯片位置记忆同一命名空间)。 */
|
|
16
|
+
export declare const RUN_CHIP_MODE_KEY = "dsh-novel-forge.runChip.mode";
|
|
17
|
+
/** 同页变更通知用的自定义事件名(跨标签页走原生 storage 事件)。 */
|
|
18
|
+
export declare const RUN_CHIP_MODE_EVENT = "dsh-novel-forge:runchip-mode";
|
|
19
|
+
/** 默认值与历史行为一致:有生产单状态就显示。 */
|
|
20
|
+
export declare const DEFAULT_RUN_CHIP_MODE: RunChipMode;
|
|
21
|
+
/** 设置页下拉用的三态选项(顺序即用户看到的顺序)。 */
|
|
22
|
+
export declare const RUN_CHIP_MODE_OPTIONS: ReadonlyArray<{
|
|
23
|
+
value: RunChipMode;
|
|
24
|
+
label: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** 读取偏好(缺失 / 非法 / 存储不可用 → 默认值)。 */
|
|
27
|
+
export declare function readRunChipMode(): RunChipMode;
|
|
28
|
+
/** 写入偏好并通知所有监听者;存储不可用时仍通知(本次会话内生效)。 */
|
|
29
|
+
export declare function writeRunChipMode(mode: RunChipMode): void;
|
|
30
|
+
/** 订阅偏好变化(同页 + 跨标签页 storage);返回退订函数。 */
|
|
31
|
+
export declare function subscribeRunChipMode(listener: (mode: RunChipMode) => void): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* 给定偏好与当前生产单状态,判断芯片是否应可见。
|
|
34
|
+
* null(没有生产单状态)永远不显示——这是渲染层与测试共用的唯一判据。
|
|
35
|
+
*/
|
|
36
|
+
export declare function isRunChipVisible(mode: RunChipMode, state: RunState | null | undefined): boolean;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* the Node build (esm/index.mjs), which calls module.createRequire() for the
|
|
9
9
|
* optional worker_threads path — inlining that into the browser bundle leaves
|
|
10
10
|
* a bare require("module") the client-modules table cannot answer.
|
|
11
|
+
*
|
|
12
|
+
* XML 解析共享核心在 ../docx-core.ts(与服务端同源)。
|
|
11
13
|
*/
|
|
12
14
|
/** Extract plain text from a docx buffer: one line per <w:p> paragraph. */
|
|
13
15
|
export declare function extractDocxTextFromBuffer(buffer: ArrayBuffer | Uint8Array): string;
|
|
14
|
-
/** Read a File as ArrayBuffer. */
|
|
15
|
-
export declare function readFileAsArrayBuffer(file: File): Promise<ArrayBuffer>;
|
|
@@ -2,20 +2,8 @@
|
|
|
2
2
|
* 浏览器端「AI 创作实况」钩子:连接 /llm-live/stream (SSE),按 LLM 调用分组会话。
|
|
3
3
|
* 轻量实现,不持久化缓存(对齐上游 useLlmLiveFeed 的核心行为)。
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
sessionId: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
model?: string;
|
|
10
|
-
at: string;
|
|
11
|
-
content?: string;
|
|
12
|
-
totalChars?: number;
|
|
13
|
-
totalReasoningChars?: number;
|
|
14
|
-
phase?: 'requesting' | 'streaming' | 'completed' | 'failed';
|
|
15
|
-
phaseMessage?: string;
|
|
16
|
-
preview?: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
}
|
|
5
|
+
import { type LlmLiveFrame, type LlmTokenUsage } from '../protocol.ts';
|
|
6
|
+
export type { LlmLiveFrame };
|
|
19
7
|
export interface LlmLiveSession {
|
|
20
8
|
sessionId: string;
|
|
21
9
|
label: string;
|
|
@@ -26,6 +14,16 @@ export interface LlmLiveSession {
|
|
|
26
14
|
totalChars: number;
|
|
27
15
|
startedAt: string;
|
|
28
16
|
updatedAt: string;
|
|
17
|
+
/** 本次调用的 token 用量(供应商未上报时缺省)。 */
|
|
18
|
+
usage?: LlmTokenUsage;
|
|
19
|
+
/** 本次调用耗时(毫秒)。 */
|
|
20
|
+
elapsedMs?: number;
|
|
21
|
+
/** 首字耗时(毫秒)。 */
|
|
22
|
+
firstTokenMs?: number;
|
|
23
|
+
/** 是否保存了可查看的 Prompt。 */
|
|
24
|
+
hasPrompt?: boolean;
|
|
25
|
+
/** Prompt 字符数(system + user)。 */
|
|
26
|
+
promptChars?: number;
|
|
29
27
|
}
|
|
30
28
|
export declare function useLlmLiveFeed(enabled?: boolean): {
|
|
31
29
|
connected: boolean;
|
|
@@ -1,57 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-novel-forge —
|
|
2
|
+
* dsh-novel-forge — 面板文案词典(简体中文单语)。
|
|
3
|
+
*
|
|
4
|
+
* 定位说明:小说工坊面板是**中文单语界面**——这里就是全部用户可见文案的唯一定义处,
|
|
5
|
+
* 键位即类型(`NovelKey`),新增文案请同时在此登记,不要散落到组件里硬编码。
|
|
6
|
+
* 文档层(README / docs / CHANGELOG)仍提供英文对照,那是给人读的,不是界面语言。
|
|
3
7
|
*/
|
|
4
|
-
/**
|
|
8
|
+
/** 面板文案(简体中文)。 */
|
|
5
9
|
export declare const zh: {
|
|
6
10
|
readonly 'entry.label': "小说工坊";
|
|
7
11
|
readonly 'entry.tooltip': "AI 编译小说工作台:总纲 → 道藏 → 卷计划 → 章节计划 → 逐章生成+审稿";
|
|
8
|
-
readonly 'panel.title': "小说工坊";
|
|
9
12
|
readonly 'common.close': "关闭";
|
|
10
13
|
readonly 'common.loading': "加载中…";
|
|
11
|
-
readonly 'common.save': "保存";
|
|
12
14
|
readonly 'common.error': "错误";
|
|
13
|
-
readonly 'common.success': "成功";
|
|
14
|
-
readonly 'common.generating': "生成中…";
|
|
15
15
|
readonly 'common.chars': "字";
|
|
16
16
|
readonly 'tab.workflow': "工作台";
|
|
17
17
|
readonly 'tab.overview': "总纲";
|
|
18
18
|
readonly 'tab.plan': "章节";
|
|
19
|
-
readonly 'tab.bible': "道藏";
|
|
20
|
-
readonly 'tab.foreshadow': "暗线";
|
|
21
19
|
readonly 'tab.assistant': "AI 编辑 Agent";
|
|
22
20
|
readonly 'tab.settings': "设置";
|
|
23
|
-
readonly 'workflow.title': "创作工作台";
|
|
24
|
-
readonly 'workflow.step1': "① 加载总纲";
|
|
25
|
-
readonly 'workflow.step2': "② 提炼道藏";
|
|
26
|
-
readonly 'workflow.step3': "③ 规划卷";
|
|
27
|
-
readonly 'workflow.step4': "④ 生成章节计划";
|
|
28
|
-
readonly 'workflow.step5': "⑤ 逐章写作 + AI 审稿";
|
|
29
|
-
readonly 'workflow.step6': "⑥ 润色 / 导出";
|
|
30
|
-
readonly 'workflow.loadOutline': "读取总纲";
|
|
31
|
-
readonly 'workflow.genBible': "提炼道藏";
|
|
32
21
|
readonly 'workflow.genVolumes': "生成卷计划";
|
|
33
|
-
readonly 'workflow.genPlan': "生成章节计划";
|
|
34
|
-
readonly 'workflow.done': "已完成";
|
|
35
|
-
readonly 'workflow.todo': "待办";
|
|
36
22
|
readonly 'workflow.bibleDone': "道藏已生成({n} 条规则 / {c} 个人物 / {r} 条红线)";
|
|
37
23
|
readonly 'workflow.volumesDone': "卷计划已生成({n} 卷)";
|
|
38
24
|
readonly 'workflow.planDone': "章节计划已生成({n} 章)";
|
|
39
|
-
readonly 'workflow.progress': "进度:总纲 ✓ · 道藏 {bible} · 卷 {volumes} · 计划 {plan} · 已完成 {done}/{total} 章";
|
|
40
|
-
readonly 'overview.loadDocx': "从 docx 读取总纲";
|
|
41
|
-
readonly 'overview.loadDocxDefault': "读取默认总纲";
|
|
42
25
|
readonly 'overview.loadingOutline': "正在解析 docx…";
|
|
43
26
|
readonly 'overview.outlineHint': "总纲文本(可编辑)";
|
|
44
27
|
readonly 'overview.outlineChars': "总纲字数";
|
|
45
28
|
readonly 'overview.saveOutline': "保存总纲";
|
|
46
29
|
readonly 'overview.saved': "总纲已保存";
|
|
47
30
|
readonly 'overview.bookName': "书名";
|
|
48
|
-
readonly 'overview.loadCustom': "指定 docx 路径";
|
|
49
|
-
readonly 'overview.loadCustomHint': "绝对路径,留空使用默认";
|
|
50
31
|
readonly 'plan.generate': "生成章节计划";
|
|
51
32
|
readonly 'plan.generateHint': "章节数量";
|
|
52
33
|
readonly 'plan.count': "章";
|
|
53
|
-
readonly 'plan.empty': "暂无章节计划,请先生成";
|
|
54
|
-
readonly 'plan.chapter': "章";
|
|
55
34
|
readonly 'plan.pending': "待生成";
|
|
56
35
|
readonly 'plan.generating': "生成中";
|
|
57
36
|
readonly 'plan.written': "待审稿";
|
|
@@ -63,23 +42,17 @@ export declare const zh: {
|
|
|
63
42
|
readonly 'plan.rewrite': "修订";
|
|
64
43
|
readonly 'plan.review': "审稿";
|
|
65
44
|
readonly 'plan.polish': "去AI味";
|
|
66
|
-
readonly 'plan.writeAll': "批量生成全部";
|
|
67
45
|
readonly 'plan.writeAllPending': "批量生成剩余";
|
|
68
|
-
readonly 'plan.generated': "已生成";
|
|
69
|
-
readonly 'plan.progress': "进度";
|
|
70
46
|
readonly 'plan.beats': "剧情要点";
|
|
71
47
|
readonly 'plan.reviewReport': "审稿报告";
|
|
72
48
|
readonly 'plan.reviewScore': "评分";
|
|
73
49
|
readonly 'plan.reviewVerdict': "总评";
|
|
74
|
-
readonly 'plan.reviewIssues': "问题清单";
|
|
75
50
|
readonly 'plan.reviewPass': "通过";
|
|
76
51
|
readonly 'plan.reviewFail': "未通过";
|
|
77
|
-
readonly 'plan.approve': "手动通过";
|
|
78
52
|
readonly 'plan.summary': "章节摘要";
|
|
79
53
|
readonly 'plan.volumes': "卷";
|
|
80
|
-
readonly 'plan.noVolume': "未分卷";
|
|
81
54
|
readonly 'bible.title': "道藏";
|
|
82
|
-
readonly 'bible.gen': "
|
|
55
|
+
readonly 'bible.gen': "提炼道藏";
|
|
83
56
|
readonly 'bible.genre': "题材基调";
|
|
84
57
|
readonly 'bible.worldRules': "世界规则";
|
|
85
58
|
readonly 'bible.characters': "人物志";
|
|
@@ -87,9 +60,8 @@ export declare const zh: {
|
|
|
87
60
|
readonly 'bible.style': "风格要求";
|
|
88
61
|
readonly 'bible.none': "尚未生成道藏。生成后写作会严格遵守人设与金手指规则,审稿也会按红线检查。";
|
|
89
62
|
readonly 'foreshadow.title': "暗线管理";
|
|
90
|
-
readonly 'foreshadow.suggest': "
|
|
63
|
+
readonly 'foreshadow.suggest': "建议暗线";
|
|
91
64
|
readonly 'foreshadow.none': "暂无暗线";
|
|
92
|
-
readonly 'foreshadow.status': "状态";
|
|
93
65
|
readonly 'foreshadow.planned': "计划中";
|
|
94
66
|
readonly 'foreshadow.planted': "已埋设";
|
|
95
67
|
readonly 'foreshadow.progressing': "推进中";
|
|
@@ -99,7 +71,6 @@ export declare const zh: {
|
|
|
99
71
|
readonly 'foreshadow.plantedAt': "埋设于";
|
|
100
72
|
readonly 'foreshadow.setPlanted': "标记已埋设";
|
|
101
73
|
readonly 'foreshadow.setResolved': "标记已回收";
|
|
102
|
-
readonly 'tab.facts': "编年录";
|
|
103
74
|
readonly 'tab.plotlines': "剧情线";
|
|
104
75
|
readonly 'plotlines.hint': "主线/支线/人物线/悬念线的推进管理:章节生成时会注入未完结的线,要求每章至少推进一条;关联章节记录推进节点。";
|
|
105
76
|
readonly 'plotlines.empty': "还没有剧情线——长篇小说建议先建主线与几条支线。";
|
|
@@ -121,23 +92,16 @@ export declare const zh: {
|
|
|
121
92
|
readonly 'plotlines.cancel': "取消";
|
|
122
93
|
readonly 'plotlines.edit': "编辑";
|
|
123
94
|
readonly 'plotlines.remove': "删除";
|
|
124
|
-
readonly 'plotlines.linkChapter': "关联本章";
|
|
125
95
|
readonly 'plotlines.chapters': "已关联";
|
|
126
|
-
readonly '
|
|
127
|
-
readonly 'plotlines.workflowEmpty': "未建剧情线(去「剧情线」页创建)";
|
|
128
|
-
readonly 'sensitive.title': "敏感词检查";
|
|
129
|
-
readonly 'sensitive.scanAll': "🔞 全书敏感词检查";
|
|
96
|
+
readonly 'sensitive.scanAll': " 全书敏感词检查";
|
|
130
97
|
readonly 'sensitive.hint': "内置违禁词库硬匹配(政治/擦边/暴力/辱骂/广告/其他),发布前建议检查;只做提示,是否修改由你判断。";
|
|
131
|
-
readonly 'sensitive.clean': "
|
|
98
|
+
readonly 'sensitive.clean': " 未命中任何违禁词(扫描 {n} 章)";
|
|
132
99
|
readonly 'sensitive.hits': "命中 {n} 处({chapters} 章受影响)";
|
|
133
100
|
readonly 'sensitive.goFix': "去修订";
|
|
134
101
|
readonly 'sensitive.fixPrefill': "请删除或替换正文中的违禁表达「{word}」(类别:{category}),用含蓄/间接的写法替代。";
|
|
135
102
|
readonly 'facts.title': "编年录 / 时间线({n} 条)";
|
|
136
103
|
readonly 'facts.hint': "每章生成后自动抽取「已确立事实」(人物状态/境界资源/关系变化/伏笔落地),最近 20 条注入后续章节生成,保证长期一致。";
|
|
137
104
|
readonly 'facts.backfill': "回填历史章节事实";
|
|
138
|
-
readonly 'facts.backfilled': "已从历史章节回填 {n} 条事实";
|
|
139
|
-
readonly 'settings.title': "设置";
|
|
140
|
-
readonly 'settings.outlinePath': "默认大纲路径";
|
|
141
105
|
readonly 'settings.outputDir': "输出目录";
|
|
142
106
|
readonly 'settings.provider': "模型提供商";
|
|
143
107
|
readonly 'settings.model': "模型";
|
|
@@ -146,13 +110,7 @@ export declare const zh: {
|
|
|
146
110
|
readonly 'settings.edit': "编辑";
|
|
147
111
|
readonly 'settings.delete': "删除";
|
|
148
112
|
readonly 'settings.modelCustomPlaceholder': "输入任意模型 id";
|
|
149
|
-
readonly 'settings.savedModels': "我的模型";
|
|
150
|
-
readonly 'settings.modelCards': "模型卡片(内置 + 已添加)";
|
|
151
|
-
readonly 'settings.savedModelName': "名称";
|
|
152
|
-
readonly 'settings.addModel': "添加模型";
|
|
153
|
-
readonly 'settings.catalogRefresh': "刷新厂商";
|
|
154
113
|
readonly 'settings.refreshModels': "刷新模型";
|
|
155
|
-
readonly 'settings.savedModelsHint': "手动添加常用模型(provider + 模型 id),点击即可切换当前模型;厂商模式会写入 DSH 凭据并注册路由。";
|
|
156
114
|
readonly 'settings.testConnection': "测试连通";
|
|
157
115
|
readonly 'settings.testRunning': "测试中";
|
|
158
116
|
readonly 'settings.testOk': "连通";
|
|
@@ -167,15 +125,9 @@ export declare const zh: {
|
|
|
167
125
|
readonly 'settings.reasoning.low': "low · 低思考";
|
|
168
126
|
readonly 'settings.reasoning.high': "high · 高思考";
|
|
169
127
|
readonly 'settings.reasoning.max': "max · 最高思考(质检/推演)";
|
|
170
|
-
readonly 'settings.theme': "主题";
|
|
171
|
-
readonly 'settings.themeLiquid': "iOS 液态玻璃(绿)";
|
|
172
|
-
readonly 'settings.themeNeumorph': "新拟物(双阴影)";
|
|
173
|
-
readonly 'settings.themeHint': "存于浏览器本地,即时生效";
|
|
174
128
|
readonly 'settings.chapterChars': "每章目标字数";
|
|
175
129
|
readonly 'settings.maxTokens': "单章最大输出 tokens";
|
|
176
130
|
readonly 'settings.reviewPassScore': "审稿通过分数(0-100)";
|
|
177
|
-
readonly 'settings.editorFontSize': "编辑器字号(仅编辑页显示)";
|
|
178
|
-
readonly 'settings.editorFontSizeHint': "存于浏览器本地,不影响其他设备";
|
|
179
131
|
readonly 'settings.autoReview': "生成后自动审稿";
|
|
180
132
|
readonly 'settings.autoAuthorReview': "生成后自动作者复盘";
|
|
181
133
|
readonly 'settings.autoAuthorReviewHint': "复盘钩子兑现/结尾钩子/剧情线推进/连续性/节奏趋势,每章约 2000 token";
|
|
@@ -183,8 +135,8 @@ export declare const zh: {
|
|
|
183
135
|
readonly 'settings.autoReviewAfterReviseHint': "按意见修订/润色产出草稿后自动附带一次 AI 审查,直接显示新稿评分与剩余问题(每章约 2-3k token,可关)";
|
|
184
136
|
readonly 'settings.save': "保存设置";
|
|
185
137
|
readonly 'settings.saved': "设置已保存";
|
|
138
|
+
readonly 'settings.savedUnpersisted': "设置已生效,但未能持久化(宿主未登记本插件的配置段),重启后会回到原值。";
|
|
186
139
|
readonly 'settings.openFolder': "打开输出文件夹";
|
|
187
|
-
readonly 'settings.export': "导出";
|
|
188
140
|
readonly 'settings.exportTxt': "导出 TXT";
|
|
189
141
|
readonly 'settings.exportMd': "导出 Markdown";
|
|
190
142
|
readonly 'settings.exported': "已导出:{file}({chars} 字,{chapters} 章)";
|
|
@@ -194,19 +146,12 @@ export declare const zh: {
|
|
|
194
146
|
readonly 'progress.error': "第 {no} 章失败:{message}";
|
|
195
147
|
readonly 'progress.rewriting': "正在修订第 {no} 章…";
|
|
196
148
|
readonly 'progress.polishing': "正在润色第 {no} 章…";
|
|
197
|
-
readonly 'progress.empty': "生成/审稿进度将显示在这里";
|
|
198
149
|
readonly 'assistant.hint': "和 AI 编辑 Agent 讨论剧情、人设、暗线;达成一致后可让它直接修改总纲、道藏、章节内容。";
|
|
199
150
|
readonly 'assistant.placeholder': "例如:我想让第 2 章结尾加一个悬念——墟境里传来爷爷的声音…";
|
|
200
151
|
readonly 'assistant.send': "发送";
|
|
201
|
-
readonly 'assistant.toolStart': "⚙ 执行操作:{name}…";
|
|
202
|
-
readonly 'assistant.toolDone': "✓ {name} 完成:{detail}";
|
|
203
|
-
readonly 'assistant.toolError': "✗ {name} 失败:{detail}";
|
|
204
152
|
readonly 'assistant.empty': "还没有对话。和 AI 编辑 Agent 聊聊剧情吧。";
|
|
205
153
|
readonly 'status.projectNone': "输出目录中还没有项目。请先加载大纲。";
|
|
206
154
|
readonly 'status.files': "已生成文件";
|
|
207
|
-
readonly 'api.error': "请求失败";
|
|
208
155
|
};
|
|
209
|
-
/**
|
|
210
|
-
export declare const en: Record<string, string>;
|
|
211
|
-
/** Keys type for the zh dictionary. */
|
|
156
|
+
/** 面板文案键位(= zh 词典的键)。 */
|
|
212
157
|
export type NovelKey = keyof typeof zh;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { NovelApi } from './api.ts';
|
|
2
2
|
import type { PanelController } from './panel/controller.ts';
|
|
3
|
-
/** The injected panel container. */
|
|
4
|
-
export declare const PANEL_VIEW_SELECTOR = "[data-dsh-novelforge-view]";
|
|
5
3
|
/**
|
|
6
4
|
* Mount the panel React tree into the center column and bind visibility to
|
|
7
5
|
* the controller.
|