dsh-novel-write-engine 0.2.3 → 0.2.5
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 +50 -0
- package/README.md +49 -11
- package/briefs/P2.md +1 -0
- package/briefs/P5.md +2 -0
- package/briefs/P6.md +3 -2
- package/briefs/P8.md +5 -4
- package/lib/client.js +18 -3
- package/lib/index.d.ts +102 -16
- package/lib/index.js +1398 -334
- package/lib/types/client/dto.d.ts +6 -0
- package/lib/types/client/viewmodel.d.ts +6 -0
- package/lib/types/constants.d.ts +2 -0
- package/lib/types/types.d.ts +14 -0
- package/package.json +1 -1
- package/skills/entry.md +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -68,6 +68,9 @@ declare const ERROR_CODES: {
|
|
|
68
68
|
/** The exact same keyed submission already failed in the same context. */
|
|
69
69
|
readonly RETRY_UNCHANGED: "ENGINE_RETRY_UNCHANGED";
|
|
70
70
|
readonly GATE_BLOCKED: "ENGINE_GATE_BLOCKED";
|
|
71
|
+
readonly CHECK_SUBMISSION_INVALID: "ENGINE_CHECK_SUBMISSION_INVALID";
|
|
72
|
+
readonly PENDING_PARTIAL: "ENGINE_PENDING_PARTIAL";
|
|
73
|
+
readonly IO_PERMISSION: "ENGINE_IO_PERMISSION";
|
|
71
74
|
readonly READING_PROOF_INVALID: "ENGINE_READING_PROOF_INVALID";
|
|
72
75
|
readonly SCORE_MISMATCH: "ENGINE_SCORE_MISMATCH";
|
|
73
76
|
/** A revision tried to rewrite reviewer-owned issue fields. */
|
|
@@ -178,9 +181,14 @@ interface CheckDocument {
|
|
|
178
181
|
evidence: string;
|
|
179
182
|
note: string;
|
|
180
183
|
}>;
|
|
184
|
+
/** 0.2.5: explain a persisted content failure; historical checks omit it. */
|
|
185
|
+
findings?: BlockingItem[];
|
|
181
186
|
};
|
|
182
187
|
/** Advisory codes the author has explicitly acknowledged for this content. */
|
|
183
188
|
acknowledged?: string[];
|
|
189
|
+
/** 0.2.5: content failures consume the check budget; submission errors never persist. */
|
|
190
|
+
failure_class?: 'submission' | 'content';
|
|
191
|
+
counted?: boolean;
|
|
184
192
|
verdict: 'pass' | 'fail';
|
|
185
193
|
}
|
|
186
194
|
/** Every persisted document whose damage status/panel can report. */
|
|
@@ -953,6 +961,10 @@ interface GateInput {
|
|
|
953
961
|
summary: ChapterSummary | null;
|
|
954
962
|
/** P5 may omit `summary`; when omitted, the previous plan summary is reused. */
|
|
955
963
|
summaryProvided?: boolean;
|
|
964
|
+
/** Summary-only repair: no manuscript change, no P4/P6 proof requirement. */
|
|
965
|
+
summaryOnly?: boolean;
|
|
966
|
+
/** The last write was a summary-only repair; P6 may continue without a new brief. */
|
|
967
|
+
summaryOnlyRevision?: boolean;
|
|
956
968
|
review: ReviewDocument | null;
|
|
957
969
|
check: CheckDocument | null;
|
|
958
970
|
/** When set, result-bearing gates run only the named check scopes. */
|
|
@@ -1030,6 +1042,8 @@ interface StatusReport {
|
|
|
1030
1042
|
stage: Stage;
|
|
1031
1043
|
rounds: RoundCounters;
|
|
1032
1044
|
blocking: BlockingItem[];
|
|
1045
|
+
/** Non-blocking recovery notes, e.g. a recoverable pending transaction. */
|
|
1046
|
+
warnings?: Warning[];
|
|
1033
1047
|
/** plan/review/check/ledger files that exist but cannot be read safely. */
|
|
1034
1048
|
state_errors: StateError[];
|
|
1035
1049
|
metrics: WordMetrics | null;
|
|
@@ -1122,6 +1136,20 @@ interface DiffReport {
|
|
|
1122
1136
|
}
|
|
1123
1137
|
/** Export capabilities; the last three are book-planning deliverables. */
|
|
1124
1138
|
type ExportKind = 'md' | 'txt' | 'epub' | 'outline' | 'worldbook' | 'proposal';
|
|
1139
|
+
type SemanticItemState = 'pass' | 'fail' | 'missing' | 'invalid' | 'not_found' | 'too_short' | 'duplicate' | 'overlap' | 'same_sentence' | 'boundary';
|
|
1140
|
+
interface SemanticNearest {
|
|
1141
|
+
paragraph: number;
|
|
1142
|
+
quote: string;
|
|
1143
|
+
score: number;
|
|
1144
|
+
}
|
|
1145
|
+
interface SemanticItemResult {
|
|
1146
|
+
id: string;
|
|
1147
|
+
state: SemanticItemState;
|
|
1148
|
+
quote?: string;
|
|
1149
|
+
detail?: string;
|
|
1150
|
+
nearest?: SemanticNearest;
|
|
1151
|
+
conflict_with?: string;
|
|
1152
|
+
}
|
|
1125
1153
|
/** One blacklisted word. */
|
|
1126
1154
|
interface TermEntry {
|
|
1127
1155
|
term: string;
|
|
@@ -1296,8 +1324,14 @@ interface OutlineChapterInput {
|
|
|
1296
1324
|
interface OutlineInput {
|
|
1297
1325
|
book?: BookPatch;
|
|
1298
1326
|
volumes?: VolumeInput[];
|
|
1299
|
-
chapters
|
|
1327
|
+
chapters?: OutlineChapterInput[];
|
|
1300
1328
|
strict?: boolean;
|
|
1329
|
+
/** Explicit deletion list; omitted cards are preserved. */
|
|
1330
|
+
remove?: number[];
|
|
1331
|
+
/** Explicit volume deletion list, keyed by title. */
|
|
1332
|
+
remove_volumes?: string[];
|
|
1333
|
+
/** Preview changes without writing or journaling. */
|
|
1334
|
+
dry_run?: boolean;
|
|
1301
1335
|
}
|
|
1302
1336
|
interface WorldbookPatch {
|
|
1303
1337
|
premise?: string;
|
|
@@ -1448,6 +1482,12 @@ interface PanelSnapshot {
|
|
|
1448
1482
|
code: string;
|
|
1449
1483
|
detail: string;
|
|
1450
1484
|
}>;
|
|
1485
|
+
/** Crash-left pending transaction; complete/untouched are warnings. */
|
|
1486
|
+
pending?: {
|
|
1487
|
+
state: string;
|
|
1488
|
+
txid: string;
|
|
1489
|
+
detail: string;
|
|
1490
|
+
};
|
|
1451
1491
|
}
|
|
1452
1492
|
interface PanelBook {
|
|
1453
1493
|
premise: string;
|
|
@@ -1549,6 +1589,12 @@ interface PanelSummaryDto {
|
|
|
1549
1589
|
code: string;
|
|
1550
1590
|
detail: string;
|
|
1551
1591
|
}>;
|
|
1592
|
+
/** Crash-left pending transaction; complete/untouched are warnings. */
|
|
1593
|
+
pending?: {
|
|
1594
|
+
state: string;
|
|
1595
|
+
txid: string;
|
|
1596
|
+
detail: string;
|
|
1597
|
+
};
|
|
1552
1598
|
}
|
|
1553
1599
|
interface PanelChapterRow {
|
|
1554
1600
|
num: number;
|
|
@@ -1778,8 +1824,8 @@ interface RevisionSubmission extends Omit<RevisionInput, 'summary'> {
|
|
|
1778
1824
|
summary?: ChapterSummary;
|
|
1779
1825
|
/** Updated issue statuses/evidence; the review document is patched in place. */
|
|
1780
1826
|
issues?: ReviewDocument['issues'];
|
|
1781
|
-
/** Proof that the revised text was read;
|
|
1782
|
-
proof
|
|
1827
|
+
/** Proof that the revised text was read; required for content/patch revisions. */
|
|
1828
|
+
proof?: ReadingProof;
|
|
1783
1829
|
root?: string;
|
|
1784
1830
|
}
|
|
1785
1831
|
interface CheckSubmission {
|
|
@@ -1808,7 +1854,7 @@ interface AmendSubmission {
|
|
|
1808
1854
|
interface RestoreSubmission {
|
|
1809
1855
|
txid: string;
|
|
1810
1856
|
chapter?: number;
|
|
1811
|
-
/** Restrict to
|
|
1857
|
+
/** Restrict to chapter files, or exactly [outline/outline.yaml] to restore the plan. */
|
|
1812
1858
|
paths?: string[];
|
|
1813
1859
|
root?: string;
|
|
1814
1860
|
}
|
|
@@ -1857,8 +1903,29 @@ interface WordCountInput {
|
|
|
1857
1903
|
}
|
|
1858
1904
|
interface BookPlanSubmission extends BookPatch {
|
|
1859
1905
|
volumes?: VolumeInput[];
|
|
1906
|
+
/** Explicit confirmation when a volume-list replacement drops a volume. */
|
|
1907
|
+
confirm_remove?: boolean;
|
|
1860
1908
|
root?: string;
|
|
1861
1909
|
}
|
|
1910
|
+
interface OutlineMutationResult {
|
|
1911
|
+
planned: number;
|
|
1912
|
+
archived: number;
|
|
1913
|
+
total: number;
|
|
1914
|
+
strict: boolean;
|
|
1915
|
+
volumes: number;
|
|
1916
|
+
added: number[];
|
|
1917
|
+
updated: number[];
|
|
1918
|
+
reindexed: number[];
|
|
1919
|
+
removed: number[];
|
|
1920
|
+
volumes_added: string[];
|
|
1921
|
+
volumes_updated: string[];
|
|
1922
|
+
volumes_removed: string[];
|
|
1923
|
+
dry_run?: boolean;
|
|
1924
|
+
would_add?: number[];
|
|
1925
|
+
would_update?: number[];
|
|
1926
|
+
would_reindex?: number[];
|
|
1927
|
+
would_remove?: number[];
|
|
1928
|
+
}
|
|
1862
1929
|
interface OutlineSubmission extends OutlineInput {
|
|
1863
1930
|
root?: string;
|
|
1864
1931
|
}
|
|
@@ -1906,6 +1973,8 @@ declare class EngineService {
|
|
|
1906
1973
|
private readonly stores;
|
|
1907
1974
|
private readonly mutex;
|
|
1908
1975
|
private readonly replay;
|
|
1976
|
+
/** Bumped when an export artifact disappeared; makes the replay key miss. */
|
|
1977
|
+
private readonly exportArtifactEpoch;
|
|
1909
1978
|
/** Status, panel and gates ask for the same stage context repeatedly. */
|
|
1910
1979
|
private readonly briefContextCache;
|
|
1911
1980
|
private readonly briefs;
|
|
@@ -1991,13 +2060,8 @@ declare class EngineService {
|
|
|
1991
2060
|
volumes: number;
|
|
1992
2061
|
chapters: number;
|
|
1993
2062
|
}>>;
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
archived: number;
|
|
1997
|
-
total: number;
|
|
1998
|
-
strict: boolean;
|
|
1999
|
-
volumes: number;
|
|
2000
|
-
}>>;
|
|
2063
|
+
private outlinePlanChange;
|
|
2064
|
+
submitOutline(input: OutlineSubmission): Promise<OpResult<OutlineMutationResult>>;
|
|
2001
2065
|
importOutline(input: OutlineImportSubmission): Promise<OpResult<{
|
|
2002
2066
|
format: string;
|
|
2003
2067
|
planned: number;
|
|
@@ -2106,6 +2170,8 @@ declare class EngineService {
|
|
|
2106
2170
|
chapter: number;
|
|
2107
2171
|
stage: Stage;
|
|
2108
2172
|
metrics: WordMetrics;
|
|
2173
|
+
summary_only?: boolean;
|
|
2174
|
+
rounds_consumed?: 0 | 1;
|
|
2109
2175
|
}>>;
|
|
2110
2176
|
runCheck(input: CheckSubmission): Promise<OpResult<{
|
|
2111
2177
|
chapter: number;
|
|
@@ -2116,12 +2182,26 @@ declare class EngineService {
|
|
|
2116
2182
|
acknowledged: string[];
|
|
2117
2183
|
metrics: WordMetrics;
|
|
2118
2184
|
stage: Stage;
|
|
2185
|
+
semantic: {
|
|
2186
|
+
items: SemanticItemResult[];
|
|
2187
|
+
findings: BlockingItem[];
|
|
2188
|
+
};
|
|
2189
|
+
rounds: {
|
|
2190
|
+
check: number;
|
|
2191
|
+
};
|
|
2192
|
+
counted: boolean;
|
|
2119
2193
|
}>>;
|
|
2120
2194
|
archiveChapter(input: ArchiveSubmission): Promise<OpResult<{
|
|
2121
2195
|
chapter: number;
|
|
2122
2196
|
assigned_ids: Record<string, string>;
|
|
2123
2197
|
metrics: WordMetrics;
|
|
2124
2198
|
score: number;
|
|
2199
|
+
delta_warnings?: Warning[];
|
|
2200
|
+
normalized_world?: Record<string, {
|
|
2201
|
+
from: 'created' | 'updated' | 'no_change';
|
|
2202
|
+
to: 'created' | 'updated' | 'no_change';
|
|
2203
|
+
reason: 'existing-created-as-updated' | 'missing-updated-as-created' | 'missing-no-change-as-created';
|
|
2204
|
+
}>;
|
|
2125
2205
|
}>>;
|
|
2126
2206
|
amend(input: AmendSubmission): Promise<OpResult<{
|
|
2127
2207
|
path: string;
|
|
@@ -2301,10 +2381,14 @@ declare class EngineService {
|
|
|
2301
2381
|
*/
|
|
2302
2382
|
private assertPlanningDocumentReadable;
|
|
2303
2383
|
/**
|
|
2304
|
-
*
|
|
2305
|
-
*
|
|
2306
|
-
*
|
|
2307
|
-
|
|
2384
|
+
* `strict_explicit` is an internal provenance bit, not an author choice.
|
|
2385
|
+
* Exposing it lets a caller forge "the author chose strict:false" without
|
|
2386
|
+
* going through the strict option. Stored documents may still contain it.
|
|
2387
|
+
*/
|
|
2388
|
+
private assertPublicBookHasNoStrictExplicit;
|
|
2389
|
+
/**
|
|
2390
|
+
* An import is a full replacement, unlike novel_outline's keyed upsert. It
|
|
2391
|
+
* must not silently lose the active card while strict mode still requires it.
|
|
2308
2392
|
*/
|
|
2309
2393
|
private assertActiveCardPreserved;
|
|
2310
2394
|
/**
|
|
@@ -2420,6 +2504,8 @@ declare const PANEL_CHAPTER_LIMIT = 30;
|
|
|
2420
2504
|
/** Project-relative locations. Every write goes through these constants. */
|
|
2421
2505
|
declare const PROJECT_FILE = "novel.yaml";
|
|
2422
2506
|
declare const OUTLINE_FILE = "outline/outline.yaml";
|
|
2507
|
+
/** Last outline replaced by a normal planning write; one level is enough for repair. */
|
|
2508
|
+
declare const OUTLINE_DEPRECATED_FILE = "outline/outline.deprecated.yaml";
|
|
2423
2509
|
declare const WORLDBOOK_FILE = "outline/worldbook.yaml";
|
|
2424
2510
|
declare const STATE_DIR = "state";
|
|
2425
2511
|
declare const CHAPTERS_DIR = "chapters";
|
|
@@ -2545,4 +2631,4 @@ declare const Config: Schema<Config>;
|
|
|
2545
2631
|
* created lazily per project root.
|
|
2546
2632
|
*/
|
|
2547
2633
|
declare function apply(ctx: Context, config: Config): void;
|
|
2548
|
-
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 };
|
|
2634
|
+
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_DEPRECATED_FILE, 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 };
|