use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::collections::HashMap; #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct CodeChange { pub timestamp: u64, pub file_path: String, pub description: String, pub git_commit: Option, pub git_branch: Option, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct StickyNote { pub timestamp: u64, pub content: String, #[serde(default)] pub expires_at: Option, } pub fn default_namespace() -> String { "global".to_string() } #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] pub struct Entity { pub name: String, pub entity_type: String, #[serde(default)] pub observations: Vec, #[serde(default = "default_namespace")] pub namespace: String, #[serde(default)] pub git_branch: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, JsonSchema)] pub struct Relation { pub from: String, pub to: String, pub relation_type: String, #[serde(default = "default_namespace")] pub namespace: String, } #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct KnowledgeGraph { #[serde(default)] pub entities: HashMap, #[serde(default)] pub relations: Vec, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct AcceptanceCriteria { pub id: String, pub description: String, pub is_met: bool, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Task { pub id: String, pub title: String, pub status: String, pub description: String, pub created_at: u64, pub updated_at: u64, pub git_branch: Option, #[serde(default)] pub parent_id: Option, #[serde(default)] pub expires_at: Option, #[serde(default)] pub dependencies: Vec, #[serde(default)] pub acceptance_criteria: Vec, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Snippet { pub name: String, pub language: String, pub code: String, pub description: String, pub updated_at: u64, #[serde(default)] pub embedding: Option>, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Adr { pub id: String, pub title: String, pub context: String, pub decision: String, pub consequence: String, #[serde(default = "default_adr_status")] pub status: String, #[serde(default)] pub supersedes: Option, pub timestamp: u64, } fn default_adr_status() -> String { "accepted".to_string() } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Preference { pub key: String, pub value: String, pub updated_at: u64, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct ErrorFix { pub signature: String, pub solution: String, pub timestamp: u64, pub git_commit: Option, pub git_branch: Option, #[serde(default)] pub embedding: Option>, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct PinnedFile { pub namespace: String, pub file_path: String, pub timestamp: u64, pub git_branch: Option, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct SessionSummary { pub timestamp: u64, pub summary: String, pub namespace: String, #[serde(default)] pub expires_at: Option, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct HandoffMemo { pub id: String, pub author: String, pub content: String, #[serde(default)] pub expires_at: Option, pub namespace: String, pub timestamp: u64, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct EnvFingerprint { pub namespace: String, pub os: String, pub shell: String, pub tool_versions: HashMap, pub updated_at: u64, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct EnvRequirement { pub namespace: String, pub key: String, pub description: String, pub is_secret: bool, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Milestone { pub id: String, pub title: String, pub status: String, pub namespace: String, pub target_date: Option, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct EnvironmentDetail { pub namespace: String, pub name: String, pub url: String, pub description: String, pub requires_vpn: bool, pub updated_at: u64, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct PrChecklistItem { pub namespace: String, pub id: String, pub description: String, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct TechDebt { pub id: String, pub namespace: String, pub description: String, pub ideal_solution: String, pub is_resolved: bool, pub created_at: u64, pub git_commit: Option, pub git_branch: Option, #[serde(default)] pub embedding: Option>, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct ContextWorkspace { pub name: String, pub namespace: String, pub pinned_files: Vec, pub active_task_ids: Vec, pub saved_at: u64, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct GateRecord { pub id: String, pub action: String, pub target: String, pub namespace: Option, pub params: std::collections::HashMap, pub status: String, pub reason: Option, pub timestamp: u64, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct TerminalHistory { pub command: String, pub exit_code: i32, pub cwd: String, pub os: String, pub timestamp: u64, }