agtrace_index/
records.rs

1use agtrace_types::ProjectHash;
2
3/// Project metadata record from the index database.
4///
5/// Stores project-level information discovered during scanning.
6#[derive(Debug, Clone)]
7pub struct ProjectRecord {
8    /// Project identifier (hash of root path).
9    pub hash: ProjectHash,
10    /// Absolute path to project root directory, if known.
11    pub root_path: Option<String>,
12    /// Last time this project was scanned (ISO 8601 timestamp).
13    pub last_scanned_at: Option<String>,
14}
15
16/// Complete session record from the index database.
17///
18/// Contains all indexed metadata for a session, including validity status.
19/// Used internally by the index layer.
20#[derive(Debug, Clone)]
21pub struct SessionRecord {
22    /// Session UUID.
23    pub id: String,
24    /// Project this session belongs to.
25    pub project_hash: ProjectHash,
26    /// Provider name (claude, codex, gemini).
27    pub provider: String,
28    /// Session start timestamp (ISO 8601).
29    pub start_ts: Option<String>,
30    /// Session end timestamp (ISO 8601), if completed.
31    pub end_ts: Option<String>,
32    /// First user message snippet for display.
33    pub snippet: Option<String>,
34    /// Whether the session was successfully parsed and validated.
35    pub is_valid: bool,
36}
37
38/// Log file metadata record from the index database.
39///
40/// Tracks individual log files that contribute to sessions.
41#[derive(Debug, Clone)]
42pub struct LogFileRecord {
43    /// Absolute path to the log file.
44    pub path: String,
45    /// Session UUID this file belongs to.
46    pub session_id: String,
47    /// File role (main, metadata, etc.).
48    pub role: String,
49    /// File size in bytes.
50    pub file_size: Option<i64>,
51    /// File modification time (ISO 8601 timestamp).
52    pub mod_time: Option<String>,
53}
54
55/// Lightweight session summary for list operations.
56///
57/// Returned by session listing APIs. Contains only the essential
58/// information needed for session selection and preview.
59/// This is the primary type SDK users interact with when browsing sessions.
60#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
61pub struct SessionSummary {
62    /// Session UUID.
63    pub id: String,
64    /// Provider name (claude, codex, gemini).
65    pub provider: String,
66    /// Project this session belongs to.
67    pub project_hash: ProjectHash,
68    /// Session start timestamp (ISO 8601).
69    pub start_ts: Option<String>,
70    /// First user message snippet for display.
71    pub snippet: Option<String>,
72}