A single node in a TreeKnowledge. `summary` is mandatory because agents navigate by reading it. `content` is the optional full-text body (typically populated only on leaves to keep the tree small in memory). `children_ids` is an adjacency list; the parent `TreeKnowledge` resolves th
| 20 | |
| 21 | |
| 22 | class StructureTreeValidationError(ValueError): |
| 23 | """A structure tree failed its code-owned integrity gate.""" |
| 24 | |
| 25 | |
| 26 | class TreeNode(BaseModel): |
| 27 | """A single node in a TreeKnowledge. |
| 28 | |
| 29 | `summary` is mandatory because agents navigate by reading it. `content` |
| 30 | is the optional full-text body (typically populated only on leaves to |
| 31 | keep the tree small in memory). `children_ids` is an adjacency list; the |
| 32 | parent `TreeKnowledge` resolves them via its `nodes` map. |
| 33 | """ |
| 34 | |
| 35 | model_config = ConfigDict(extra="forbid", frozen=True) |
| 36 | |
| 37 | node_id: UUID = Field(default_factory=uuid4) |
| 38 | parent_id: UUID | None = None |
| 39 | position: int = 0 |
| 40 | title: str |
| 41 | summary: str |
| 42 | content: str | None = None |
| 43 | citations: list[Citation] = Field(default_factory=list) |
| 44 | children_ids: list[UUID] = Field(default_factory=list) |
| 45 | |
| 46 | |
| 47 | class StructureTree(BaseModel): |
no outgoing calls