dsh-novel-write-engine 0.2.8 → 0.2.10
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 +31 -0
- package/README.md +26 -26
- package/briefs/P3.md +1 -0
- package/briefs/P4.md +1 -1
- package/briefs/P8.md +1 -1
- package/lib/client.js +1961 -120
- package/lib/index.d.ts +83 -8
- package/lib/index.js +1246 -225
- package/lib/types/client/dto.d.ts +12 -9
- package/lib/types/client/panel.d.ts +19 -1
- package/lib/types/client/viewmodel.d.ts +11 -4
- package/lib/types/constants.d.ts +2 -0
- package/lib/types/panel-contract.d.ts +2 -2
- package/lib/types/types.d.ts +18 -1
- package/package.json +8 -3
- package/presets/novel-write-engine.patch.yml +4 -0
- package/rulepacks/default.yaml +13 -5
- package/skills/entry.md +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -217,6 +217,18 @@ interface WordMetrics {
|
|
|
217
217
|
paragraph_count: number;
|
|
218
218
|
paragraph_max_words: number;
|
|
219
219
|
}
|
|
220
|
+
/** Protected evidence copied from the archived outline card at archive time. */
|
|
221
|
+
interface ArchivedCardSnapshot {
|
|
222
|
+
title: string;
|
|
223
|
+
scene_type: SceneType;
|
|
224
|
+
target_words: [number, number];
|
|
225
|
+
cast: string[];
|
|
226
|
+
goal: string;
|
|
227
|
+
conflict: string;
|
|
228
|
+
hook: string;
|
|
229
|
+
notes: string;
|
|
230
|
+
archived_at: string | null;
|
|
231
|
+
}
|
|
220
232
|
/** Derived chapter row kept in `state/chapters.yaml`. */
|
|
221
233
|
interface ChapterRecord {
|
|
222
234
|
num: number;
|
|
@@ -239,6 +251,10 @@ interface ChapterRecord {
|
|
|
239
251
|
assigned_ids?: Record<string, string>;
|
|
240
252
|
/** Digest of the archive request that produced this row. */
|
|
241
253
|
archive_digest?: string;
|
|
254
|
+
/** Immutable card fields written by the archive transaction, not by amend. */
|
|
255
|
+
archive_card?: ArchivedCardSnapshot;
|
|
256
|
+
/** Canonical digest of archive_card; v1-prefixed like archive_digest. */
|
|
257
|
+
archive_card_digest?: string;
|
|
242
258
|
}
|
|
243
259
|
/** Summary block the model supplies with a draft and the engine persists. */
|
|
244
260
|
interface ChapterSummary {
|
|
@@ -760,7 +776,7 @@ interface BookReport {
|
|
|
760
776
|
target: number | null;
|
|
761
777
|
words: number;
|
|
762
778
|
average_words: number;
|
|
763
|
-
percent: number;
|
|
779
|
+
percent: number | null;
|
|
764
780
|
remaining_words: number | null;
|
|
765
781
|
remaining_words_min: number | null;
|
|
766
782
|
remaining_words_average: number | null;
|
|
@@ -825,6 +841,7 @@ interface BookReport {
|
|
|
825
841
|
id: string;
|
|
826
842
|
average: number;
|
|
827
843
|
samples: number;
|
|
844
|
+
max: number;
|
|
828
845
|
}>;
|
|
829
846
|
};
|
|
830
847
|
/** Per-chapter effort survives archive (pipeline rounds are reset). */
|
|
@@ -1319,9 +1336,17 @@ interface Rulepack {
|
|
|
1319
1336
|
words_per_chapter: [number, number];
|
|
1320
1337
|
dialogue_ratio: [number, number];
|
|
1321
1338
|
}>;
|
|
1322
|
-
/** Genre guides
|
|
1339
|
+
/** Genre guides plus optional advisory-only threshold profiles. */
|
|
1323
1340
|
genres: Record<Genre, {
|
|
1324
1341
|
note: string;
|
|
1342
|
+
profile?: {
|
|
1343
|
+
period_density?: {
|
|
1344
|
+
min: number;
|
|
1345
|
+
max: number;
|
|
1346
|
+
};
|
|
1347
|
+
water_words?: number;
|
|
1348
|
+
pleasure_density?: number;
|
|
1349
|
+
};
|
|
1325
1350
|
}>;
|
|
1326
1351
|
crosschapter: {
|
|
1327
1352
|
duplicate_similarity: number;
|
|
@@ -1519,7 +1544,7 @@ interface PanelBookData {
|
|
|
1519
1544
|
average_words: number;
|
|
1520
1545
|
remaining_words: number | null;
|
|
1521
1546
|
remaining_words_basis: 'actual_average' | 'minimum_target' | 'none';
|
|
1522
|
-
percent: number;
|
|
1547
|
+
percent: number | null;
|
|
1523
1548
|
};
|
|
1524
1549
|
current: {
|
|
1525
1550
|
card: PanelCardData | null;
|
|
@@ -1567,7 +1592,7 @@ interface PanelBookData {
|
|
|
1567
1592
|
median: number;
|
|
1568
1593
|
min: number;
|
|
1569
1594
|
max: number;
|
|
1570
|
-
last_ten_average: number;
|
|
1595
|
+
last_ten_average: number | null;
|
|
1571
1596
|
trend: number | null;
|
|
1572
1597
|
trend_basis: BookReport['quality']['trend_basis'];
|
|
1573
1598
|
samples: number;
|
|
@@ -1602,7 +1627,7 @@ interface PanelDraft {
|
|
|
1602
1627
|
num: number;
|
|
1603
1628
|
title: string;
|
|
1604
1629
|
wordCount: number;
|
|
1605
|
-
score: number;
|
|
1630
|
+
score: number | null;
|
|
1606
1631
|
status: 'draft' | 'blocked';
|
|
1607
1632
|
details: string;
|
|
1608
1633
|
}
|
|
@@ -1651,6 +1676,7 @@ interface PanelSnapshot {
|
|
|
1651
1676
|
book?: PanelBook;
|
|
1652
1677
|
quality?: {
|
|
1653
1678
|
averageScore: number;
|
|
1679
|
+
last_ten_average?: number | null;
|
|
1654
1680
|
scores: number[];
|
|
1655
1681
|
trend: number | null;
|
|
1656
1682
|
trend_basis?: 'last_five_vs_previous_five' | 'insufficient_samples' | 'insufficient_history';
|
|
@@ -1767,6 +1793,7 @@ interface PanelSummaryDto {
|
|
|
1767
1793
|
book?: PanelBook;
|
|
1768
1794
|
quality?: {
|
|
1769
1795
|
averageScore: number;
|
|
1796
|
+
last_ten_average?: number | null;
|
|
1770
1797
|
scores: number[];
|
|
1771
1798
|
trend: number | null;
|
|
1772
1799
|
trend_basis?: 'last_five_vs_previous_five' | 'insufficient_samples' | 'insufficient_history';
|
|
@@ -1811,7 +1838,7 @@ interface PanelChapterRow {
|
|
|
1811
1838
|
num: number;
|
|
1812
1839
|
title: string;
|
|
1813
1840
|
wordCount: number;
|
|
1814
|
-
score: number;
|
|
1841
|
+
score: number | null;
|
|
1815
1842
|
stage: Stage;
|
|
1816
1843
|
status: 'passed' | 'blocked' | 'draft';
|
|
1817
1844
|
/** One-line summary shown when the row is expanded. */
|
|
@@ -1860,12 +1887,25 @@ interface PanelMissing {
|
|
|
1860
1887
|
reason: 'missing' | 'not-project' | 'damaged' | 'not_registered' | 'unreadable' | 'busy';
|
|
1861
1888
|
hint: string;
|
|
1862
1889
|
}
|
|
1890
|
+
/** Additive v7 sections; the v6 bundle stays unchanged for old tabs. */
|
|
1891
|
+
type PanelSectionName = 'overview' | 'chapters' | 'characters' | 'foreshadows' | 'timeline' | 'relationships' | 'worldbook' | 'quality' | 'quality_detail' | 'health' | 'chapter_detail';
|
|
1892
|
+
interface PanelSectionMeta {
|
|
1893
|
+
payload_version: 7;
|
|
1894
|
+
section: PanelSectionName;
|
|
1895
|
+
items: unknown;
|
|
1896
|
+
total: number;
|
|
1897
|
+
returned: number;
|
|
1898
|
+
truncated: boolean;
|
|
1899
|
+
next_cursor: string | null;
|
|
1900
|
+
updated_at: string;
|
|
1901
|
+
etag: string;
|
|
1902
|
+
}
|
|
1863
1903
|
interface PanelBundle {
|
|
1864
1904
|
projects: PanelProjectOption[];
|
|
1865
1905
|
selection: PanelSelection;
|
|
1866
1906
|
summary?: PanelSummaryDto;
|
|
1867
1907
|
chapters?: PanelChaptersDto;
|
|
1868
|
-
|
|
1908
|
+
etag?: string;
|
|
1869
1909
|
resume?: {
|
|
1870
1910
|
text: string;
|
|
1871
1911
|
};
|
|
@@ -1996,6 +2036,15 @@ type EngineEvent = {
|
|
|
1996
2036
|
files: number;
|
|
1997
2037
|
};
|
|
1998
2038
|
};
|
|
2039
|
+
interface PanelSectionQuery {
|
|
2040
|
+
search?: string;
|
|
2041
|
+
status?: string;
|
|
2042
|
+
scene?: string;
|
|
2043
|
+
sort?: string;
|
|
2044
|
+
cursor?: string;
|
|
2045
|
+
limit?: number;
|
|
2046
|
+
chapter?: number;
|
|
2047
|
+
}
|
|
1999
2048
|
interface InitProjectInput {
|
|
2000
2049
|
title: string;
|
|
2001
2050
|
genre: NovelProject['genre'];
|
|
@@ -2214,6 +2263,10 @@ declare class EngineService {
|
|
|
2214
2263
|
private readonly briefContextCache;
|
|
2215
2264
|
/** The 15s panel poll reuses the heavy book projection until revision/damage changes. */
|
|
2216
2265
|
private readonly panelCache;
|
|
2266
|
+
/** Section-level cache; writes bump revision, so a stale entry cannot survive a commit. */
|
|
2267
|
+
private readonly sectionCache;
|
|
2268
|
+
private readonly journalCache;
|
|
2269
|
+
private readonly reviewKeyCache;
|
|
2217
2270
|
private readonly briefs;
|
|
2218
2271
|
private readonly now;
|
|
2219
2272
|
private readonly metadataMutex;
|
|
@@ -2464,6 +2517,21 @@ declare class EngineService {
|
|
|
2464
2517
|
panelGates(input?: {
|
|
2465
2518
|
root?: string;
|
|
2466
2519
|
}): Promise<PanelGatesDto>;
|
|
2520
|
+
/**
|
|
2521
|
+
* Additive v7 section read model. Catalog sections reuse the Snapshot; only
|
|
2522
|
+
* the quality section reads archived reviews, and only chapter/quality
|
|
2523
|
+
* detail reads manuscripts or check files. Every section is byte-capped.
|
|
2524
|
+
*/
|
|
2525
|
+
panelSection(input?: {
|
|
2526
|
+
root?: string;
|
|
2527
|
+
section: PanelSectionName;
|
|
2528
|
+
query?: PanelSectionQuery;
|
|
2529
|
+
}): Promise<PanelSectionMeta>;
|
|
2530
|
+
private panelSectionPage;
|
|
2531
|
+
private panelSectionReturned;
|
|
2532
|
+
/** WP3.7 free-text caps before the byte budget; both report truncation. */
|
|
2533
|
+
private panelSectionClip;
|
|
2534
|
+
private panelSectionBudget;
|
|
2467
2535
|
/**
|
|
2468
2536
|
* Build the read-only panel payload. The query root is accepted only when it
|
|
2469
2537
|
* is registered, active or the configured root; arbitrary paths never reach
|
|
@@ -2471,6 +2539,7 @@ declare class EngineService {
|
|
|
2471
2539
|
*/
|
|
2472
2540
|
panelBundle(input?: {
|
|
2473
2541
|
root?: string;
|
|
2542
|
+
lean?: boolean;
|
|
2474
2543
|
}): Promise<PanelBundle>;
|
|
2475
2544
|
/** Read-only resume text shared with the panel copy button. */
|
|
2476
2545
|
resumePrompt(input?: {
|
|
@@ -2500,6 +2569,8 @@ declare class EngineService {
|
|
|
2500
2569
|
worldbookEntries: number;
|
|
2501
2570
|
strictOutline: boolean;
|
|
2502
2571
|
targetChapters: number | null;
|
|
2572
|
+
state_errors: StateError[];
|
|
2573
|
+
partial: boolean;
|
|
2503
2574
|
}>;
|
|
2504
2575
|
private registry;
|
|
2505
2576
|
/** List known projects with a cheap directory state for the panel/command. */
|
|
@@ -2652,6 +2723,8 @@ declare class EngineService {
|
|
|
2652
2723
|
*/
|
|
2653
2724
|
private assertArchiveIndexReadable;
|
|
2654
2725
|
private bookStatus;
|
|
2726
|
+
private panelReviewKey;
|
|
2727
|
+
private panelJournalIdentity;
|
|
2655
2728
|
private panelSnapshot;
|
|
2656
2729
|
/**
|
|
2657
2730
|
* The archive stage can be left by a direct revision (the 0.2.3 workflow) or
|
|
@@ -2739,6 +2812,8 @@ declare const PANEL_ID = "novel-workshop";
|
|
|
2739
2812
|
declare const PANEL_ROUTE = "/api/novel-write-engine/panel";
|
|
2740
2813
|
declare const SKILL_NAME = "novel-write-engine";
|
|
2741
2814
|
declare const REMOTE_VERSION = 6;
|
|
2815
|
+
/** User-visible panel/tutorial version; keep in sync with package.json. */
|
|
2816
|
+
declare const PANEL_VERSION = "0.2.10";
|
|
2742
2817
|
/** The panel is a recent-history view; the wire payload and UI use one cap. */
|
|
2743
2818
|
declare const PANEL_CHAPTER_LIMIT = 30;
|
|
2744
2819
|
/** Project-relative locations. Every write goes through these constants. */
|
|
@@ -2871,4 +2946,4 @@ declare const Config: Schema<Config>;
|
|
|
2871
2946
|
* created lazily per project root.
|
|
2872
2947
|
*/
|
|
2873
2948
|
declare function apply(ctx: Context, config: Config): void;
|
|
2874
|
-
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, ChapterProgress, ChapterProgressInput, 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, projectChapterProgress, projectChapters, projectGates, projectSummary, renderBlurb, renderCover, renderEpubChapter, renderMarkdown, renderPlainText, renderProposal, reviewFile, reviewHistoryFile, verifyReference };
|
|
2949
|
+
export { ARCHIVE_DIGESTS_FILE, AdviceReport, ArchiveHandoff, ArchivedCardSnapshot, AuditRow, BACKUP_DIR, BRIEF_RECEIPTS_FILE, BlockingItem, BookPlan, BookReport, BriefDocument, BriefLibrary, BriefReceipt, BriefReceiptsDocument, BriefStage, CHAPTERS_DIR, CHECK_DIR, CORE_TOOLS, ChapterCastMember, ChapterPlanInput, ChapterProgress, ChapterProgressInput, 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, PANEL_VERSION, PHASE_STRIP, PLAN_DIR, PLATFORMS, PLUGIN_NAME, PROJECT_FILE, PanelBook, PanelBundle, PanelChapterRow, PanelChaptersDto, PanelDraft, PanelGatesDto, PanelMissing, PanelProjectOption, PanelSectionMeta, PanelSectionName, 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, projectChapterProgress, projectChapters, projectGates, projectSummary, renderBlurb, renderCover, renderEpubChapter, renderMarkdown, renderPlainText, renderProposal, reviewFile, reviewHistoryFile, verifyReference };
|