# LangGraph State Schema Definition This document defines the shared state object used by the LangGraph orchestration layer. ## 1. Shared State Object (`WikiState`) ```python from typing import List, Optional, Dict, Annotated from pydantic import BaseModel, Field from datetime import datetime class ContentSource(BaseModel): name: str # e.g., "eve-university", "wckg", "esi" url: str content_hash: str extracted_at: datetime class ValidationResult(BaseModel): category: str # "structural", "content", "numerical", "cross-reference" passed: bool score: float # 0.0 to 1.0 feedback: Optional[str] = None details: Dict = {} class PageMetadata(BaseModel): page_type: str # "ship", "module", "mechanic", "guide" source: str source_url: str imported_date: datetime last_updated: datetime last_validated: datetime update_frequency: str validation_score: float categories: List[str] class WikiPage(BaseModel): path: str # e.g., "ships/frigates/condor" title: str content_markdown: str metadata: PageMetadata frontmatter: Dict assets: List[str] # List of local asset paths class WikiState(BaseModel): # Core processing data current_page: Optional[WikiPage] = None proposed_changes: List[WikiPage] = [] # Pipeline tracking sources: List[ContentSource] = [] validation_pipeline_results: List[ValidationResult] = [] # Control flow retry_count: int = 0 max_retries: int = 3 is_approved: bool = False error: Optional[str] = None # Checkpointing metadata thread_id: str checkpoint_id: Optional[str] = None ``` ## 2. Page Type Schemas ### Ship Schema Overlay Extends the numerical validation requirements. ```python class ShipData(BaseModel): type_id: int group: str race: str hull_stats: Dict[str, int] fitting_stats: Dict[str, int] velocity: int skill_requirements: List[Dict[str, int]] ``` ## 3. Storage Strategy - **State Persistence:** Redis (via `RedisSaver` for LangGraph) - **Content Persistence:** Git (Markdown + YAML Frontmatter) - **Asset Persistence:** Local filesystem / S3-compatible storage