pub struct SessionMetadata {
pub id: String,
pub name: Option<String>,
pub project_path: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub message_count: usize,
pub last_input_tokens: u64,
pub total_output_tokens: u64,
pub compression_history: Vec<CompressionHistoryEntry>,
}Expand description
Session metadata stored in the index.
Fields§
§id: StringUnique session identifier (UUID).
name: Option<String>User-defined session name (optional).
project_path: Option<String>Project path this session is associated with (optional).
created_at: DateTime<Utc>When the session was created.
updated_at: DateTime<Utc>When the session was last updated.
message_count: usizeNumber of messages in the session.
last_input_tokens: u64Last input tokens reported.
total_output_tokens: u64Cumulative output tokens.
compression_history: Vec<CompressionHistoryEntry>Compression history entries.
Implementations§
Source§impl SessionMetadata
impl SessionMetadata
Sourcepub fn new(project_path: Option<&Path>) -> Self
pub fn new(project_path: Option<&Path>) -> Self
Create a new session metadata with a fresh UUID and auto-generated name.
Sourcepub fn add_compression_entry(&mut self, entry: CompressionHistoryEntry)
pub fn add_compression_entry(&mut self, entry: CompressionHistoryEntry)
Add a compression entry to history.
Sourcepub fn total_tokens_saved(&self) -> u32
pub fn total_tokens_saved(&self) -> u32
Get total tokens saved across all compressions.
Sourcepub fn compression_count(&self) -> usize
pub fn compression_count(&self) -> usize
Get compression count.
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Get a display name for the session. Returns user-defined name if set, otherwise a time-based fallback.
Sourcepub fn format_line(&self, is_current: bool) -> String
pub fn format_line(&self, is_current: bool) -> String
Format the session for display in a list.
Trait Implementations§
Source§impl Clone for SessionMetadata
impl Clone for SessionMetadata
Source§fn clone(&self) -> SessionMetadata
fn clone(&self) -> SessionMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionMetadata
impl Debug for SessionMetadata
Source§impl<'de> Deserialize<'de> for SessionMetadata
impl<'de> Deserialize<'de> for SessionMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionMetadata
impl RefUnwindSafe for SessionMetadata
impl Send for SessionMetadata
impl Sync for SessionMetadata
impl Unpin for SessionMetadata
impl UnsafeUnpin for SessionMetadata
impl UnwindSafe for SessionMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more