Spaces:
Sleeping
Sleeping
File size: 3,466 Bytes
1fce18e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | """
Thought Engine Node β Pydantic Models
======================================
Contract: C-THOUGHT-NODE-001 (Phase 1 Sovereign Substrate)
Request/Response shapes for the sovereign REST API.
"""
from pydantic import BaseModel, Field
from typing import Optional, List, Any
from enum import Enum
# ββ Enums ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
class ThoughtClass(str, Enum):
HYPOTHESIS = "hypothesis"
OBSERVATION = "observation"
VALIDATION = "validation"
COUNTER_ARGUMENT = "counter_argument"
SYNTHESIS = "synthesis"
DECISION = "decision"
QUESTION = "question"
PROPOSAL = "proposal"
class ThoughtStatus(str, Enum):
OPEN = "open"
PROPOSED = "proposed"
UNDER_REVIEW = "under_review"
ACCEPTED = "accepted"
REJECTED = "rejected"
MERGED = "merged"
SUPERSEDED = "superseded"
class EdgeRelation(str, Enum):
DERIVES_FROM = "derives_from"
SUPPORTS = "supports"
CHALLENGES = "challenges"
REFINES = "refines"
FORKS_FROM = "forks_from"
MERGES_INTO = "merges_into"
BUBBLES_FROM = "bubbles_from"
BUBBLES_INTO = "bubbles_into"
class ReviewAction(str, Enum):
PROPOSE = "propose"
ACCEPT = "accept"
REJECT = "reject"
SUPERSEDE = "supersede"
class SessionStatus(str, Enum):
ACTIVE = "active"
ARCHIVED = "archived"
MERGED = "merged"
# ββ Request Bodies βββββββββββββββββββββββββββββββββββββββββββββ
class CreateSessionReq(BaseModel):
title: Optional[str] = None
initial_thought: str
thought_class: ThoughtClass = ThoughtClass.OBSERVATION
agent_id: str = "system"
class AddThoughtReq(BaseModel):
content: str
thought_class: ThoughtClass = ThoughtClass.OBSERVATION
agent_id: str = "system"
parent_thought_id: Optional[str] = None
confidence: Optional[float] = None
class ForkThoughtReq(BaseModel):
source_thought_id: str
branch_label: str
agent_id: str = "system"
class CreateProposalReq(BaseModel):
parent_thought_id: str
content: str
note: str = ""
agent_id: str = "system"
class ReviewProposalReq(BaseModel):
action: ReviewAction
actor: str = "system"
reason: Optional[str] = None
class SearchReq(BaseModel):
pattern: str
# ββ Response Bodies ββββββββββββββββββββββββββββββββββββββββββββ
class SessionInfo(BaseModel):
session_id: str
title: Optional[str]
created_by: str
created_at: str
status: str
root_thought_id: Optional[str]
active_thought_id: Optional[str]
class ThoughtInfo(BaseModel):
thought_id: str
session_id: str
content: str
thought_class: str
origin_agent: str
status: str
confidence: Optional[float]
created_at: str
class EdgeInfo(BaseModel):
edge_id: str
source_id: str
target_id: str
relation: str
class TreeNode(BaseModel):
thought_id: str
content: str
thought_class: str
status: str
origin_agent: str
children: List["TreeNode"] = []
|