dsh-novel-write-engine 0.2.1 → 0.2.2
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/CHANGELOG.md +36 -1
- package/README.md +101 -49
- package/lib/client.js +276 -27
- package/lib/index.d.ts +291 -20
- package/lib/index.js +1534 -136
- package/lib/types/client/dto.d.ts +29 -3
- package/lib/types/client/panel.d.ts +1 -1
- package/lib/types/client/viewmodel.d.ts +31 -2
- package/lib/types/constants.d.ts +4 -1
- package/lib/types/types.d.ts +18 -1
- package/package.json +1 -1
- package/skills/entry.md +7 -0
package/lib/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const SCENE_TYPES: readonly ["战斗/动作章", "日常过渡章", "情
|
|
|
22
22
|
type SceneType = (typeof SCENE_TYPES)[number];
|
|
23
23
|
/** A violation is blocking unless the rule pack declares it advisory. */
|
|
24
24
|
type Severity = 'blocker' | 'advisory';
|
|
25
|
-
/** All thirty-
|
|
25
|
+
/** All thirty-two service operations (22 inherited + 9 book-level + restoreBackup). */
|
|
26
26
|
declare const OPERATIONS: readonly ["initProject", "archiveChapter", "amend", "rollback", "reopenChapter", "submitWorldPlan", "submitChapterPlan", "submitDraft", "submitReview", "submitRevision", "runCheck", "submitBookPlan", "submitOutline", "importOutline", "submitWorldbook", "getStatus", "getBrief", "countWords", "queryState", "diff", "auditHistory", "advise", "search", "doctor", "report", "guide", "export", "panelSummary", "panelChapters", "panelGates", "stats", "restoreBackup"];
|
|
27
27
|
type Operation = (typeof OPERATIONS)[number];
|
|
28
28
|
/** Structured, non-fatal note attached to a successful result. */
|
|
@@ -60,6 +60,9 @@ interface ReadingProof {
|
|
|
60
60
|
/** Error families map one-to-one to the three repair actions a caller can take. */
|
|
61
61
|
declare const ERROR_CODES: {
|
|
62
62
|
readonly PROJECT_NOT_FOUND: "ENGINE_PROJECT_NOT_FOUND";
|
|
63
|
+
readonly PROJECT_AMBIGUOUS: "ENGINE_PROJECT_AMBIGUOUS";
|
|
64
|
+
readonly PROJECT_MISSING: "ENGINE_PROJECT_MISSING";
|
|
65
|
+
readonly PROJECT_IDENTITY_MISMATCH: "ENGINE_PROJECT_IDENTITY_MISMATCH";
|
|
63
66
|
readonly PROJECT_EXISTS: "ENGINE_PROJECT_EXISTS";
|
|
64
67
|
readonly STAGE_ORDER: "ENGINE_STAGE_ORDER";
|
|
65
68
|
readonly GATE_BLOCKED: "ENGINE_GATE_BLOCKED";
|
|
@@ -984,6 +987,15 @@ interface ChapterStatusRow {
|
|
|
984
987
|
stage: Stage;
|
|
985
988
|
passed: boolean;
|
|
986
989
|
}
|
|
990
|
+
/** Where an omitted project root came from. */
|
|
991
|
+
type SelectionSource = 'explicit' | 'session' | 'workspace' | 'active' | 'config' | 'single';
|
|
992
|
+
/** One resolved project choice, before the project is loaded. */
|
|
993
|
+
interface Selection {
|
|
994
|
+
root: string;
|
|
995
|
+
source: SelectionSource;
|
|
996
|
+
title?: string;
|
|
997
|
+
created_at?: string;
|
|
998
|
+
}
|
|
987
999
|
/** The `getStatus` payload. */
|
|
988
1000
|
interface StatusReport {
|
|
989
1001
|
project: {
|
|
@@ -992,6 +1004,11 @@ interface StatusReport {
|
|
|
992
1004
|
platform: Platform;
|
|
993
1005
|
root: string;
|
|
994
1006
|
};
|
|
1007
|
+
/** Why this project was chosen; lets the model notice a wrong book. */
|
|
1008
|
+
selection?: {
|
|
1009
|
+
source: SelectionSource;
|
|
1010
|
+
root: string;
|
|
1011
|
+
};
|
|
995
1012
|
/** The chapter requested for metrics; may be historical. */
|
|
996
1013
|
chapter: number;
|
|
997
1014
|
/** The chapter the pipeline is currently working on. */
|
|
@@ -1219,6 +1236,8 @@ type DocKind = 'project' | 'pipeline' | 'chapters' | 'characters' | 'world' | 'l
|
|
|
1219
1236
|
interface RegistryEntry {
|
|
1220
1237
|
root: string;
|
|
1221
1238
|
title: string;
|
|
1239
|
+
/** Project identity; absent on registries written by 0.2.1 and earlier. */
|
|
1240
|
+
created_at?: string;
|
|
1222
1241
|
updated_at: string;
|
|
1223
1242
|
}
|
|
1224
1243
|
interface BookPatch {
|
|
@@ -1434,6 +1453,8 @@ interface PanelBook {
|
|
|
1434
1453
|
interface PanelSummaryDto {
|
|
1435
1454
|
schemaVersion: number;
|
|
1436
1455
|
panelId: string;
|
|
1456
|
+
/** Absolute project root, so a stale title cannot hide a wrong book. */
|
|
1457
|
+
root: string;
|
|
1437
1458
|
title: string;
|
|
1438
1459
|
genre: string;
|
|
1439
1460
|
platform: string;
|
|
@@ -1502,6 +1523,47 @@ interface PanelGatesDto {
|
|
|
1502
1523
|
/** Human-facing one-liner per blocking item. */
|
|
1503
1524
|
explanations: string[];
|
|
1504
1525
|
}
|
|
1526
|
+
/** One selectable project in the panel; state is cheap, not a full load. */
|
|
1527
|
+
interface PanelProjectOption {
|
|
1528
|
+
root: string;
|
|
1529
|
+
title: string;
|
|
1530
|
+
active: boolean;
|
|
1531
|
+
registered: boolean;
|
|
1532
|
+
state: 'ok' | 'damaged' | 'missing' | 'unreadable';
|
|
1533
|
+
}
|
|
1534
|
+
interface PanelSelection {
|
|
1535
|
+
root: string | null;
|
|
1536
|
+
source: 'query' | 'active' | 'single' | 'config' | 'none';
|
|
1537
|
+
}
|
|
1538
|
+
interface PanelMissing {
|
|
1539
|
+
root: string;
|
|
1540
|
+
title: string;
|
|
1541
|
+
code: 'ENGINE_PROJECT_MISSING' | 'ENGINE_PROJECT_NOT_FOUND';
|
|
1542
|
+
reason: 'missing' | 'not-project' | 'damaged' | 'not_registered' | 'unreadable';
|
|
1543
|
+
hint: string;
|
|
1544
|
+
}
|
|
1545
|
+
interface PanelBundle {
|
|
1546
|
+
projects: PanelProjectOption[];
|
|
1547
|
+
selection: PanelSelection;
|
|
1548
|
+
summary?: PanelSummaryDto;
|
|
1549
|
+
chapters?: PanelChaptersDto;
|
|
1550
|
+
gates?: PanelGatesDto;
|
|
1551
|
+
resume?: {
|
|
1552
|
+
text: string;
|
|
1553
|
+
};
|
|
1554
|
+
missing?: PanelMissing;
|
|
1555
|
+
empty?: true;
|
|
1556
|
+
error?: string;
|
|
1557
|
+
}
|
|
1558
|
+
interface ResumePromptInput {
|
|
1559
|
+
title: string;
|
|
1560
|
+
root: string;
|
|
1561
|
+
chapter: number | string;
|
|
1562
|
+
stage: string;
|
|
1563
|
+
nextTool: string;
|
|
1564
|
+
}
|
|
1565
|
+
/** One shared prompt template for `/novel resume` and the panel copy button. */
|
|
1566
|
+
declare function formatResumePrompt(input: ResumePromptInput): string;
|
|
1505
1567
|
/** The nine-phase progress strip: phases before the active one are done. */
|
|
1506
1568
|
declare function phaseStrip(stage: Stage, finished?: boolean): Array<{
|
|
1507
1569
|
id: string;
|
|
@@ -1513,6 +1575,15 @@ declare function projectChapter(record: ChapterRecord): PanelChapterRow;
|
|
|
1513
1575
|
declare function projectSummary(snapshot: PanelSnapshot): PanelSummaryDto;
|
|
1514
1576
|
declare function projectChapters(snapshot: PanelSnapshot): PanelChaptersDto;
|
|
1515
1577
|
declare function projectGates(snapshot: PanelSnapshot): PanelGatesDto;
|
|
1578
|
+
/** How much of a candidate project can be inspected without loading a snapshot. */
|
|
1579
|
+
type ProjectState = 'ok' | 'damaged' | 'not-project' | 'missing' | 'unreadable';
|
|
1580
|
+
interface ProjectInspection {
|
|
1581
|
+
root: string;
|
|
1582
|
+
state: ProjectState;
|
|
1583
|
+
title: string;
|
|
1584
|
+
created_at?: string;
|
|
1585
|
+
error?: string;
|
|
1586
|
+
}
|
|
1516
1587
|
/** Plugin configuration, mapped from `Config` in `src/index.ts`. */
|
|
1517
1588
|
interface EngineConfig {
|
|
1518
1589
|
projectRoot: string;
|
|
@@ -1759,6 +1830,11 @@ interface ReportSubmission {
|
|
|
1759
1830
|
interface GuideInput {
|
|
1760
1831
|
root?: string;
|
|
1761
1832
|
}
|
|
1833
|
+
/** Session/workspace context of one tool or command call. */
|
|
1834
|
+
interface EngineCaller {
|
|
1835
|
+
sessionId?: string;
|
|
1836
|
+
cwd?: string;
|
|
1837
|
+
}
|
|
1762
1838
|
/**
|
|
1763
1839
|
* The single write authority. Tools, commands, the panel and task books never
|
|
1764
1840
|
* touch a file; every mutation is one of these operations.
|
|
@@ -1772,8 +1848,8 @@ declare class EngineService {
|
|
|
1772
1848
|
private readonly briefContextCache;
|
|
1773
1849
|
private readonly briefs;
|
|
1774
1850
|
private readonly now;
|
|
1775
|
-
|
|
1776
|
-
private
|
|
1851
|
+
private readonly metadataMutex;
|
|
1852
|
+
private readonly callerContext;
|
|
1777
1853
|
constructor(config: EngineConfig, rulepack: Rulepack | (() => Rulepack), options?: {
|
|
1778
1854
|
briefs?: BriefLibrary;
|
|
1779
1855
|
now?: () => Date;
|
|
@@ -1794,15 +1870,52 @@ declare class EngineService {
|
|
|
1794
1870
|
private readonly signalContext;
|
|
1795
1871
|
/** Bind the host cancellation signal to the engine work of one tool call. */
|
|
1796
1872
|
withSignal<T>(signal: AbortSignal | undefined, task: () => Promise<T>): Promise<T>;
|
|
1873
|
+
/** Bind the calling Agent session and cwd to every engine operation in `task`. */
|
|
1874
|
+
withCaller<T>(caller: EngineCaller | undefined, task: () => Promise<T>): Promise<T>;
|
|
1875
|
+
private caller;
|
|
1797
1876
|
/** The configured default project root. */
|
|
1798
1877
|
defaultRoot(): string;
|
|
1878
|
+
/** Resolve a caller-supplied root against the session cwd, like /novel use. */
|
|
1879
|
+
private resolveProjectPath;
|
|
1880
|
+
/** The resolved metadata directory; resolves relative config once per call. */
|
|
1881
|
+
private stateRoot;
|
|
1882
|
+
private stateStore;
|
|
1883
|
+
private bindings;
|
|
1884
|
+
/**
|
|
1885
|
+
* Serialize metadata read-modify-write across sessions and processes. The
|
|
1886
|
+
* project manuscript lock is a different lock; a slow write never blocks a
|
|
1887
|
+
* registry update.
|
|
1888
|
+
*/
|
|
1889
|
+
withMetadataLock<T>(task: () => Promise<T>): Promise<T>;
|
|
1890
|
+
private inspectConfigRoot;
|
|
1799
1891
|
/**
|
|
1800
|
-
* Resolve
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1892
|
+
* Resolve the four-layer choice: explicit, session binding, bounded workspace
|
|
1893
|
+
* discovery, then registry/config defaults. There is deliberately no
|
|
1894
|
+
* process-global "last project" layer.
|
|
1803
1895
|
*/
|
|
1896
|
+
/** Doctor/guide may run before any project exists; that is not a failure. */
|
|
1897
|
+
private resolveRootForInspection;
|
|
1804
1898
|
private resolveRoot;
|
|
1805
1899
|
private storeFor;
|
|
1900
|
+
/** Persist one explicit choice for this DSH session. */
|
|
1901
|
+
private bindSelection;
|
|
1902
|
+
/**
|
|
1903
|
+
* Best-effort discovery bookkeeping. A metadata failure must never turn a
|
|
1904
|
+
* successful project read/write into a failure; the registry is convenience.
|
|
1905
|
+
*/
|
|
1906
|
+
private autoRegister;
|
|
1907
|
+
/** Record the session binding/registration implied by a successful selection. */
|
|
1908
|
+
private recordSelection;
|
|
1909
|
+
/**
|
|
1910
|
+
* Read paths may record convenience metadata, but a corrupt or read-only
|
|
1911
|
+
* state directory must not turn a successful explicit-root read into a
|
|
1912
|
+
* failure. Resolution without an explicit root still reads the binding
|
|
1913
|
+
* fail-closed; writes use recordSelection directly and report a committed
|
|
1914
|
+
* mutation with a warning if its metadata update fails.
|
|
1915
|
+
*/
|
|
1916
|
+
private recordSelectionBestEffort;
|
|
1917
|
+
/** Registration/activation/use need a readable project identity. */
|
|
1918
|
+
private assertProjectHealthy;
|
|
1806
1919
|
initProject(input: InitProjectInput): Promise<OpResult<{
|
|
1807
1920
|
root: string;
|
|
1808
1921
|
title: string;
|
|
@@ -1865,6 +1978,12 @@ declare class EngineService {
|
|
|
1865
1978
|
*/
|
|
1866
1979
|
private lifetimeRounds;
|
|
1867
1980
|
getStatus(input?: StatusInput): Promise<OpResult<StatusReport>>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Build a status report from an already-loaded snapshot. This deliberately
|
|
1983
|
+
* has no selection side effect: read-only callers such as /novel resume must
|
|
1984
|
+
* not register or bind the project just by reading it.
|
|
1985
|
+
*/
|
|
1986
|
+
private statusFor;
|
|
1868
1987
|
countWords(input?: WordCountInput): Promise<OpResult<WordMetrics>>;
|
|
1869
1988
|
queryState(input: StateQueryInput): Promise<OpResult<unknown>>;
|
|
1870
1989
|
advise(input?: {
|
|
@@ -1960,14 +2079,21 @@ declare class EngineService {
|
|
|
1960
2079
|
panelGates(input?: {
|
|
1961
2080
|
root?: string;
|
|
1962
2081
|
}): Promise<PanelGatesDto>;
|
|
1963
|
-
/**
|
|
2082
|
+
/**
|
|
2083
|
+
* Build the read-only panel payload. The query root is accepted only when it
|
|
2084
|
+
* is registered, active or the configured root; arbitrary paths never reach
|
|
2085
|
+
* the filesystem from the panel route.
|
|
2086
|
+
*/
|
|
1964
2087
|
panelBundle(input?: {
|
|
1965
2088
|
root?: string;
|
|
1966
|
-
}): Promise<
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
}
|
|
2089
|
+
}): Promise<PanelBundle>;
|
|
2090
|
+
/** Read-only resume text shared with the panel copy button. */
|
|
2091
|
+
resumePrompt(input?: {
|
|
2092
|
+
root?: string;
|
|
2093
|
+
}): Promise<OpResult<{
|
|
2094
|
+
text: string | null;
|
|
2095
|
+
selection: StatusReport['selection'];
|
|
2096
|
+
}>>;
|
|
1971
2097
|
stats(input?: {
|
|
1972
2098
|
root?: string;
|
|
1973
2099
|
}): Promise<{
|
|
@@ -1989,31 +2115,80 @@ declare class EngineService {
|
|
|
1989
2115
|
targetChapters: number | null;
|
|
1990
2116
|
}>;
|
|
1991
2117
|
private registry;
|
|
1992
|
-
/** List known projects
|
|
2118
|
+
/** List known projects with a cheap directory state for the panel/command. */
|
|
1993
2119
|
listProjects(): Promise<{
|
|
1994
2120
|
active: string | null;
|
|
1995
|
-
projects: RegistryEntry
|
|
2121
|
+
projects: Array<RegistryEntry & {
|
|
2122
|
+
state: ProjectState;
|
|
2123
|
+
}>;
|
|
1996
2124
|
}>;
|
|
1997
|
-
/**
|
|
2125
|
+
/**
|
|
2126
|
+
* Record an explicit project row. An unchanged duplicate is a no-op; a path
|
|
2127
|
+
* reused by another project updates the row and reports `replaced`.
|
|
2128
|
+
*/
|
|
1998
2129
|
registerProject(input?: {
|
|
1999
2130
|
root?: string;
|
|
2000
2131
|
}): Promise<{
|
|
2001
2132
|
active: string | null;
|
|
2002
2133
|
projects: RegistryEntry[];
|
|
2134
|
+
replaced: boolean;
|
|
2003
2135
|
}>;
|
|
2004
|
-
/** Choose the default project
|
|
2136
|
+
/** Choose the panel/default project. This never binds the current session. */
|
|
2005
2137
|
setActiveProject(input: {
|
|
2006
2138
|
root: string;
|
|
2007
2139
|
}): Promise<{
|
|
2008
2140
|
active: string | null;
|
|
2141
|
+
replaced: boolean;
|
|
2009
2142
|
}>;
|
|
2010
|
-
/** Forget a registry row; the project directory
|
|
2143
|
+
/** Forget a registry row; the project directory and bindings are never touched. */
|
|
2011
2144
|
forgetProject(input: {
|
|
2012
2145
|
root: string;
|
|
2013
2146
|
}): Promise<{
|
|
2014
2147
|
active: string | null;
|
|
2015
2148
|
projects: RegistryEntry[];
|
|
2016
2149
|
}>;
|
|
2150
|
+
/**
|
|
2151
|
+
* Bounded workspace scan. Normal mode is read-only; `register` updates only
|
|
2152
|
+
* healthy, newly discovered rows, never active or session bindings.
|
|
2153
|
+
*/
|
|
2154
|
+
scanProjects(input: {
|
|
2155
|
+
cwd: string;
|
|
2156
|
+
register?: boolean;
|
|
2157
|
+
}): Promise<{
|
|
2158
|
+
cwd: string;
|
|
2159
|
+
candidates: Array<ProjectInspection & {
|
|
2160
|
+
registered: boolean;
|
|
2161
|
+
identity_changed?: boolean;
|
|
2162
|
+
reason?: string;
|
|
2163
|
+
}>;
|
|
2164
|
+
truncated: boolean;
|
|
2165
|
+
added: string[];
|
|
2166
|
+
already: string[];
|
|
2167
|
+
skipped: Array<{
|
|
2168
|
+
root: string;
|
|
2169
|
+
reason: string;
|
|
2170
|
+
}>;
|
|
2171
|
+
identity_changed: string[];
|
|
2172
|
+
}>;
|
|
2173
|
+
/** Current session binding, or the inferred fallback when none is set. */
|
|
2174
|
+
currentProject(): Promise<{
|
|
2175
|
+
selection: Selection | null;
|
|
2176
|
+
bound: boolean;
|
|
2177
|
+
state?: ProjectState;
|
|
2178
|
+
error?: string;
|
|
2179
|
+
}>;
|
|
2180
|
+
/** Explicitly switch this session; failure leaves the old binding untouched. */
|
|
2181
|
+
useProject(input: {
|
|
2182
|
+
target: string;
|
|
2183
|
+
}): Promise<{
|
|
2184
|
+
selection: Selection;
|
|
2185
|
+
title: string;
|
|
2186
|
+
created_at: string;
|
|
2187
|
+
}>;
|
|
2188
|
+
/** Clear only this session's choice; never touches a project or registry row. */
|
|
2189
|
+
unbindProject(): Promise<{
|
|
2190
|
+
cleared: boolean;
|
|
2191
|
+
}>;
|
|
2017
2192
|
/**
|
|
2018
2193
|
* Import one ledger from a settings pack. Always previews with a diff; a
|
|
2019
2194
|
* dry run never writes, and an apply is a normal transaction.
|
|
@@ -2132,11 +2307,13 @@ declare class EngineService {
|
|
|
2132
2307
|
private assertGates;
|
|
2133
2308
|
private assertChapterParameter;
|
|
2134
2309
|
private assertChapter;
|
|
2135
|
-
/** True when anything survives in the project directory besides novel.yaml. */
|
|
2136
|
-
private projectStateExists;
|
|
2137
2310
|
/** A live writer lock makes a read-only snapshot potentially torn. */
|
|
2138
2311
|
private lockIsLive;
|
|
2312
|
+
/** Resolve a selection, load it, then persist the explicit choice (best effort). */
|
|
2139
2313
|
private load;
|
|
2314
|
+
/** Load exactly one already-resolved selection; never writes a binding. */
|
|
2315
|
+
private movedProjectHint;
|
|
2316
|
+
private loadAt;
|
|
2140
2317
|
/** A repair may bypass the journal hash only when the document is unreadable. */
|
|
2141
2318
|
private stateDocIsUnreadable;
|
|
2142
2319
|
/** Read a review/check without letting one corrupt file wedge every read. */
|
|
@@ -2147,6 +2324,100 @@ declare class EngineService {
|
|
|
2147
2324
|
}
|
|
2148
2325
|
/** Read, compile and freeze a pack. Runtime callers always use the bundled default. */
|
|
2149
2326
|
declare function loadRulepack(path?: string): Rulepack;
|
|
2327
|
+
/** Panel and session identifiers. */
|
|
2328
|
+
declare const PLUGIN_NAME = "dsh-novel-write-engine";
|
|
2329
|
+
declare const PANEL_ID = "novel-workshop";
|
|
2330
|
+
declare const PANEL_ROUTE = "/api/novel-write-engine/panel";
|
|
2331
|
+
declare const SKILL_NAME = "novel-write-engine";
|
|
2332
|
+
declare const REMOTE_VERSION = 4;
|
|
2333
|
+
/** The panel is a recent-history view; the wire payload and UI use one cap. */
|
|
2334
|
+
declare const PANEL_CHAPTER_LIMIT = 30;
|
|
2335
|
+
/** Project-relative locations. Every write goes through these constants. */
|
|
2336
|
+
declare const PROJECT_FILE = "novel.yaml";
|
|
2337
|
+
declare const OUTLINE_FILE = "outline/outline.yaml";
|
|
2338
|
+
declare const WORLDBOOK_FILE = "outline/worldbook.yaml";
|
|
2339
|
+
declare const STATE_DIR = "state";
|
|
2340
|
+
declare const CHAPTERS_DIR = "chapters";
|
|
2341
|
+
declare const PLAN_DIR = "plans";
|
|
2342
|
+
declare const REVIEW_DIR = "reviews";
|
|
2343
|
+
declare const CHECK_DIR = "checks";
|
|
2344
|
+
declare const EXPORT_DIR = "exports";
|
|
2345
|
+
declare const BACKUP_DIR = "backups";
|
|
2346
|
+
declare const HISTORY_DIR = "history";
|
|
2347
|
+
/** Brief receipts are append-only evidence, separate from content transactions. */
|
|
2348
|
+
declare const BRIEF_RECEIPTS_FILE = "state/briefs.yaml";
|
|
2349
|
+
declare const OUTLINE_DIR = "outline";
|
|
2350
|
+
declare const LOCK_FILE = ".engine.lock";
|
|
2351
|
+
declare const STAGING_DIR = ".staging";
|
|
2352
|
+
declare const REGISTRY_FILE = "projects.yaml";
|
|
2353
|
+
declare const SESSION_BINDINGS_FILE = "session-bindings.yaml";
|
|
2354
|
+
declare const METADATA_LOCK_FILE = ".metadata.lock";
|
|
2355
|
+
declare const ARCHIVE_DIGESTS_FILE = "state/archive-digests.json";
|
|
2356
|
+
/** Files owned by the engine under `state/`. */
|
|
2357
|
+
declare const STATE_FILES: {
|
|
2358
|
+
readonly pipeline: "pipeline.yaml";
|
|
2359
|
+
readonly chapters: "chapters.yaml";
|
|
2360
|
+
readonly characters: "characters.yaml";
|
|
2361
|
+
readonly world: "world.yaml";
|
|
2362
|
+
readonly locks: "locks.yaml";
|
|
2363
|
+
readonly timeline: "timeline.yaml";
|
|
2364
|
+
readonly foreshadows: "foreshadows.yaml";
|
|
2365
|
+
readonly relationships: "relationships.yaml";
|
|
2366
|
+
readonly handoff: "handoff.yaml";
|
|
2367
|
+
readonly journal: "journal.jsonl";
|
|
2368
|
+
};
|
|
2369
|
+
/** Chapter file name, zero padded to three digits. */
|
|
2370
|
+
declare const chapterFile: (chapter: number) => string;
|
|
2371
|
+
/** Kept for reference when a rollback discards the current draft. */
|
|
2372
|
+
declare const deprecatedChapterFile: (chapter: number) => string;
|
|
2373
|
+
declare const planWorldFile: (chapter: number) => string;
|
|
2374
|
+
declare const planChapterFile: (chapter: number) => string;
|
|
2375
|
+
declare const reviewFile: (chapter: number) => string;
|
|
2376
|
+
declare const checkFile: (chapter: number) => string;
|
|
2377
|
+
declare const reviewHistoryFile: (chapter: number, revision: number) => string;
|
|
2378
|
+
declare const checkHistoryFile: (chapter: number, revision: number) => string;
|
|
2379
|
+
declare const chapterHistoryFile: (chapter: number, revision: number) => string;
|
|
2380
|
+
declare const deprecatedHistoryFile: (chapter: number, revision: number) => string;
|
|
2381
|
+
declare const planHistoryFile: (chapter: number, revision: number) => string;
|
|
2382
|
+
declare const HISTORY_KINDS: readonly ["reviews", "checks", "chapters", "deprecated", "plans"];
|
|
2383
|
+
type HistoryKind = (typeof HISTORY_KINDS)[number];
|
|
2384
|
+
/** Limits that are structural, not taste. */
|
|
2385
|
+
declare const LIMITS: {
|
|
2386
|
+
/** P4 <-> P5/P6 retries before a forced rollback. */
|
|
2387
|
+
maxRounds: number;
|
|
2388
|
+
/** Lock staleness in milliseconds. */
|
|
2389
|
+
lockStaleMs: number;
|
|
2390
|
+
/** How long a writer waits for the keyed mutex before failing. */
|
|
2391
|
+
lockWaitMs: number;
|
|
2392
|
+
/** Reading proofs shorter than this cannot be verified. */
|
|
2393
|
+
minQuoteChars: number;
|
|
2394
|
+
/** World-plan text fields are protected context, so they need a hard bound. */
|
|
2395
|
+
maxWorldPlanItems: number;
|
|
2396
|
+
maxWorldPlanTextChars: number;
|
|
2397
|
+
maxWorldPlanObjectiveChars: number;
|
|
2398
|
+
/** Cast plus summary may exceed eight, but not without a bound. */
|
|
2399
|
+
maxActiveCast: number;
|
|
2400
|
+
/** Outline and worldbook are protected context, so they need hard bounds. */
|
|
2401
|
+
maxOutlineChapters: number;
|
|
2402
|
+
maxOutlineVolumes: number;
|
|
2403
|
+
maxOutlineTextFieldChars: number;
|
|
2404
|
+
maxOutlineNotesChars: number;
|
|
2405
|
+
maxWorldbookEntries: number;
|
|
2406
|
+
maxWorldbookTextChars: number;
|
|
2407
|
+
maxSearchQueryChars: number;
|
|
2408
|
+
};
|
|
2409
|
+
/** Re-exported enums make adapter code readable without importing types twice. */
|
|
2410
|
+
declare const SCENE_TYPE_DEFAULT: SceneType;
|
|
2411
|
+
declare const DEFAULT_GENRE: Genre;
|
|
2412
|
+
declare const DEFAULT_PLATFORM: Platform;
|
|
2413
|
+
declare const INITIAL_STAGE: Stage;
|
|
2414
|
+
/** The order used to render the nine-phase progress strip. */
|
|
2415
|
+
declare const PHASE_STRIP: readonly ["P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9"];
|
|
2416
|
+
/** Tool names, kept here so the arch test can assert one namespace. */
|
|
2417
|
+
declare const TOOL_NAMES: readonly ["novel_init", "novel_status", "novel_brief", "novel_plan_world", "novel_plan_chapter", "novel_write_draft", "novel_review", "novel_revise", "novel_check", "novel_archive", "novel_word_count", "novel_state", "novel_amend", "novel_rollback", "novel_diff", "novel_export", "novel_audit", "novel_pipeline", "novel_blueprint", "novel_outline", "novel_outline_import", "novel_worldbook", "novel_search", "novel_doctor", "novel_report", "novel_guide", "novel_reopen", "novel_restore"];
|
|
2418
|
+
type ToolName = (typeof TOOL_NAMES)[number];
|
|
2419
|
+
/** The ten high-frequency tools kept when `tools.mode = core`. */
|
|
2420
|
+
declare const CORE_TOOLS: readonly ToolName[];
|
|
2150
2421
|
/** One rendered chapter, assembled by the engine before rendering. */
|
|
2151
2422
|
interface ExportChapter {
|
|
2152
2423
|
num: number;
|
|
@@ -2189,4 +2460,4 @@ declare const Config: Schema<Config>;
|
|
|
2189
2460
|
* created lazily per project root.
|
|
2190
2461
|
*/
|
|
2191
2462
|
declare function apply(ctx: Context, config: Config): void;
|
|
2192
|
-
export { AdviceReport, ArchiveHandoff, AuditRow, BlockingItem, BookPlan, BookReport, BriefDocument, BriefLibrary, BriefReceipt, BriefReceiptsDocument, BriefStage, ChapterCastMember, ChapterPlanInput, ChapterRecord, ChapterStatusRow, ChapterSummary, ChaptersDocument, CharacterDelta, CharactersDocument, CheckDocument, Config, Deduction, DeltaAction, DiffReport, DoctorCheck, DoctorReport, DraftInput, DraftState, ERROR_CODES, EngineBlockedError, EngineError, EngineFaultError, EngineInputError, EngineService, ErrorCode, ExportChapter, ExportKind, ForeshadowDelta, ForeshadowsDocument, GENRES, GateInput, GateOptions, GateResult, Genre, GuideReport, GuideStep, HandoffDocument, LocksDocument, MachineMetrics, NovelProject, OPERATIONS, OpResult, Operation, OutlineChapter, OutlineDocument, OutlineProgress, OutlineVolume, PLATFORMS, PanelBook, PanelChapterRow, PanelChaptersDto, PanelDraft, PanelGatesDto, PanelSnapshot, PanelSummaryDto, PipelineState, Platform, ReadingProof, ReadingProofReference, RelationshipDelta, RelationshipsDocument, ReviewDocument, ReviewInput, ReviewIssue, RevisionEdit, RevisionInput, RevisionPatch, RoundCounters, SCENE_TYPES, SCHEMA_VERSION, SceneType, ScoreDimension, SearchReport, SearchResultItem, SemanticItem, Severity, Stage, StateDelta, StateError, StateErrorCode, StatusReport, TimelineDelta, TimelineDocument, Violation, Warning, WordMetrics, WorldDelta, WorldDocument, WorldPlanInput, WorldbookBackstory, WorldbookCharacter, WorldbookDocument, WorldbookFact, WorldbookFaction, WorldbookGlossary, WorldbookLocation, WorldbookRule, applicableGates, apply, blockedError, briefStageFor, chapterHeading, evaluateGates, faultError, gateName, inject, inputError, loadRulepack, name, parseParagraphLocation, phaseStrip, projectChapter, projectChapters, projectGates, projectSummary, renderBlurb, renderCover, renderEpubChapter, renderMarkdown, renderPlainText, renderProposal, verifyReference };
|
|
2463
|
+
export { ARCHIVE_DIGESTS_FILE, AdviceReport, ArchiveHandoff, AuditRow, BACKUP_DIR, BRIEF_RECEIPTS_FILE, BlockingItem, BookPlan, BookReport, BriefDocument, BriefLibrary, BriefReceipt, BriefReceiptsDocument, BriefStage, CHAPTERS_DIR, CHECK_DIR, CORE_TOOLS, ChapterCastMember, ChapterPlanInput, ChapterRecord, ChapterStatusRow, ChapterSummary, ChaptersDocument, CharacterDelta, CharactersDocument, CheckDocument, Config, DEFAULT_GENRE, DEFAULT_PLATFORM, Deduction, DeltaAction, DiffReport, DoctorCheck, DoctorReport, DraftInput, DraftState, ERROR_CODES, EXPORT_DIR, EngineBlockedError, EngineError, EngineFaultError, EngineInputError, EngineService, ErrorCode, ExportChapter, ExportKind, ForeshadowDelta, ForeshadowsDocument, GENRES, GateInput, GateOptions, GateResult, Genre, GuideReport, GuideStep, HISTORY_DIR, HISTORY_KINDS, HandoffDocument, HistoryKind, INITIAL_STAGE, LIMITS, LOCK_FILE, LocksDocument, METADATA_LOCK_FILE, MachineMetrics, NovelProject, OPERATIONS, OUTLINE_DIR, OUTLINE_FILE, OpResult, Operation, OutlineChapter, OutlineDocument, OutlineProgress, OutlineVolume, PANEL_CHAPTER_LIMIT, PANEL_ID, PANEL_ROUTE, PHASE_STRIP, PLAN_DIR, PLATFORMS, PLUGIN_NAME, PROJECT_FILE, PanelBook, PanelBundle, PanelChapterRow, PanelChaptersDto, PanelDraft, PanelGatesDto, PanelMissing, PanelProjectOption, PanelSelection, PanelSnapshot, PanelSummaryDto, PipelineState, Platform, REGISTRY_FILE, REMOTE_VERSION, REVIEW_DIR, ReadingProof, ReadingProofReference, RelationshipDelta, RelationshipsDocument, ResumePromptInput, ReviewDocument, ReviewInput, ReviewIssue, RevisionEdit, RevisionInput, RevisionPatch, RoundCounters, SCENE_TYPES, SCENE_TYPE_DEFAULT, SCHEMA_VERSION, SESSION_BINDINGS_FILE, SKILL_NAME, STAGING_DIR, STATE_DIR, STATE_FILES, SceneType, ScoreDimension, SearchReport, SearchResultItem, Selection, SelectionSource, SemanticItem, Severity, Stage, StateDelta, StateError, StateErrorCode, StatusReport, TOOL_NAMES, TimelineDelta, TimelineDocument, ToolName, Violation, WORLDBOOK_FILE, Warning, WordMetrics, WorldDelta, WorldDocument, WorldPlanInput, WorldbookBackstory, WorldbookCharacter, WorldbookDocument, WorldbookFact, WorldbookFaction, WorldbookGlossary, WorldbookLocation, WorldbookRule, applicableGates, apply, blockedError, briefStageFor, chapterFile, chapterHeading, chapterHistoryFile, checkFile, checkHistoryFile, deprecatedChapterFile, deprecatedHistoryFile, evaluateGates, faultError, formatResumePrompt, gateName, inject, inputError, loadRulepack, name, parseParagraphLocation, phaseStrip, planChapterFile, planHistoryFile, planWorldFile, projectChapter, projectChapters, projectGates, projectSummary, renderBlurb, renderCover, renderEpubChapter, renderMarkdown, renderPlainText, renderProposal, reviewFile, reviewHistoryFile, verifyReference };
|