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.
@@ -1,3 +1,4 @@
1
+ import type { PanelBookData } from '../panel-contract.js';
1
2
  /** Wire DTOs of the panel route. Versioned so a stale tab can say "refresh". */
2
3
  export interface PhaseDto {
3
4
  id: string;
@@ -84,6 +85,7 @@ export interface SummaryDto {
84
85
  ok: boolean;
85
86
  blocking: number;
86
87
  stateErrors: number;
88
+ pending?: boolean;
87
89
  };
88
90
  activity?: Array<{
89
91
  at: string;
@@ -108,6 +110,8 @@ export interface SummaryDto {
108
110
  txid: string;
109
111
  detail: string;
110
112
  };
113
+ /** v6 read-only book data; v5 payloads omit it and are rejected by the client. */
114
+ bookData?: PanelBookData;
111
115
  }
112
116
  export interface ChapterRowDto {
113
117
  num: number;
@@ -117,6 +121,15 @@ export interface ChapterRowDto {
117
121
  stage: string;
118
122
  status: 'passed' | 'blocked' | 'draft';
119
123
  details?: string;
124
+ sceneType?: string;
125
+ dialogueRatio?: number;
126
+ hookStrength?: number;
127
+ finalCheck?: 'pass' | 'fail' | null;
128
+ reviews?: number;
129
+ revisions?: number;
130
+ checks?: number;
131
+ rollbacks?: number;
132
+ archivedAt?: string | null;
120
133
  }
121
134
  export interface ChaptersDto {
122
135
  schemaVersion: number;
@@ -1,4 +1,5 @@
1
1
  import type { PanelPayloadDto } from './dto.js';
2
+ import type { PanelBookData } from '../panel-contract.js';
2
3
  /** One human-facing progress step. */
3
4
  export interface PanelPhase {
4
5
  id: string;
@@ -19,6 +20,15 @@ export interface PanelChapter {
19
20
  tone: 'ok' | 'bad' | 'muted';
20
21
  details: string;
21
22
  stageLabel: string;
23
+ sceneType: string;
24
+ dialogueRatio: number | null;
25
+ hookStrength: number | null;
26
+ finalCheck: 'pass' | 'fail' | null;
27
+ reviews: number;
28
+ revisions: number;
29
+ checks: number;
30
+ rollbacks: number;
31
+ archivedAt: string | null;
22
32
  }
23
33
  export interface PanelProject {
24
34
  root: string;
@@ -79,6 +89,7 @@ export interface PanelView {
79
89
  present: boolean;
80
90
  strict: boolean;
81
91
  premise: string;
92
+ logline: string;
82
93
  target: number | null;
83
94
  planned: number;
84
95
  outlineTotal: number;
@@ -106,6 +117,15 @@ export interface PanelView {
106
117
  };
107
118
  quality: {
108
119
  averageScore: number;
120
+ lastTenAverage: number;
121
+ bookMedian: number;
122
+ bookMin: number;
123
+ bookMax: number;
124
+ dimensions: Array<{
125
+ id: string;
126
+ average: number;
127
+ samples: number;
128
+ }>;
109
129
  scores: number[];
110
130
  trend: number | null;
111
131
  trendText: string;
@@ -116,6 +136,7 @@ export interface PanelView {
116
136
  ok: boolean;
117
137
  blocking: number;
118
138
  stateErrors: number;
139
+ pending: boolean;
119
140
  };
120
141
  activity: Array<{
121
142
  at: string;
@@ -142,6 +163,8 @@ export interface PanelView {
142
163
  txid: string;
143
164
  detail: string;
144
165
  } | null;
166
+ /** v6 book data; null on a payload that predates it. */
167
+ bookData: PanelBookData | null;
145
168
  nextTitle: string;
146
169
  nextDetail: string;
147
170
  nextTool: string;
@@ -150,7 +173,7 @@ export interface PanelView {
150
173
  revision: string;
151
174
  next: string;
152
175
  }
153
- export declare const PANEL_SCHEMA_VERSION = 5;
176
+ export declare const PANEL_SCHEMA_VERSION = 6;
154
177
  /**
155
178
  * Project the wire payload into strings. Version mismatch wins over everything
156
179
  * else: a stale panel must never render data from another schema as if it were
@@ -4,7 +4,7 @@ export declare const PLUGIN_NAME = "dsh-novel-write-engine";
4
4
  export declare const PANEL_ID = "novel-workshop";
5
5
  export declare const PANEL_ROUTE = "/api/novel-write-engine/panel";
6
6
  export declare const SKILL_NAME = "novel-write-engine";
7
- export declare const REMOTE_VERSION = 5;
7
+ export declare const REMOTE_VERSION = 6;
8
8
  /** The panel is a recent-history view; the wire payload and UI use one cap. */
9
9
  export declare const PANEL_CHAPTER_LIMIT = 30;
10
10
  /** Project-relative locations. Every write goes through these constants. */
@@ -0,0 +1,125 @@
1
+ import type { BookReport, Stage, WordMetrics } from './types.js';
2
+ /** v6 read-only book data. All windows are explicit in the field names. */
3
+ export interface PanelCardData {
4
+ num: number;
5
+ title: string;
6
+ scene_type: string;
7
+ goal: string;
8
+ conflict: string;
9
+ hook: string;
10
+ cast: string[];
11
+ target_words: [number, number];
12
+ status: 'planned' | 'archived';
13
+ }
14
+ export interface PanelWorldEntry {
15
+ name: string;
16
+ description: string;
17
+ anchors?: string[];
18
+ }
19
+ export interface PanelBookData {
20
+ identity: {
21
+ author: string;
22
+ description: string;
23
+ created_at: string;
24
+ targets: {
25
+ words_per_chapter: [number, number];
26
+ total_chapters: number | null;
27
+ dialogue_ratio: [number, number];
28
+ };
29
+ };
30
+ blueprint: {
31
+ premise: string;
32
+ logline: string;
33
+ themes: string[];
34
+ tone: string;
35
+ pov: string;
36
+ audience: string;
37
+ selling_points: string[];
38
+ ending: string;
39
+ };
40
+ progress: {
41
+ archived: number;
42
+ target: number | null;
43
+ words_archived: number;
44
+ words_with_draft: number;
45
+ average_words: number;
46
+ remaining_words: number | null;
47
+ remaining_words_basis: 'actual_average' | 'minimum_target' | 'none';
48
+ percent: number;
49
+ };
50
+ current: {
51
+ card: PanelCardData | null;
52
+ chapter: number;
53
+ stage: Stage;
54
+ rounds: {
55
+ review: number;
56
+ revise: number;
57
+ check: number;
58
+ };
59
+ manuscript_hash: string | null;
60
+ metrics: WordMetrics | null;
61
+ };
62
+ worldbook: {
63
+ counts: Omit<BookReport['worldbook'], 'anchors'>;
64
+ locations: PanelWorldEntry[];
65
+ factions: PanelWorldEntry[];
66
+ rules: PanelWorldEntry[];
67
+ facts: Array<{
68
+ alias: string;
69
+ value: number;
70
+ unit: string;
71
+ }>;
72
+ };
73
+ cast: {
74
+ total: number;
75
+ top: Array<{
76
+ name: string;
77
+ role: string;
78
+ appearances: number;
79
+ last_seen: number;
80
+ }>;
81
+ };
82
+ relationships: {
83
+ total: number;
84
+ types: Record<string, number>;
85
+ };
86
+ foreshadows: BookReport['foreshadows'];
87
+ timeline: BookReport['timeline'];
88
+ outline: {
89
+ drift: BookReport['outline']['drift'];
90
+ };
91
+ quality: {
92
+ average: number;
93
+ median: number;
94
+ min: number;
95
+ max: number;
96
+ last_ten_average: number;
97
+ trend: number | null;
98
+ trend_basis: BookReport['quality']['trend_basis'];
99
+ samples: number;
100
+ attempts: number;
101
+ dimensions: BookReport['quality']['dimensions'];
102
+ };
103
+ pacing: BookReport['pacing'];
104
+ effort: BookReport['effort'];
105
+ health: {
106
+ state_errors: Array<{
107
+ path: string;
108
+ code: string;
109
+ message: string;
110
+ }>;
111
+ outline: {
112
+ present: boolean;
113
+ error: string | null;
114
+ };
115
+ worldbook: {
116
+ present: boolean;
117
+ error: string | null;
118
+ };
119
+ pending: {
120
+ state: string;
121
+ txid: string;
122
+ detail: string;
123
+ } | null;
124
+ };
125
+ }
@@ -192,7 +192,7 @@ export interface CheckDocument {
192
192
  verdict: 'pass' | 'fail';
193
193
  }
194
194
  /** Every persisted document whose damage status/panel can report. */
195
- export 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
+ export 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
  export interface StateError {
198
198
  path: string;
@@ -263,6 +263,12 @@ export 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 @@ export 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 @@ export 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-novel-write-engine",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Novel writing engine for DeepSeek Harness: state machine, gates, rulepacks and ledgers moved from prompts into code.",
5
5
  "keywords": [
6
6
  "dsh-plugin",