use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Entity {
pub id: String,
pub name: String,
pub entity_type: String,
#[serde(default, alias = "domain")]
pub space: Option<String>,
pub source_agent: Option<String>,
pub confidence: Option<f32>,
pub confirmed: bool,
pub created_at: i64,
pub updated_at: i64,
#[serde(default)]
pub aliases: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EntitySearchResult {
pub entity: Entity,
pub distance: f32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EntityDetail {
pub entity: Entity,
pub observations: Vec<Observation>,
pub relations: Vec<RelationWithEntity>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Observation {
pub id: String,
pub entity_id: String,
pub content: String,
pub source_agent: Option<String>,
pub confidence: Option<f32>,
pub confirmed: bool,
pub created_at: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Relation {
pub id: String,
pub from_entity: String,
pub to_entity: String,
pub relation_type: String,
pub source_agent: Option<String>,
pub created_at: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RelationWithEntity {
pub id: String,
pub relation_type: String,
pub direction: String,
pub entity_id: String,
pub entity_name: String,
pub entity_type: String,
pub source_agent: Option<String>,
pub created_at: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct KnowledgeGraphResponse {
pub entities: Vec<Entity>,
pub relations: Vec<GraphRelation>,
pub memories: Vec<GraphMemoryNode>,
pub memory_links: Vec<GraphMemoryLink>,
pub pages: Vec<GraphPageNode>,
pub page_links: Vec<GraphPageLink>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphRelation {
pub id: String,
pub from_entity: String,
pub to_entity: String,
pub relation_type: String,
pub source_agent: Option<String>,
pub created_at: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphMemoryNode {
pub source_id: String,
pub title: String,
pub memory_type: Option<String>,
pub space: Option<String>,
pub confirmed: bool,
pub last_modified: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphMemoryLink {
pub memory_id: String,
pub entity_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphPageNode {
pub id: String,
pub title: String,
pub space: Option<String>,
pub creation_kind: String,
pub entity_id: Option<String>,
pub last_modified: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphRef {
pub kind: String,
pub id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphPageLink {
pub from: GraphRef,
pub to: GraphRef,
pub link_type: String,
}