pub struct SessionMetadata {Show 19 fields
pub id: String,
pub file_path: PathBuf,
pub project_path: String,
pub first_timestamp: Option<DateTime<Utc>>,
pub last_timestamp: Option<DateTime<Utc>>,
pub message_count: u64,
pub total_tokens: u64,
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_creation_tokens: u64,
pub cache_read_tokens: u64,
pub models_used: Vec<String>,
pub file_size_bytes: u64,
pub first_user_message: Option<String>,
pub has_subagents: bool,
pub duration_seconds: Option<u64>,
pub branch: Option<String>,
pub tool_usage: HashMap<String, usize>,
pub tool_token_usage: HashMap<String, u64>,
}Expand description
Metadata extracted from a session without full parse
Created by streaming the JSONL until session_end event.
Fields§
§id: StringSession ID (from filename or content)
file_path: PathBufFull path to the JSONL file
project_path: StringProject path (extracted from directory structure)
first_timestamp: Option<DateTime<Utc>>First timestamp in session
last_timestamp: Option<DateTime<Utc>>Last timestamp in session
message_count: u64Total message count (from summary or counted)
total_tokens: u64Total tokens (from summary)
input_tokens: u64Token breakdown for precise pricing
output_tokens: u64§cache_creation_tokens: u64§cache_read_tokens: u64§models_used: Vec<String>Models used in this session
file_size_bytes: u64File size in bytes
first_user_message: Option<String>Preview of first user message (truncated to 200 chars)
has_subagents: boolWhether this session spawned subagents
duration_seconds: Option<u64>Duration in seconds (from summary)
branch: Option<String>Git branch name (normalized, extracted from first gitBranch in session)
tool_usage: HashMap<String, usize>Tool usage statistics: tool name -> call count Extracted from tool_calls in assistant messages during session scan
tool_token_usage: HashMap<String, u64>Per-tool token attribution: tool name -> tokens Proportionally distributed from message-level token counts
Implementations§
Source§impl SessionMetadata
impl SessionMetadata
Sourcepub fn from_path(path: PathBuf, project_path: String) -> Self
pub fn from_path(path: PathBuf, project_path: String) -> Self
Create a minimal metadata from just file path
Sourcepub fn duration_display(&self) -> String
pub fn duration_display(&self) -> String
Human-readable duration
Sourcepub fn size_display(&self) -> String
pub fn size_display(&self) -> String
Human-readable file size
Trait Implementations§
Source§impl Clone for SessionMetadata
impl Clone for SessionMetadata
Source§fn clone(&self) -> SessionMetadata
fn clone(&self) -> SessionMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more