Skip to main content

agent_storage/conversation/
conversation.rs

1//! Conversation metadata and model-visible message history.
2
3use super::ConversationId;
4use crate::FamilyId;
5use agent_runtime::Message;
6use chrono::{DateTime, Utc};
7use serde::{Deserialize, Serialize};
8
9/// A conversation and its complete model-visible message history.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct Conversation {
12    pub id: ConversationId,
13    /// Stable external identity, for example `telegram:<user_id>`.
14    pub owner: String,
15    pub agent: String,
16    /// User-editable display name. Defaults when reading older conversation files.
17    #[serde(default = "super::default_conversation_title")]
18    pub title: String,
19    /// Whether the conversation is hidden from the default conversation list.
20    #[serde(default)]
21    pub archived: bool,
22    /// Family explicitly selected for this conversation; absent in legacy records.
23    #[serde(default)]
24    pub selected_family_id: Option<FamilyId>,
25    pub created_at: DateTime<Utc>,
26    pub updated_at: DateTime<Utc>,
27    pub messages: Vec<Message>,
28}