Skip to main content

AgentSessionEntry

Struct AgentSessionEntry 

Source
pub struct AgentSessionEntry {
    pub session_ref: String,
    pub short_id: Option<String>,
    pub cwd: Option<String>,
    pub started_at_ms: Option<i64>,
    pub state: Option<String>,
    pub pid: Option<i64>,
}
Expand description

One session from an agent’s sessions command output: a JSON array of objects, of which the fields below are read and everything else ignored. sessionId (falling back to id) is the durable reference substituted into {session}; cwd and startedAt (ms epoch) identify a fresh dispatch’s session among its siblings; state and pid together say whether the session is still going (AgentSessionEntry::liveness).

Fields§

§session_ref: String§short_id: Option<String>§cwd: Option<String>§started_at_ms: Option<i64>§state: Option<String>§pid: Option<i64>

The supervisor process behind this session, where the listing names one. Authoritative for liveness when present (DESIGN.md §8), since a listing keeps entries for sessions whose state it never retires.

Implementations§

Source§

impl AgentSessionEntry

Source

pub fn matches_ref(&self, session_ref: &str) -> bool

Whether this entry is the session a stored reference points at — either id form matches, since a log-parsed fallback may record the short id.

Source

pub fn liveness(&self) -> SessionLiveness

Classify this entry’s liveness (DESIGN.md §8). A listing that keeps an entry forever is the case this exists for: an agent’s own listing may leave a long-dead session sitting at blocked and never say done, so not-done cannot mean live. A named pid decides it — which keeps a genuinely stalled session, blocked on a permission prompt with its supervisor alive, reading as live and attachable. Failing a pid, only working claims the session is going; anything else, including a state this doesn’t recognise or no state at all, reads as dead.

Source

pub fn at_rest(&self) -> bool

Whether this entry says its session’s turn has ended — the narrow reading the rest rule acts on (DESIGN.md §8), which is not the same question as liveness. Only done answers yes. blocked is the case that makes the distinction load-bearing: it reads dead without a live pid, but it is also what a permission prompt and a supervisor mid-turn look like, and stopping either would cut a turn off mid-sentence. Every other state, and an entry with no state at all, is likewise not a hand-back.

Trait Implementations§

Source§

impl Clone for AgentSessionEntry

Source§

fn clone(&self) -> AgentSessionEntry

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 AgentSessionEntry

Source§

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

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

impl Eq for AgentSessionEntry

Source§

impl PartialEq for AgentSessionEntry

Source§

fn eq(&self, other: &AgentSessionEntry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AgentSessionEntry

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.