Skip to main content

Session

Struct Session 

Source
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: String

Human-readable label, e.g. worker/eu-zip.

§cwd: String

Working 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: String

Transport 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: PermissionPolicy

Permission 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: bool

Whether 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: u32

Cumulative 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

Source

pub fn ended_or_created_ms(&self) -> u64

Time the session ended, falling back to creation time for older logs.

Source

pub fn project_root(&self) -> &str

Which project this session belongs to: main repo for worktrees, otherwise working directory.

Source

pub fn format_budget(&self) -> Option<String>

Returns string formatted as $1.20/$5 when cost limit is configured.

Trait Implementations§

Source§

impl Clone for Session

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Session

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Session

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Session

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.