pub struct Session {Show 26 fields
pub id: SessionId,
pub kind: AgentKind,
pub label: String,
pub cwd: String,
pub branch: Option<String>,
pub role: Role,
pub status: SessionStatus,
pub model: Option<String>,
pub cost: Cost,
pub parent: Option<SessionId>,
pub created_ms: u64,
pub transport: String,
pub status_note: Option<String>,
pub repo_root: Option<String>,
pub permission: PermissionPolicy,
pub context: Option<ContextUsage>,
pub native_id: Option<String>,
pub budget_usd: Option<f64>,
pub over_budget: bool,
pub handed_off_to: Option<SessionId>,
pub effort: Option<String>,
pub slash_commands: Vec<String>,
pub active_tools: Vec<ActiveTool>,
pub bg_procs: Vec<BgProc>,
pub tool_calls: u32,
pub ended_ms: Option<u64>,
}Expand description
A running instance of an agent.
Fields§
§id: SessionId§kind: AgentKind§label: StringHuman-readable label, e.g. worker/eu-zip.
cwd: StringWorking directory (may be a worktree path).
branch: Option<String>Records branch name if within a worktree.
role: Role§status: SessionStatus§model: Option<String>§cost: Cost§parent: Option<SessionId>Creator (human or session ID).
created_ms: u64§transport: StringTransport used by adapter (for display).
status_note: Option<String>Short progress note reported by the agent via ertangle_status.
repo_root: Option<String>Root directory of the main repo when creating a worktree (for merge/gc/pr).
permission: PermissionPolicyPermission policy for this session (auto if absent in older logs).
context: Option<ContextUsage>Context usage (reported by agent; absent in older logs).
native_id: Option<String>Native conversation ID of the agent (Claude session id, Codex thread id, ACP sessionId) for resumption.
None indicates this session cannot be resumed (older logs, PTY, or agent did not declare load capability).
budget_usd: Option<f64>Cost limit for this session (USD; resolved actual limit).
over_budget: boolWhether the cost limit has been reached (interrupts turn and rejects new prompts until manually raised).
handed_off_to: Option<SessionId>Successor session (set by Event::SessionHandedOff after handoff; absent in older logs).
effort: Option<String>Current reasoning effort (resolved at startup or updated at runtime; absent in older logs).
slash_commands: Vec<String>Native slash commands reported by agent (without /; Claude slash_commands, ACP available_commands_update).
active_tools: Vec<ActiveTool>Currently executing tools or subagents.
bg_procs: Vec<BgProc>List of remaining background child processes.
tool_calls: u32Cumulative tool call count (counts start events only; approximate turn count, absent in older logs).
ended_ms: Option<u64>When the session last stopped being live (ms since epoch). Drives the retention clocks for ended sessions and archived entries; absent in older logs.
Implementations§
Source§impl Session
impl Session
Sourcepub fn ended_or_created_ms(&self) -> u64
pub fn ended_or_created_ms(&self) -> u64
Time the session ended, falling back to creation time for older logs.
Sourcepub fn project_root(&self) -> &str
pub fn project_root(&self) -> &str
Which project this session belongs to: main repo for worktrees, otherwise working directory.
Sourcepub fn format_budget(&self) -> Option<String>
pub fn format_budget(&self) -> Option<String>
Returns string formatted as $1.20/$5 when cost limit is configured.