use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SkillEventRecord { pub id: String, pub session_id: Option, pub event_type: String, pub skill_name: Option, pub payload: serde_json::Value, pub created_at: i64, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SessionRecord { pub id: String, pub title: String, pub channel_name: String, pub chat_id: String, pub summary: Option, pub created_at: i64, pub updated_at: i64, pub last_active_at: i64, pub archived_at: Option, pub deleted_at: Option, pub message_count: i64, pub reset_cutoff_seq: i64, pub user_turn_count: i64, pub agent_prompt_reinjection_count: i64, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct MemoryRecord { pub id: String, pub scope_kind: String, pub scope_key: String, pub namespace: String, pub memory_key: String, pub content: String, pub source_type: String, pub source_session_id: Option, pub source_message_id: Option, pub source_message_seq: Option, pub source_channel_name: Option, pub source_chat_id: Option, pub created_at: i64, pub updated_at: i64, } #[derive(Debug, Clone)] pub struct MemoryUpsert { pub scope_kind: String, pub scope_key: String, pub namespace: String, pub memory_key: String, pub content: String, pub source_type: String, pub source_session_id: Option, pub source_message_id: Option, pub source_message_seq: Option, pub source_channel_name: Option, pub source_chat_id: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum SchedulerJobState { Scheduled, Running, Paused, Completed, } impl SchedulerJobState { pub fn as_str(&self) -> &'static str { match self { SchedulerJobState::Scheduled => "scheduled", SchedulerJobState::Running => "running", SchedulerJobState::Paused => "paused", SchedulerJobState::Completed => "completed", } } pub fn from_str(value: &str) -> Option { match value { "scheduled" => Some(Self::Scheduled), "running" => Some(Self::Running), "paused" => Some(Self::Paused), "completed" => Some(Self::Completed), _ => None, } } } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum SchedulerJobStatus { Ok, Error, Skipped, } impl SchedulerJobStatus { pub fn as_str(&self) -> &'static str { match self { SchedulerJobStatus::Ok => "ok", SchedulerJobStatus::Error => "error", SchedulerJobStatus::Skipped => "skipped", } } pub fn from_str(value: &str) -> Option { match value { "ok" => Some(Self::Ok), "error" => Some(Self::Error), "skipped" => Some(Self::Skipped), _ => None, } } } impl Default for SchedulerJobState { fn default() -> Self { Self::Scheduled } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SchedulerJobRecord { pub id: String, pub kind: String, pub schedule: serde_json::Value, pub interval_secs: i64, pub startup_delay_secs: i64, pub target: serde_json::Value, pub payload: serde_json::Value, pub enabled: bool, pub state: SchedulerJobState, pub last_status: Option, pub last_error: Option, pub run_count: i64, pub max_runs: Option, pub last_fired_at: Option, pub next_fire_at: Option, pub paused_at: Option, pub completed_at: Option, pub created_at: i64, pub updated_at: i64, } #[derive(Debug, Clone)] pub struct SchedulerJobUpsert { pub id: String, pub kind: String, pub schedule: serde_json::Value, pub interval_secs: i64, pub startup_delay_secs: i64, pub target: serde_json::Value, pub payload: serde_json::Value, pub enabled: bool, pub state: SchedulerJobState, pub last_status: Option, pub last_error: Option, pub run_count: i64, pub max_runs: Option, pub last_fired_at: Option, pub next_fire_at: Option, pub paused_at: Option, pub completed_at: Option, }