dsh-novel-write-engine 0.2.5 → 0.2.7
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 +53 -5
- package/README.md +404 -983
- package/briefs/P2.md +1 -1
- package/briefs/P3.md +2 -0
- package/briefs/P6.md +1 -1
- package/briefs/P8.md +5 -5
- package/lib/client.js +134 -17
- package/lib/index.d.ts +176 -2
- package/lib/index.js +888 -268
- package/lib/types/client/dto.d.ts +13 -0
- package/lib/types/client/viewmodel.d.ts +24 -1
- package/lib/types/constants.d.ts +1 -1
- package/lib/types/panel-contract.d.ts +125 -0
- package/lib/types/types.d.ts +15 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -192,7 +192,7 @@ interface CheckDocument {
|
|
|
192
192
|
verdict: 'pass' | 'fail';
|
|
193
193
|
}
|
|
194
194
|
/** Every persisted document whose damage status/panel can report. */
|
|
195
|
-
type StateErrorCode = 'PROJECT_UNREADABLE' | 'PLAN_UNREADABLE' | 'WORLD_PLAN_UNREADABLE' | 'REVIEW_UNREADABLE' | 'CHECK_UNREADABLE' | 'CHAPTERS_UNREADABLE' | 'CHARACTERS_UNREADABLE' | 'WORLD_UNREADABLE' | 'LOCKS_UNREADABLE' | 'TIMELINE_UNREADABLE' | 'FORESHADOWS_UNREADABLE' | 'RELATIONSHIPS_UNREADABLE' | 'HANDOFF_UNREADABLE' | 'OUTLINE_UNREADABLE' | 'WORLDBOOK_UNREADABLE';
|
|
195
|
+
type StateErrorCode = 'PROJECT_UNREADABLE' | 'PIPELINE_UNREADABLE' | 'PLAN_UNREADABLE' | 'WORLD_PLAN_UNREADABLE' | 'REVIEW_UNREADABLE' | 'CHECK_UNREADABLE' | 'CHAPTERS_UNREADABLE' | 'CHARACTERS_UNREADABLE' | 'WORLD_UNREADABLE' | 'LOCKS_UNREADABLE' | 'TIMELINE_UNREADABLE' | 'FORESHADOWS_UNREADABLE' | 'RELATIONSHIPS_UNREADABLE' | 'HANDOFF_UNREADABLE' | 'OUTLINE_UNREADABLE' | 'WORLDBOOK_UNREADABLE';
|
|
196
196
|
/** A state document that exists but cannot be read safely. */
|
|
197
197
|
interface StateError {
|
|
198
198
|
path: string;
|
|
@@ -263,6 +263,12 @@ interface ChapterSummary {
|
|
|
263
263
|
abilities: string[];
|
|
264
264
|
artifacts: string[];
|
|
265
265
|
};
|
|
266
|
+
/** Optional P3/P5 verbatim manuscript anchors for readable entity names. */
|
|
267
|
+
new_element_anchors?: {
|
|
268
|
+
locations?: Record<string, string[]>;
|
|
269
|
+
abilities?: Record<string, string[]>;
|
|
270
|
+
artifacts?: Record<string, string[]>;
|
|
271
|
+
};
|
|
266
272
|
resource_changes: Array<{
|
|
267
273
|
character: string;
|
|
268
274
|
resource: string;
|
|
@@ -431,6 +437,8 @@ interface WorldDocument {
|
|
|
431
437
|
schema_version: 1;
|
|
432
438
|
locations: Array<{
|
|
433
439
|
name: string;
|
|
440
|
+
/** 0.2.6 additive: readable-name anchors; old ledgers omit this. */
|
|
441
|
+
anchors?: string[];
|
|
434
442
|
first_appearance: number;
|
|
435
443
|
locked: boolean;
|
|
436
444
|
description: string;
|
|
@@ -793,6 +801,12 @@ interface BookReport {
|
|
|
793
801
|
glossary: number;
|
|
794
802
|
backstory: number;
|
|
795
803
|
facts?: number;
|
|
804
|
+
/** 0.2.6 persisted world-ledger anchors, capped for report payloads. */
|
|
805
|
+
anchors?: Array<{
|
|
806
|
+
name: string;
|
|
807
|
+
kind: string;
|
|
808
|
+
anchors: string[];
|
|
809
|
+
}>;
|
|
796
810
|
};
|
|
797
811
|
quality: {
|
|
798
812
|
average: number;
|
|
@@ -1137,6 +1151,23 @@ interface DiffReport {
|
|
|
1137
1151
|
/** Export capabilities; the last three are book-planning deliverables. */
|
|
1138
1152
|
type ExportKind = 'md' | 'txt' | 'epub' | 'outline' | 'worldbook' | 'proposal';
|
|
1139
1153
|
type SemanticItemState = 'pass' | 'fail' | 'missing' | 'invalid' | 'not_found' | 'too_short' | 'duplicate' | 'overlap' | 'same_sentence' | 'boundary';
|
|
1154
|
+
type SemanticConflictKind = 'duplicate' | 'same_sentence' | 'interval_overlap';
|
|
1155
|
+
interface SemanticConflict {
|
|
1156
|
+
kind: SemanticConflictKind;
|
|
1157
|
+
other_id: string;
|
|
1158
|
+
/** Only for interval_overlap; a verbatim excerpt, capped at 120 characters. */
|
|
1159
|
+
overlap_text?: string;
|
|
1160
|
+
overlap_chars?: number;
|
|
1161
|
+
/** overlap_chars / min(quoteA, quoteB), 0..1. */
|
|
1162
|
+
overlap_ratio?: number;
|
|
1163
|
+
paragraphs?: number[];
|
|
1164
|
+
/** Only for same_sentence. */
|
|
1165
|
+
sentence?: {
|
|
1166
|
+
id: number;
|
|
1167
|
+
text: string;
|
|
1168
|
+
paragraph: number;
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1140
1171
|
interface SemanticNearest {
|
|
1141
1172
|
paragraph: number;
|
|
1142
1173
|
quote: string;
|
|
@@ -1148,7 +1179,9 @@ interface SemanticItemResult {
|
|
|
1148
1179
|
quote?: string;
|
|
1149
1180
|
detail?: string;
|
|
1150
1181
|
nearest?: SemanticNearest;
|
|
1182
|
+
/** Kept for older adapters; the full pair is in `conflicts`. */
|
|
1151
1183
|
conflict_with?: string;
|
|
1184
|
+
conflicts?: SemanticConflict[];
|
|
1152
1185
|
}
|
|
1153
1186
|
/** One blacklisted word. */
|
|
1154
1187
|
interface TermEntry {
|
|
@@ -1404,6 +1437,130 @@ declare function applicableGates(input: GateInput): GateId[];
|
|
|
1404
1437
|
declare function gateName(id: GateId): string;
|
|
1405
1438
|
/** Which brief stage an operation requires; `null` means no brief gate. */
|
|
1406
1439
|
declare function briefStageFor(operation: GateInput['operation'], stage: Stage): GateInput['briefStage'];
|
|
1440
|
+
/** v6 read-only book data. All windows are explicit in the field names. */
|
|
1441
|
+
interface PanelCardData {
|
|
1442
|
+
num: number;
|
|
1443
|
+
title: string;
|
|
1444
|
+
scene_type: string;
|
|
1445
|
+
goal: string;
|
|
1446
|
+
conflict: string;
|
|
1447
|
+
hook: string;
|
|
1448
|
+
cast: string[];
|
|
1449
|
+
target_words: [number, number];
|
|
1450
|
+
status: 'planned' | 'archived';
|
|
1451
|
+
}
|
|
1452
|
+
interface PanelWorldEntry {
|
|
1453
|
+
name: string;
|
|
1454
|
+
description: string;
|
|
1455
|
+
anchors?: string[];
|
|
1456
|
+
}
|
|
1457
|
+
interface PanelBookData {
|
|
1458
|
+
identity: {
|
|
1459
|
+
author: string;
|
|
1460
|
+
description: string;
|
|
1461
|
+
created_at: string;
|
|
1462
|
+
targets: {
|
|
1463
|
+
words_per_chapter: [number, number];
|
|
1464
|
+
total_chapters: number | null;
|
|
1465
|
+
dialogue_ratio: [number, number];
|
|
1466
|
+
};
|
|
1467
|
+
};
|
|
1468
|
+
blueprint: {
|
|
1469
|
+
premise: string;
|
|
1470
|
+
logline: string;
|
|
1471
|
+
themes: string[];
|
|
1472
|
+
tone: string;
|
|
1473
|
+
pov: string;
|
|
1474
|
+
audience: string;
|
|
1475
|
+
selling_points: string[];
|
|
1476
|
+
ending: string;
|
|
1477
|
+
};
|
|
1478
|
+
progress: {
|
|
1479
|
+
archived: number;
|
|
1480
|
+
target: number | null;
|
|
1481
|
+
words_archived: number;
|
|
1482
|
+
words_with_draft: number;
|
|
1483
|
+
average_words: number;
|
|
1484
|
+
remaining_words: number | null;
|
|
1485
|
+
remaining_words_basis: 'actual_average' | 'minimum_target' | 'none';
|
|
1486
|
+
percent: number;
|
|
1487
|
+
};
|
|
1488
|
+
current: {
|
|
1489
|
+
card: PanelCardData | null;
|
|
1490
|
+
chapter: number;
|
|
1491
|
+
stage: Stage;
|
|
1492
|
+
rounds: {
|
|
1493
|
+
review: number;
|
|
1494
|
+
revise: number;
|
|
1495
|
+
check: number;
|
|
1496
|
+
};
|
|
1497
|
+
manuscript_hash: string | null;
|
|
1498
|
+
metrics: WordMetrics | null;
|
|
1499
|
+
};
|
|
1500
|
+
worldbook: {
|
|
1501
|
+
counts: Omit<BookReport['worldbook'], 'anchors'>;
|
|
1502
|
+
locations: PanelWorldEntry[];
|
|
1503
|
+
factions: PanelWorldEntry[];
|
|
1504
|
+
rules: PanelWorldEntry[];
|
|
1505
|
+
facts: Array<{
|
|
1506
|
+
alias: string;
|
|
1507
|
+
value: number;
|
|
1508
|
+
unit: string;
|
|
1509
|
+
}>;
|
|
1510
|
+
};
|
|
1511
|
+
cast: {
|
|
1512
|
+
total: number;
|
|
1513
|
+
top: Array<{
|
|
1514
|
+
name: string;
|
|
1515
|
+
role: string;
|
|
1516
|
+
appearances: number;
|
|
1517
|
+
last_seen: number;
|
|
1518
|
+
}>;
|
|
1519
|
+
};
|
|
1520
|
+
relationships: {
|
|
1521
|
+
total: number;
|
|
1522
|
+
types: Record<string, number>;
|
|
1523
|
+
};
|
|
1524
|
+
foreshadows: BookReport['foreshadows'];
|
|
1525
|
+
timeline: BookReport['timeline'];
|
|
1526
|
+
outline: {
|
|
1527
|
+
drift: BookReport['outline']['drift'];
|
|
1528
|
+
};
|
|
1529
|
+
quality: {
|
|
1530
|
+
average: number;
|
|
1531
|
+
median: number;
|
|
1532
|
+
min: number;
|
|
1533
|
+
max: number;
|
|
1534
|
+
last_ten_average: number;
|
|
1535
|
+
trend: number | null;
|
|
1536
|
+
trend_basis: BookReport['quality']['trend_basis'];
|
|
1537
|
+
samples: number;
|
|
1538
|
+
attempts: number;
|
|
1539
|
+
dimensions: BookReport['quality']['dimensions'];
|
|
1540
|
+
};
|
|
1541
|
+
pacing: BookReport['pacing'];
|
|
1542
|
+
effort: BookReport['effort'];
|
|
1543
|
+
health: {
|
|
1544
|
+
state_errors: Array<{
|
|
1545
|
+
path: string;
|
|
1546
|
+
code: string;
|
|
1547
|
+
message: string;
|
|
1548
|
+
}>;
|
|
1549
|
+
outline: {
|
|
1550
|
+
present: boolean;
|
|
1551
|
+
error: string | null;
|
|
1552
|
+
};
|
|
1553
|
+
worldbook: {
|
|
1554
|
+
present: boolean;
|
|
1555
|
+
error: string | null;
|
|
1556
|
+
};
|
|
1557
|
+
pending: {
|
|
1558
|
+
state: string;
|
|
1559
|
+
txid: string;
|
|
1560
|
+
detail: string;
|
|
1561
|
+
} | null;
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1407
1564
|
/** The shared read model: everything the panel, status and commands render. */
|
|
1408
1565
|
interface PanelDraft {
|
|
1409
1566
|
num: number;
|
|
@@ -1462,6 +1619,7 @@ interface PanelSnapshot {
|
|
|
1462
1619
|
ok: boolean;
|
|
1463
1620
|
blocking: number;
|
|
1464
1621
|
stateErrors: number;
|
|
1622
|
+
pending?: boolean;
|
|
1465
1623
|
};
|
|
1466
1624
|
activity?: Array<{
|
|
1467
1625
|
at: string;
|
|
@@ -1488,6 +1646,8 @@ interface PanelSnapshot {
|
|
|
1488
1646
|
txid: string;
|
|
1489
1647
|
detail: string;
|
|
1490
1648
|
};
|
|
1649
|
+
/** v6 read-only book data; v5 payloads omit it. */
|
|
1650
|
+
bookData?: PanelBookData;
|
|
1491
1651
|
}
|
|
1492
1652
|
interface PanelBook {
|
|
1493
1653
|
premise: string;
|
|
@@ -1569,6 +1729,7 @@ interface PanelSummaryDto {
|
|
|
1569
1729
|
ok: boolean;
|
|
1570
1730
|
blocking: number;
|
|
1571
1731
|
stateErrors: number;
|
|
1732
|
+
pending?: boolean;
|
|
1572
1733
|
};
|
|
1573
1734
|
activity?: Array<{
|
|
1574
1735
|
at: string;
|
|
@@ -1595,6 +1756,8 @@ interface PanelSummaryDto {
|
|
|
1595
1756
|
txid: string;
|
|
1596
1757
|
detail: string;
|
|
1597
1758
|
};
|
|
1759
|
+
/** v6 read-only book data; v5 payloads omit it. */
|
|
1760
|
+
bookData?: PanelBookData;
|
|
1598
1761
|
}
|
|
1599
1762
|
interface PanelChapterRow {
|
|
1600
1763
|
num: number;
|
|
@@ -1605,6 +1768,15 @@ interface PanelChapterRow {
|
|
|
1605
1768
|
status: 'passed' | 'blocked' | 'draft';
|
|
1606
1769
|
/** One-line summary shown when the row is expanded. */
|
|
1607
1770
|
details: string;
|
|
1771
|
+
sceneType?: string;
|
|
1772
|
+
dialogueRatio?: number;
|
|
1773
|
+
hookStrength?: number;
|
|
1774
|
+
finalCheck?: 'pass' | 'fail' | null;
|
|
1775
|
+
reviews?: number;
|
|
1776
|
+
revisions?: number;
|
|
1777
|
+
checks?: number;
|
|
1778
|
+
rollbacks?: number;
|
|
1779
|
+
archivedAt?: string | null;
|
|
1608
1780
|
}
|
|
1609
1781
|
interface PanelChaptersDto {
|
|
1610
1782
|
schemaVersion: number;
|
|
@@ -1977,6 +2149,8 @@ declare class EngineService {
|
|
|
1977
2149
|
private readonly exportArtifactEpoch;
|
|
1978
2150
|
/** Status, panel and gates ask for the same stage context repeatedly. */
|
|
1979
2151
|
private readonly briefContextCache;
|
|
2152
|
+
/** The 15s panel poll reuses the heavy book projection until revision/damage changes. */
|
|
2153
|
+
private readonly panelCache;
|
|
1980
2154
|
private readonly briefs;
|
|
1981
2155
|
private readonly now;
|
|
1982
2156
|
private readonly metadataMutex;
|
|
@@ -2498,7 +2672,7 @@ declare const PLUGIN_NAME = "dsh-novel-write-engine";
|
|
|
2498
2672
|
declare const PANEL_ID = "novel-workshop";
|
|
2499
2673
|
declare const PANEL_ROUTE = "/api/novel-write-engine/panel";
|
|
2500
2674
|
declare const SKILL_NAME = "novel-write-engine";
|
|
2501
|
-
declare const REMOTE_VERSION =
|
|
2675
|
+
declare const REMOTE_VERSION = 6;
|
|
2502
2676
|
/** The panel is a recent-history view; the wire payload and UI use one cap. */
|
|
2503
2677
|
declare const PANEL_CHAPTER_LIMIT = 30;
|
|
2504
2678
|
/** Project-relative locations. Every write goes through these constants. */
|