Procházet zdrojové kódy

feat: add event graph, anti-drift, and quality system types

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nonvioce před 6 měsíci
rodič
revize
098b9a67fb
1 změnil soubory, kde provedl 93 přidání a 0 odebrání
  1. 93 0
      src/app/lib/novel-types.ts

+ 93 - 0
src/app/lib/novel-types.ts

@@ -126,3 +126,96 @@ export const DEFAULT_LORE_FILES = [
   'economy.md',
   'characters_lore.md',
 ] as const;
+
+// ─── Event Graph (Phase 1) ────────────────────────────────────────
+
+export interface EventNode {
+  id: string;
+  title: string;
+  description: string;
+  timeLabel: string;
+  location: string;
+  characters: string[];
+  eventType: 'main' | 'sub' | 'milestone' | 'flashback' | 'foreshadow';
+  chronologicalOrder: number;
+  narrativeOrder: number;
+  parentEventIds: string[];
+  tags: string[];
+  status: 'pending' | 'written' | 'revised';
+  chapterIndex?: number;
+}
+
+export interface EventEdge {
+  sourceId: string;
+  targetId: string;
+  relationType: 'causal' | 'temporal' | 'parallel' | 'contrast';
+}
+
+export interface ChapterAllocation {
+  chapterIndex: number;
+  eventIds: string[];
+  narrativeMode: 'linear' | 'flashback' | 'flashforward' | 'mixed';
+}
+
+// ─── Anti-Drift System (Phase 0) ─────────────────────────────────
+
+export interface IronRule {
+  id: string;
+  rule: string;
+  category: 'character' | 'worldbuilding' | 'plot' | 'style';
+}
+
+export interface StyleAnchorSample {
+  type: 'positive' | 'negative';
+  content: string;
+  annotation: string;
+}
+
+export interface StyleAnchor {
+  positiveSamples: StyleAnchorSample[];
+  negativeSamples: StyleAnchorSample[];
+  bannedPhrases: string[];
+  bannedPatterns: string[];
+}
+
+// ─── Workflow State (Phase 0) ────────────────────────────────────
+
+export type NovelPhase = 'phase0' | 'phase1' | 'phase2' | 'phase3';
+
+export interface WorkflowState {
+  phase: NovelPhase;
+  totalChapters: number;
+  lastChapterIndex: number;
+  lastSummarizedChapter: number;
+  lastAuditedChapter: number;
+  pendingEventIds: string[];
+  milestoneAuditHistory: MilestoneAuditResult[];
+}
+
+// ─── Quality System (Phase 2) ────────────────────────────────────
+
+export interface ReaderFeedback {
+  chapterRange: string;
+  pace: number;
+  excitementDensity: number;
+  emotionalEngagement: number;
+  confusion: number;
+  suggestions: string;
+}
+
+export interface MilestoneAuditResult {
+  chapterRange: string;
+  characterDrift: { severity: 'ok' | 'warning' | 'issue'; detail: string };
+  settingDrift: { severity: 'ok' | 'warning' | 'issue'; detail: string };
+  styleDrift: { severity: 'ok' | 'warning' | 'issue'; detail: string };
+  foreshadowingGap: { severity: 'ok' | 'warning' | 'issue'; detail: string };
+  overallAssessment: string;
+}
+
+export interface CascadeCheckResult {
+  affectedChapterIndices: number[];
+  conflicts: { chapterIndex: number; eventId: string; description: string }[];
+  severity: 'none' | 'minor' | 'major';
+  recommendation: string;
+}
+