MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / AgentSession

Class AgentSession

atomic-agent/src/turn/session.rs:107–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected