package model import "time" type Node struct { ID string `json:"id"` Kind string `json:"kind"` Label string `json:"label"` Summary string `json:"summary,omitempty"` Status string `json:"status,omitempty"` Origin string `json:"origin"` ExternalID string `json:"external_id,omitempty"` URI string `json:"uri,omitempty"` Categories []string `json:"categories,omitempty"` Keywords []string `json:"keywords,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` Weight float64 `json:"weight,omitempty"` X float64 `json:"x"` Y float64 `json:"y"` Z float64 `json:"z"` UpdatedAt time.Time `json:"updated_at"` } type Evidence struct { NodeID string `json:"node_id,omitempty"` URI string `json:"uri,omitempty"` Excerpt string `json:"excerpt,omitempty"` } type Edge struct { ID string `json:"id"` Source string `json:"source"` Target string `json:"target"` Type string `json:"type"` Origin string `json:"origin"` Status string `json:"status,omitempty"` Confidence float64 `json:"confidence,omitempty"` Weight float64 `json:"weight,omitempty"` Explanation string `json:"explanation,omitempty"` Evidence []Evidence `json:"evidence,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } type Hub struct { NodeID string `json:"node_id"` Label string `json:"label"` Kind string `json:"kind"` Degree int `json:"degree"` } type GraphAnalysis struct { NodeCount int `json:"node_count"` EdgeCount int `json:"edge_count"` Components int `json:"components"` KnowledgeOrphans int `json:"knowledge_orphans"` StagingNodes int `json:"staging_nodes"` AIThinkNodes int `json:"ai_think_nodes"` ExternalNodes int `json:"external_nodes"` AIEdges int `json:"ai_edges"` Contradictions int `json:"contradictions"` TopHubs []Hub `json:"top_hubs"` } type Snapshot struct { Version uint64 `json:"version"` Nodes []Node `json:"nodes"` Edges []Edge `json:"edges"` UpdatedAt time.Time `json:"updated_at"` } type Hit struct { NodeID string `json:"node_id"` Label string `json:"label"` Score float64 `json:"score"` Kind string `json:"kind"` Status string `json:"status,omitempty"` } type Activity struct { ID string `json:"id"` Type string `json:"type"` Source string `json:"source"` Phase string `json:"phase,omitempty"` Query string `json:"query,omitempty"` Message string `json:"message,omitempty"` NodeIDs []string `json:"node_ids,omitempty"` EdgeIDs []string `json:"edge_ids,omitempty"` Strength float64 `json:"strength,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` Timestamp time.Time `json:"timestamp"` } type ExternalEvent struct { Type string `json:"type"` Source string `json:"source"` Query string `json:"query,omitempty"` Message string `json:"message,omitempty"` Hits []ExternalHit `json:"hits,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` } type ExternalHit struct { ID string `json:"id"` Score float64 `json:"score,omitempty"` } type QueryRequest struct { Query string `json:"query"` } type QueryResponse struct { Query string `json:"query"` Answer string `json:"answer"` Hits []Hit `json:"hits"` UsedNodeIDs []string `json:"used_node_ids,omitempty"` Uncertainties []string `json:"uncertainties,omitempty"` DurationMS int64 `json:"duration_ms"` } type RelationDecision struct { Related bool `json:"related"` RelationType string `json:"relation_type"` Confidence float64 `json:"confidence"` Explanation string `json:"explanation"` NeedsResearch bool `json:"needs_research"` ResearchQuery string `json:"research_query"` TopicLabel string `json:"topic_label"` Keywords []string `json:"keywords"` } type ArticlePlanDecision struct { Action string `json:"action"` TargetArticleID string `json:"target_article_id"` Reason string `json:"reason"` ExpectedValue string `json:"expected_value"` ArticleType string `json:"article_type"` SourceNodeIDs []string `json:"source_node_ids"` MissingInformation []string `json:"missing_information"` Contradictions []string `json:"contradictions"` NeedsResearch bool `json:"needs_research"` ResearchQuery string `json:"research_query"` } type GroundedStatement struct { Text string `json:"text"` SourceRefs []string `json:"source_refs"` } type KnowledgeConflict struct { Topic string `json:"topic"` Statements []string `json:"statements"` SourceRefs []string `json:"source_refs"` Resolution string `json:"resolution"` Severity string `json:"severity"` NeedsResearch bool `json:"needs_research"` ResearchQuery string `json:"research_query"` } type KnowledgeGap struct { ID string `json:"id"` Description string `json:"description"` Reason string `json:"reason,omitempty"` ResearchQueries []string `json:"research_queries,omitempty"` } type ResolvedKnowledgeGap struct { ID string `json:"id"` Description string `json:"description"` SourceRefs []string `json:"source_refs"` } type KnowledgeBrief struct { Topic string `json:"topic"` Purpose string `json:"purpose"` Scope []GroundedStatement `json:"scope"` Facts []GroundedStatement `json:"facts"` Symptoms []GroundedStatement `json:"symptoms"` Prerequisites []GroundedStatement `json:"prerequisites"` SolutionSteps []GroundedStatement `json:"solution_steps"` ValidationSteps []GroundedStatement `json:"validation_steps"` Troubleshooting []GroundedStatement `json:"troubleshooting"` Contradictions []KnowledgeConflict `json:"contradictions"` CriticalGaps []KnowledgeGap `json:"critical_gaps"` OptionalGaps []KnowledgeGap `json:"optional_gaps"` ResolvedGaps []ResolvedKnowledgeGap `json:"resolved_gaps"` MissingInformation []string `json:"missing_information"` ResearchQueries []string `json:"research_queries"` ReadyForArticle bool `json:"ready_for_article"` } type KnowledgeArticleContent struct { Title string `json:"title"` ProblemDescription string `json:"problem_description"` Scope string `json:"scope"` Symptoms []string `json:"symptoms"` KeyPoints []string `json:"key_points"` DecisionCriteria []string `json:"decision_criteria"` Prerequisites []string `json:"prerequisites"` SolutionSteps []string `json:"solution_steps"` ValidationSteps []string `json:"validation_steps"` Troubleshooting []string `json:"troubleshooting"` Categories []string `json:"categories"` Keywords []string `json:"keywords"` OpenQuestions []string `json:"open_questions"` } type ArticleClaimReview struct { Claim string `json:"claim"` Verdict string `json:"verdict"` SourceRefs []string `json:"source_refs,omitempty"` Reason string `json:"reason,omitempty"` } type ArticleQualityDecision struct { Accepted bool `json:"accepted"` Confidence float64 `json:"confidence"` MetaContentDetected bool `json:"meta_content_detected"` UnsupportedClaims []string `json:"unsupported_claims"` Issues []string `json:"issues"` ClaimReviews []ArticleClaimReview `json:"claim_reviews,omitempty"` MissingEvidenceQueries []string `json:"missing_evidence_queries,omitempty"` RewriteInstructions []string `json:"rewrite_instructions,omitempty"` } type KnowledgeArticleDraft struct { Title string `json:"title"` Text string `json:"text"` Answer string `json:"answer"` Prerequisites []string `json:"prerequisites"` Validation []string `json:"validation"` Troubleshooting []string `json:"troubleshooting"` Categories []string `json:"categories"` Keywords []string `json:"keywords"` SourceNodeIDs []string `json:"source_node_ids"` Confidence float64 `json:"confidence"` OpenQuestions []string `json:"open_questions"` } type AnswerDecision struct { Answer string `json:"answer"` UsedNodeIDs []string `json:"used_node_ids"` Uncertainties []string `json:"uncertainties"` } // ResearchTask is a persistent autonomous research job. It is stored in the // graph SQLite database and executed asynchronously by the low-priority // research worker. type ResearchTask struct { ID string `json:"id"` DedupeKey string `json:"dedupe_key,omitempty"` Topic string `json:"topic"` Reason string `json:"reason"` RequestedBy string `json:"requested_by"` Status string `json:"status"` Priority float64 `json:"priority"` SeedNodeIDs []string `json:"seed_node_ids,omitempty"` Questions []string `json:"questions,omitempty"` QueriesDE []string `json:"queries_de,omitempty"` QueriesEN []string `json:"queries_en,omitempty"` Attempts int `json:"attempts"` MaxAttempts int `json:"max_attempts"` EvidenceCount int `json:"evidence_count"` ArticleCreated bool `json:"article_created"` ArticleTitle string `json:"article_title,omitempty"` ArticlePath string `json:"article_path,omitempty"` Outcome string `json:"outcome,omitempty"` LastError string `json:"last_error,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` AvailableAt time.Time `json:"available_at"` LeaseUntil time.Time `json:"lease_until,omitempty"` StartedAt time.Time `json:"started_at,omitempty"` CompletedAt time.Time `json:"completed_at,omitempty"` } // ResearchTaskRequest is accepted by the external trigger API. type ResearchTaskRequest struct { Topic string `json:"topic"` Question string `json:"question,omitempty"` Questions []string `json:"questions,omitempty"` SeedNodeIDs []string `json:"seed_node_ids,omitempty"` Priority float64 `json:"priority,omitempty"` RequestedBy string `json:"requested_by,omitempty"` Reason string `json:"reason,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` } // AutonomousResearchOpportunity is the structured output of the opportunity // planner. It converts graph signals into a concrete, bounded research task. type AutonomousResearchOpportunity struct { Worthy bool `json:"worthy"` Topic string `json:"topic"` Reason string `json:"reason"` Priority float64 `json:"priority"` Questions []string `json:"questions"` QueriesDE []string `json:"queries_de"` QueriesEN []string `json:"queries_en"` SeedNodeIDs []string `json:"seed_node_ids"` } type ResearchResult struct { Title string `json:"title"` URL string `json:"url"` Snippet string `json:"snippet,omitempty"` Content string `json:"content"` ContentType string `json:"content_type,omitempty"` Query string `json:"query,omitempty"` Language string `json:"language,omitempty"` Round int `json:"round,omitempty"` Fetched bool `json:"fetched,omitempty"` FetchError string `json:"fetch_error,omitempty"` Relevant bool `json:"relevant,omitempty"` Relevance float64 `json:"relevance,omitempty"` SourceQuality string `json:"source_quality,omitempty"` SourceQualityScore float64 `json:"source_quality_score,omitempty"` Actionable bool `json:"actionable,omitempty"` CoveredGapIDs []string `json:"covered_gap_ids,omitempty"` AssessmentReason string `json:"assessment_reason,omitempty"` } type ResearchQuestion struct { GapID string `json:"gap_id"` Question string `json:"question"` Critical bool `json:"critical"` ExpectActionable bool `json:"expect_actionable"` QueriesDE []string `json:"queries_de"` QueriesEN []string `json:"queries_en"` PreferredDomains []string `json:"preferred_domains"` } type ResearchPlan struct { Questions []ResearchQuestion `json:"questions"` } type ResearchCandidateAssessment struct { Index int `json:"index"` Relevant bool `json:"relevant"` Relevance float64 `json:"relevance"` SourceQuality string `json:"source_quality"` SourceQualityScore float64 `json:"source_quality_score"` Actionable bool `json:"actionable"` CoveredGapIDs []string `json:"covered_gap_ids"` Reason string `json:"reason"` } type ResearchAssessmentBatch struct { Assessments []ResearchCandidateAssessment `json:"assessments"` }