| 104 | /// separate session IDs and separate files. |
| 105 | #[derive(Clone, Debug, Serialize, Deserialize)] |
| 106 | pub struct AgentSession { |
| 107 | /// Unique session identifier (assigned by the agent). |
| 108 | /// |
| 109 | /// Format varies by agent — UUID for Claude Code, path-derived for Gemini CLI. |
| 110 | pub session_id: String, |
| 111 | |
| 112 | /// The Atomic view name for this session's turn changes. |
| 113 | /// |
| 114 | /// Format: `agent-{session_id}`. Created on first turn recording. |
| 115 | #[serde(alias = "stack_name")] |
| 116 | pub view_name: String, |
| 117 | |
| 118 | /// Current lifecycle phase. |
| 119 | pub phase: Phase, |
| 120 | |
| 121 | /// Number of turns completed in this session. |
| 122 | /// |
| 123 | /// Incremented after each successful turn recording. Turn 1 is the first |
| 124 | /// turn after the session starts. |
| 125 | pub turn_count: u32, |
| 126 | |
| 127 | /// Agent registry key (e.g., "claude-code", "gemini-cli"). |
| 128 | pub agent_name: String, |
| 129 | |
| 130 | /// Human-readable agent name (e.g., "Claude Code", "Gemini CLI"). |
| 131 | pub agent_display_name: String, |
| 132 | |
| 133 | /// AI vendor identifier (e.g., "anthropic", "google"). |
| 134 | #[serde(default)] |
| 135 | pub agent_vendor: String, |
| 136 | |
| 137 | /// AI model identifier (e.g., "claude-sonnet-4-20250514"). |
| 138 | #[serde(default)] |
| 139 | pub model: String, |
| 140 | |
| 141 | /// When the session was created. |
| 142 | pub started_at: DateTime<Utc>, |
| 143 | |
| 144 | /// When the session was last interacted with (any hook callback). |
| 145 | /// |
| 146 | /// Updated by `apply_common_actions` via the `SessionState` trait impl. |
| 147 | /// Used for stale session detection in `atomic agent status`. |
| 148 | #[serde(default)] |
| 149 | pub last_interaction: Option<DateTime<Utc>>, |
| 150 | |
| 151 | /// When the session ended (agent process exited). |
| 152 | /// |
| 153 | /// `None` while the session is active. Set when `SessionStop` is received. |
| 154 | /// Cleared if the session is re-entered via `SessionStart`. |
| 155 | #[serde(default)] |
| 156 | pub ended_at: Option<DateTime<Utc>>, |
| 157 | |
| 158 | /// The view that was current when this session started. |
| 159 | /// |
| 160 | /// The agent view is forked from this view so it inherits all existing |
| 161 | /// changes (e.g., `.atomicignore`, project config). When the session ends, |
| 162 | /// changes can be applied back to this view. |
| 163 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected